https://github.com/libsdl-org/Maelstrom/commit/218c09b2dc2938c8b89d39ca41dc19d102fd139e
From 218c09b2dc2938c8b89d39ca41dc19d102fd139e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 24 Nov 2011 10:25:48 -0500
Subject: [PATCH] Removed temporary code to dump images
---
game/MaelstromUI.cpp | 4 +---
game/init.cpp | 12 ++++--------
game/load.cpp | 5 ++---
screenlib/SDL_FrameBuf.cpp | 5 +----
screenlib/SDL_FrameBuf.h | 2 +-
5 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/game/MaelstromUI.cpp b/game/MaelstromUI.cpp
index cb3f0dfc..2a32fa2f 100644
--- a/game/MaelstromUI.cpp
+++ b/game/MaelstromUI.cpp
@@ -374,7 +374,7 @@ UIDrawEngineSprite::Load(rapidxml::xml_node<> *node, const UITemplates *template
{
rapidxml::xml_attribute<> *attr;
int baseID;
- //Mac_ResData *S, *M;
+ Mac_ResData *S, *M;
if (!UIDrawEngine::Load(node, templates)) {
return false;
@@ -388,7 +388,6 @@ UIDrawEngineSprite::Load(rapidxml::xml_node<> *node, const UITemplates *template
baseID = SDL_atoi(attr->value());
/* Load the image */
-/*
SDL_Texture *image = NULL;
if ((S = spriteres->Resource("icl8", baseID)) != NULL &&
(M = spriteres->Resource("ICN#", baseID)) != NULL) {
@@ -399,7 +398,6 @@ UIDrawEngineSprite::Load(rapidxml::xml_node<> *node, const UITemplates *template
return false;
}
m_element->SetImage(image);
-*/
return true;
}
diff --git a/game/init.cpp b/game/init.cpp
index 3688b42b..bab1057b 100644
--- a/game/init.cpp
+++ b/game/init.cpp
@@ -206,8 +206,8 @@ static void InitShots(void)
int xx = 30;
/* Load the shot images */
- gPlayerShot = screen->LoadImage(SHOT_SIZE, SHOT_SIZE, gPlayerShotColors, NULL, "PlayerShot.bmp");
- gEnemyShot = screen->LoadImage(SHOT_SIZE, SHOT_SIZE, gEnemyShotColors, NULL, "EnemyShot.bmp");
+ gPlayerShot = screen->LoadImage(SHOT_SIZE,SHOT_SIZE,gPlayerShotColors);
+ gEnemyShot = screen->LoadImage(SHOT_SIZE, SHOT_SIZE, gEnemyShotColors);
/* Now setup the shot origin table */
@@ -1087,9 +1087,7 @@ static int LoadSprite(Mac_Resource *spriteres,
SetRect(&aBlit->hitRect, left, top, right, bottom);
/* Load the image */
-char file[32];
-sprintf(file, "ICN#%d.bmp", baseID+index);
- aBlit->sprite[index] = screen->LoadImage(32, 32, S->data, mask, file);
+ aBlit->sprite[index] = screen->LoadImage(32, 32, S->data, mask);
if ( aBlit->sprite[index] == NULL ) {
error(
"LoadSprite(%d+%d): Couldn't convert sprite image!\n", baseID, index);
@@ -1210,9 +1208,7 @@ static int LoadSmallSprite(Mac_Resource *spriteres,
SetRect(&aBlit->hitRect, left, top, right, bottom);
/* Load the image */
-char file[32];
-sprintf(file, "ics#%d.bmp", baseID+index);
- aBlit->sprite[index] = screen->LoadImage(16, 16, S->data, mask, file);
+ aBlit->sprite[index] = screen->LoadImage(16, 16, S->data, mask);
if ( aBlit->sprite[index] == NULL ) {
error(
"LoadSprite(%d+%d): Couldn't convert sprite image!\n", baseID, index);
diff --git a/game/load.cpp b/game/load.cpp
index 03f25705..c70161c8 100644
--- a/game/load.cpp
+++ b/game/load.cpp
@@ -43,7 +43,7 @@ SDL_Texture *Load_Title(FrameBuf *screen, int title_id)
}
/* Create an image from the BMP */
- title = screen->LoadImage(bmp);
+ title = screen->LoadImage(bmp->w, bmp->h, (Uint8 *)bmp->pixels, NULL);
SDL_FreeSurface(bmp);
return(title);
}
@@ -83,8 +83,7 @@ SDL_Texture *GetCIcon(FrameBuf *screen, short cicn_id)
}
SDL_RWclose(cicn_src);
- sprintf(file, "Maelstrom_Icon#%d.bmp", cicn_id);
- cicn = screen->LoadImage(w, h, pixels, mask, file);
+ cicn = screen->LoadImage(w, h, pixels, mask);
delete[] pixels;
delete[] mask;
if ( cicn == NULL ) {
diff --git a/screenlib/SDL_FrameBuf.cpp b/screenlib/SDL_FrameBuf.cpp
index 17f4ae55..3db20e24 100644
--- a/screenlib/SDL_FrameBuf.cpp
+++ b/screenlib/SDL_FrameBuf.cpp
@@ -274,7 +274,7 @@ FrameBuf:: ScreenDump(const char *prefix, int x, int y, int w, int h)
}
SDL_Texture *
-FrameBuf:: LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask, const char *file)
+FrameBuf:: LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask)
{
SDL_Texture *texture;
Uint32 *artwork;
@@ -320,9 +320,6 @@ FrameBuf:: LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask, const char *file)
}
}
-SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(artwork, w, h, 32, w*4, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
-SDL_SaveBMP(surface, file);
-SDL_FreeSurface(surface);
texture = LoadImage(w, h, artwork);
if ( mask ) {
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
diff --git a/screenlib/SDL_FrameBuf.h b/screenlib/SDL_FrameBuf.h
index c090120f..ea4f7176 100644
--- a/screenlib/SDL_FrameBuf.h
+++ b/screenlib/SDL_FrameBuf.h
@@ -240,7 +240,7 @@ class FrameBuf : public ErrorBase {
}
/* Load and convert an 8-bit image with the given mask */
- SDL_Texture *LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask, const char *file);
+ SDL_Texture *LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask = NULL);
SDL_Texture *LoadImage(int w, int h, Uint32 *pixels);
SDL_Texture *LoadImage(SDL_Surface *surface);
int GetImageWidth(SDL_Texture *image) {