Moved face sprites to their own array.

Man, that was really difficult. Every time something wrong happened,
segfault. Ugh... Anyway, that's done.
This commit is contained in:
onpon4 2016-01-04 09:01:54 -05:00
parent 697a302fc6
commit ab53fac4a8
7 changed files with 20 additions and 16 deletions

View File

@ -414,7 +414,8 @@ enum {
FACE_KLINE, FACE_KLINE,
FACE_PHOEBE, FACE_PHOEBE,
FACE_URSULA, FACE_URSULA,
FACE_CREW FACE_CREW,
FACE_MAX
}; };
// Missions // Missions

View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
SDL_Surface *gfx_background; SDL_Surface *gfx_background;
SDL_Surface *gfx_sprites[MAX_SPRITES]; SDL_Surface *gfx_sprites[MAX_SPRITES];
SDL_Surface *gfx_faceSprites[FACE_MAX];
SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES]; SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES]; SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES]; SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];

View File

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern SDL_Surface *gfx_background; extern SDL_Surface *gfx_background;
extern SDL_Surface *gfx_sprites[MAX_SPRITES]; extern SDL_Surface *gfx_sprites[MAX_SPRITES];
extern SDL_Surface *gfx_faceSprites[FACE_MAX];
extern SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES]; extern SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES]; extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
extern SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES]; extern SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];

View File

@ -353,7 +353,7 @@ static void intermission_updateCommsSurface(SDL_Surface *comms)
char string[255]; char string[255];
gfx_drawRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00); gfx_drawRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
gfx_blit(gfx_sprites[FACE_CHRIS], 20, 15, comms); gfx_blit(gfx_faceSprites[FACE_CHRIS], 20, 15, comms);
gfx_renderString("Chris Bainfield", 80, 15, FONT_WHITE, 0, comms); gfx_renderString("Chris Bainfield", 80, 15, FONT_WHITE, 0, comms);
sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name); sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
gfx_renderString(string, 80, 35, FONT_WHITE, 0, comms); gfx_renderString(string, 80, 35, FONT_WHITE, 0, comms);
@ -375,7 +375,7 @@ static void intermission_createCommsSurface(SDL_Surface *comms)
{ {
yOffset = systemPlanet[i].messageSlot * 60; yOffset = systemPlanet[i].messageSlot * 60;
gfx_drawRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77); gfx_drawRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
gfx_blit(gfx_sprites[systemPlanet[i].faceImage], 20, 110 + yOffset, comms); gfx_blit(gfx_faceSprites[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
gfx_renderString(systemPlanet[i].from, 80, 110 + yOffset, FONT_WHITE, 0, comms); gfx_renderString(systemPlanet[i].from, 80, 110 + yOffset, FONT_WHITE, 0, comms);
gfx_renderString(systemPlanet[i].subject, 80, 130 + yOffset, FONT_CYAN, 0, comms); gfx_renderString(systemPlanet[i].subject, 80, 130 + yOffset, FONT_CYAN, 0, comms);
gfx_renderString("INCOMPLETE", 350, 110 + yOffset, FONT_RED, 0, comms); gfx_renderString("INCOMPLETE", 350, 110 + yOffset, FONT_RED, 0, comms);
@ -426,7 +426,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
faceNumber = getFace(string); faceNumber = getFace(string);
if (faceNumber > -1) if (faceNumber > -1)
{ {
gfx_blit(gfx_sprites[faceNumber], 10, y, comms); gfx_blit(gfx_faceSprites[faceNumber], 10, y, comms);
col = FONT_WHITE; col = FONT_WHITE;
} }
else else
@ -608,12 +608,12 @@ int intermission()
gfx_sprites[34] = gfx_loadImage("gfx/planet_orange.png"); gfx_sprites[34] = gfx_loadImage("gfx/planet_orange.png");
// Faces (as defines) // Faces (as defines)
gfx_sprites[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png"); gfx_faceSprites[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
gfx_sprites[FACE_SID] = gfx_loadImage("gfx/face_sid.png"); gfx_faceSprites[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
gfx_sprites[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png"); gfx_faceSprites[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
gfx_sprites[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png"); gfx_faceSprites[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
gfx_sprites[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png"); gfx_faceSprites[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
gfx_sprites[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png"); gfx_faceSprites[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
engine.done = 0; engine.done = 0;
engine.keyState[KEY_FIRE] = 0; engine.keyState[KEY_FIRE] = 0;

View File

@ -71,17 +71,18 @@ Sets a radio message that appears at the top of the screen. Used for
script events, etc. We send a message priority too, since we don't want script events, etc. We send a message priority too, since we don't want
Phoebe or Ursula's banter to interrupt an important message Phoebe or Ursula's banter to interrupt an important message
*/ */
void setRadioMessage(signed char face, const char *in, int priority) void setRadioMessage(int face, const char *in, int priority)
{ {
SDL_Surface *faceShape = NULL;
if ((gfx_textSprites[TS_RADIO].life > 0) && (priority == 0)) if ((gfx_textSprites[TS_RADIO].life > 0) && (priority == 0))
return; return;
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE); gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
gfx_textSprites[TS_RADIO].life = 240; gfx_textSprites[TS_RADIO].life = 240;
SDL_Surface *faceShape = NULL;
if (face > -1) if (face > -1)
faceShape = gfx_sprites[face]; faceShape = gfx_faceSprites[face];
gfx_createMessageBox(faceShape, in, 1); gfx_createMessageBox(faceShape, in, 1);
} }
@ -97,7 +98,7 @@ int getFace(const char *face)
for (int i = 0 ; i < 7 ; i++) for (int i = 0 ; i < 7 ; i++)
{ {
if (strcmp(faces[i], face) == 0) if (strcmp(faces[i], face) == 0)
return 90 + i; return FACE_CHRIS + i;
} }
return -1; return -1;

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern void clearInfoLines(); extern void clearInfoLines();
void copyInfoLine(int a, int b); void copyInfoLine(int a, int b);
extern void setInfoLine(const char *in, int color); extern void setInfoLine(const char *in, int color);
extern void setRadioMessage(signed char face, const char *in, int priority); extern void setRadioMessage(int face, const char *in, int priority);
extern int getFace(const char *face); extern int getFace(const char *face);
extern void resetLists(); extern void resetLists();

View File

@ -193,7 +193,7 @@ void doCutscene(int scene)
face = NULL; face = NULL;
if (cutMessage[currentMessage].face != -1) if (cutMessage[currentMessage].face != -1)
face = gfx_sprites[cutMessage[currentMessage].face]; face = gfx_faceSprites[cutMessage[currentMessage].face];
gfx_createMessageBox(face, cutMessage[currentMessage].message, 0); gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
} }
} }