Some cleanup I forgot to do in gfx.cpp.

This commit is contained in:
onpon4 2016-01-03 22:39:16 -05:00
parent e4633652f9
commit 697a302fc6
19 changed files with 300 additions and 296 deletions

View File

@ -981,8 +981,8 @@ void aliens_init()
aliens[i].imageIndex[0] += 15;
aliens[i].imageIndex[1] += 15;
aliens[i].image[0] = shipShape[aliens[i].imageIndex[0]];
aliens[i].image[1] = shipShape[aliens[i].imageIndex[1]];
aliens[i].image[0] = gfx_shipSprites[aliens[i].imageIndex[0]];
aliens[i].image[1] = gfx_shipSprites[aliens[i].imageIndex[1]];
}
}
}
@ -1213,8 +1213,8 @@ void alien_addSmallAsteroid(object *hostAlien)
{
aliens[index] = alien_defs[CD_ASTEROID2];
aliens[index].imageIndex[0] = aliens[index].imageIndex[1] = 39 + rand() % 2;
aliens[index].image[0] = shipShape[aliens[index].imageIndex[0]];
aliens[index].image[1] = shipShape[aliens[index].imageIndex[1]];
aliens[index].image[0] = gfx_shipSprites[aliens[index].imageIndex[0]];
aliens[index].image[1] = gfx_shipSprites[aliens[index].imageIndex[1]];
}
else
{

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011, 2012 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -131,7 +131,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy)
{
bullet->dx = RANDRANGE(-20, 20);
bullet->dy = RANDRANGE(-20, 20);
bullet->image[0] = shape[4];
bullet->image[0] = gfx_sprites[4];
}
engine.bulletTail->next = bullet;

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -58,9 +58,9 @@ object *cargo_add(object *owner, int cargoType)
cargo[index].dx = 0;
cargo[index].dy = 0;
cargo[index].collectType = cargoType;
cargo[index].image[0] = shape[32];
cargo[index].image[0] = gfx_sprites[32];
if (cargoType == P_PHOEBE)
cargo[index].image[0] = shipShape[20];
cargo[index].image[0] = gfx_shipSprites[20];
return &cargo[index];
}

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011, 2012 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -153,52 +153,52 @@ void collectable_add(float x, float y, int type, int value, int life)
switch(type)
{
case P_CASH:
collectable->image = shape[24];
collectable->image = gfx_sprites[24];
break;
case P_ROCKET:
collectable->image = shape[49];
collectable->image = gfx_sprites[49];
break;
case P_PLASMA_AMMO:
collectable->image = shape[25];
collectable->image = gfx_sprites[25];
break;
case P_SHIELD:
collectable->image = shape[26];
collectable->image = gfx_sprites[26];
break;
case P_PLASMA_SHOT:
collectable->image = shape[27];
collectable->image = gfx_sprites[27];
break;
case P_PLASMA_RATE:
collectable->image = shape[28];
collectable->image = gfx_sprites[28];
break;
case P_PLASMA_DAMAGE:
collectable->image = shape[29];
collectable->image = gfx_sprites[29];
break;
case P_CARGO:
collectable->image = shape[32];
collectable->image = gfx_sprites[32];
break;
case P_SUPER:
collectable->image = shape[50];
collectable->image = gfx_sprites[50];
break;
case P_MINE:
collectable->image = shape[31];
collectable->image = gfx_sprites[31];
break;
case P_SLAVES:
case P_ESCAPEPOD:
collectable->image = shape[45];
collectable->image = gfx_sprites[45];
break;
case P_ORE:
collectable->image = shape[46 + rand() % 3];
collectable->image = gfx_sprites[46 + rand() % 3];
break;
}

View File

@ -102,11 +102,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define WF_TIMEDEXPLOSION 2048
#define MAX_WEAPONS 20
#define MAX_SHAPES 100
#define MAX_SHIPSHAPES 120
#define MAX_TEXTSHAPES 150
#define MAX_FONTSHAPES 6
#define MAX_SHOPSHAPES 6
#define MAX_SPRITES 100
#define MAX_SHIPSPRITES 120
#define MAX_TEXTSPRITES 150
#define MAX_FONTSPRITES 6
#define MAX_SHOPSPRITES 6
#define MAX_CARGO 20
#define MAX_INFOLINES 3
#define MAX_EVENTS 20
@ -283,7 +283,7 @@ enum {
CD_URSULA
};
// Text shapes (main menu)
// Text sprites (main menu)
enum {
TS_PRESENTS,
TS_AN_SDL_GAME,
@ -312,11 +312,11 @@ enum {
TS_DIFFICULTY
};
// Text shapes (intermission)
// Text sprites (intermission)
enum {
};
// Text shapes (mission)
// Text sprites (mission)
enum {
TS_RADIO = MAX_INFOLINES,
TS_SHIELD,

View File

@ -266,10 +266,10 @@ void engine_cleanup()
delete(engine.collectableHead);
delete(screen_bufferHead);
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
{
if (fontShape[i] != NULL)
SDL_FreeSurface(fontShape[i]);
if (gfx_fontSprites[i] != NULL)
SDL_FreeSurface(gfx_fontSprites[i]);
}
char filename[PATH_MAX];

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -35,7 +35,7 @@ void explosion_add(float x, float y, int type)
explosion->y = y;
explosion->thinktime = 28;
explosion->face = type;
explosion->image[0] = shape[type];
explosion->image[0] = gfx_sprites[type];
engine.explosionTail->next = explosion;
engine.explosionTail = explosion;

View File

@ -1085,7 +1085,7 @@ static void game_doAliens()
(aliens[i].classDef != CD_ASTEROID2))
explosion_addEngine(&aliens[i]);
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
screen_blit(shipShape[shapeToUse], (int)aliens[i].x,
screen_blit(gfx_shipSprites[shapeToUse], (int)aliens[i].x,
(int)aliens[i].y);
if (aliens[i].flags & FL_DISABLED)
{
@ -1395,7 +1395,7 @@ static void game_doPlayer()
LIMIT_ADD(player.hit, -1, 0, 100);
screen_blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
screen_blit(gfx_shipSprites[shapeToUse], (int)player.x, (int)player.y);
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
(rand() % 5 < 1))
explosion_add(player.x + RANDRANGE(-10, 10),
@ -1481,7 +1481,7 @@ static void game_doCargo()
// draw the chain link line
for (int j = 0 ; j < 10 ; j++)
{
screen_blit(shape[30], (int)chainX, (int)chainY);
screen_blit(gfx_sprites[30], (int)chainX, (int)chainY);
chainX -= dx;
chainY -= dy;
}
@ -1560,7 +1560,7 @@ void game_doExplosions()
else
{
explosion->face++;
explosion->image[0] = shape[explosion->face];
explosion->image[0] = gfx_sprites[explosion->face];
}
}
}
@ -1604,31 +1604,31 @@ static void game_doArrow(int i)
if (sxy == sx) {
arrow = x < screen->w / 2 ? 42 : 38;
x -= x > screen->w / 2 ? shape[arrow]->w : 0;
y -= shape[arrow]->h / 2;
x -= x > screen->w / 2 ? gfx_sprites[arrow]->w : 0;
y -= gfx_sprites[arrow]->h / 2;
} else {
arrow = y < screen->h / 2 ? 36 : 40;
x -= shape[arrow]->w / 2;
y -= y > screen->h / 2 ? shape[arrow]->h : 0;
x -= gfx_sprites[arrow]->w / 2;
y -= y > screen->h / 2 ? gfx_sprites[arrow]->h : 0;
}
screen_blit(shape[arrow], x, y);
screen_blit(gfx_sprites[arrow], x, y);
if (i != engine.targetIndex)
return;
if (gfx_text[TS_RADIO].life > 0)
if (gfx_textSprites[TS_RADIO].life > 0)
return;
if (sxy == sx) {
x -= x > screen->w / 2 ? 5 + shape[44]->w : -5 - shape[arrow]->w;
y -= (shape[44]->h - shape[arrow]->h) / 2;
x -= x > screen->w / 2 ? 5 + gfx_sprites[44]->w : -5 - gfx_sprites[arrow]->w;
y -= (gfx_sprites[44]->h - gfx_sprites[arrow]->h) / 2;
} else {
x -= (shape[44]->w - shape[arrow]->w) / 2;
y -= y > screen->h / 2 ? 5 + shape[44]->h : -5 - shape[arrow]->h;
x -= (gfx_sprites[44]->w - gfx_sprites[arrow]->w) / 2;
y -= y > screen->h / 2 ? 5 + gfx_sprites[44]->h : -5 - gfx_sprites[arrow]->h;
}
screen_blit(shape[44], x, y);
screen_blit(gfx_sprites[44], x, y);
}
static void game_doHud()
@ -1769,28 +1769,28 @@ static void game_doHud()
for (int i = 0 ; i < MAX_INFOLINES ; i++)
{
if (gfx_text[i].life > 0)
if (gfx_textSprites[i].life > 0)
{
gfx_text[i].y = screen->h - 75 - (i * 20);
gfx_textSprites[i].y = screen->h - 75 - (i * 20);
screen_blitText(i);
gfx_text[i].life--;
gfx_textSprites[i].life--;
if (gfx_text[i].life == 0)
if (gfx_textSprites[i].life == 0)
{
for (int j = i ; j < MAX_INFOLINES - 1 ; j++)
{
copyInfoLine(j + 1, j);
}
gfx_text[MAX_INFOLINES - 1].life = 0;
gfx_textSprites[MAX_INFOLINES - 1].life = 0;
}
}
}
// Show the radio message if there is one
if (gfx_text[TS_RADIO].life > 0)
if (gfx_textSprites[TS_RADIO].life > 0)
{
screen_blit(messageBox, (screen->w - messageBox->w) / 2, 50);
gfx_text[TS_RADIO].life--;
screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, 50);
gfx_textSprites[TS_RADIO].life--;
}
// Do the target's remaining shield (if required)

View File

@ -22,14 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
SDL_Surface *gfx_background;
SDL_Surface *shape[MAX_SHAPES];
SDL_Surface *shipShape[MAX_SHIPSHAPES];
SDL_Surface *fontShape[MAX_FONTSHAPES];
SDL_Surface *shopSurface[MAX_SHOPSHAPES];
bRect *screen_bufferHead;
bRect *screen_bufferTail;
textObject gfx_text[MAX_TEXTSHAPES];
SDL_Surface *messageBox;
SDL_Surface *gfx_sprites[MAX_SPRITES];
SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
textObject gfx_textSprites[MAX_TEXTSPRITES];
SDL_Surface *gfx_messageBox;
void gfx_init()
{
@ -37,23 +35,23 @@ void gfx_init()
screen_bufferHead->next = NULL;
screen_bufferTail = screen_bufferHead;
for (int i = 0 ; i < MAX_SHAPES ; i++)
shape[i] = NULL;
for (int i = 0 ; i < MAX_SPRITES ; i++)
gfx_sprites[i] = NULL;
for (int i = 0 ; i < MAX_SHIPSHAPES ; i++)
shipShape[i] = NULL;
for (int i = 0 ; i < MAX_SHIPSPRITES ; i++)
gfx_shipSprites[i] = NULL;
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
gfx_text[i].image = NULL;
for (int i = 0 ; i < MAX_TEXTSPRITES ; i++)
gfx_textSprites[i].image = NULL;
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
shopSurface[i] = NULL;
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
gfx_shopSprites[i] = NULL;
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
fontShape[i] = NULL;
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
gfx_fontSprites[i] = NULL;
gfx_background = NULL;
messageBox = NULL;
gfx_messageBox = NULL;
screen = NULL;
}
@ -118,7 +116,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
letter.x *= 8;
/* Blit onto the screen surface */
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
if (SDL_BlitSurface(gfx_fontSprites[fontColor], &letter, dest, &area) < 0)
{
printf("BlitSurface error: %s\n", SDL_GetError());
engine_showError(2, "");
@ -150,7 +148,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
{
letter.x = (int)('-') - 33;
letter.x *= 8;
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
if (SDL_BlitSurface(gfx_fontSprites[fontColor], &letter, dest, &area) < 0)
{
printf("BlitSurface error: %s\n", SDL_GetError());
engine_showError(2, "");
@ -358,25 +356,25 @@ SDL_Surface *gfx_createTextSurface(const char *inString, int color)
void gfx_createTextObject(int index, const char *inString, int x, int y, int fontColor)
{
/* Shortcut: if we already rendered the same string in the same color, don't render it again. */
if(gfx_text[index].text && gfx_text[index].image && gfx_text[index].fontColor == fontColor && !strcmp(gfx_text[index].text, inString)) {
gfx_text[index].x = x;
gfx_text[index].y = y;
if(gfx_textSprites[index].text && gfx_textSprites[index].image && gfx_textSprites[index].fontColor == fontColor && !strcmp(gfx_textSprites[index].text, inString)) {
gfx_textSprites[index].x = x;
gfx_textSprites[index].y = y;
if (x == -1)
gfx_text[index].x = (screen->w - gfx_text[index].image->w) / 2;
gfx_textSprites[index].x = (screen->w - gfx_textSprites[index].image->w) / 2;
return;
}
strcpy(gfx_text[index].text, inString);
gfx_text[index].x = x;
gfx_text[index].y = y;
gfx_text[index].fontColor = fontColor;
if (gfx_text[index].image != NULL)
strcpy(gfx_textSprites[index].text, inString);
gfx_textSprites[index].x = x;
gfx_textSprites[index].y = y;
gfx_textSprites[index].fontColor = fontColor;
if (gfx_textSprites[index].image != NULL)
{
SDL_FreeSurface(gfx_text[index].image);
SDL_FreeSurface(gfx_textSprites[index].image);
}
gfx_text[index].image = gfx_createTextSurface(inString, fontColor);
gfx_textSprites[index].image = gfx_createTextSurface(inString, fontColor);
if (x == -1)
gfx_text[index].x = (screen->w - gfx_text[index].image->w) / 2;
gfx_textSprites[index].x = (screen->w - gfx_textSprites[index].image->w) / 2;
}
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
@ -394,29 +392,29 @@ void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char tr
{
int x = 60;
if (messageBox != NULL)
if (gfx_messageBox != NULL)
{
SDL_FreeSurface(messageBox);
messageBox = NULL;
SDL_FreeSurface(gfx_messageBox);
gfx_messageBox = NULL;
}
if (transparent)
messageBox = gfx_createAlphaRect(550, 60, 0x00, 0x00, 0x00);
gfx_messageBox = gfx_createAlphaRect(550, 60, 0x00, 0x00, 0x00);
else
messageBox = gfx_createSurface(550, 60);
gfx_messageBox = gfx_createSurface(550, 60);
if (face != NULL)
{
gfx_drawRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0xaa);
gfx_blit(face, 5, 5, messageBox);
gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0xaa);
gfx_blit(face, 5, 5, gfx_messageBox);
}
else
{
gfx_drawRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0x00);
gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0x00);
x = 10;
}
gfx_renderString(message, x, 5, FONT_WHITE, 1, messageBox);
gfx_renderString(message, x, 5, FONT_WHITE, 1, gfx_messageBox);
}
SDL_Surface *gfx_loadImage(const char *filename)
@ -445,45 +443,45 @@ SDL_Surface *gfx_loadImage(const char *filename)
void gfx_free()
{
for (int i = 0 ; i < MAX_SHAPES ; i++)
for (int i = 0 ; i < MAX_SPRITES ; i++)
{
if (shape[i] != NULL)
if (gfx_sprites[i] != NULL)
{
SDL_FreeSurface(shape[i]);
shape[i] = NULL;
SDL_FreeSurface(gfx_sprites[i]);
gfx_sprites[i] = NULL;
}
}
for (int i = 0 ; i < MAX_SHIPSHAPES ; i++)
for (int i = 0 ; i < MAX_SHIPSPRITES ; i++)
{
if (shipShape[i] != NULL)
if (gfx_shipSprites[i] != NULL)
{
SDL_FreeSurface(shipShape[i]);
shipShape[i] = NULL;
SDL_FreeSurface(gfx_shipSprites[i]);
gfx_shipSprites[i] = NULL;
}
}
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
for (int i = 0 ; i < MAX_TEXTSPRITES ; i++)
{
if (gfx_text[i].image != NULL)
if (gfx_textSprites[i].image != NULL)
{
SDL_FreeSurface(gfx_text[i].image);
gfx_text[i].image = NULL;
SDL_FreeSurface(gfx_textSprites[i].image);
gfx_textSprites[i].image = NULL;
}
}
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
{
if (shopSurface[i] != NULL)
if (gfx_shopSprites[i] != NULL)
{
SDL_FreeSurface(shopSurface[i]);
shopSurface[i] = NULL;
SDL_FreeSurface(gfx_shopSprites[i]);
gfx_shopSprites[i] = NULL;
}
}
if (messageBox != NULL)
if (gfx_messageBox != NULL)
{
SDL_FreeSurface(messageBox);
messageBox = NULL;
SDL_FreeSurface(gfx_messageBox);
gfx_messageBox = NULL;
}
}

View File

@ -23,13 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
extern SDL_Surface *gfx_background;
extern SDL_Surface *shape[MAX_SHAPES];
extern SDL_Surface *shipShape[MAX_SHIPSHAPES];
extern SDL_Surface *fontShape[MAX_FONTSHAPES];
extern SDL_Surface *shopSurface[MAX_SHOPSHAPES];
extern textObject gfx_text[MAX_TEXTSHAPES];
extern SDL_Surface *messageBox;
extern SDL_Surface *gfx_sprites[MAX_SPRITES];
extern SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
extern SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
extern textObject gfx_textSprites[MAX_TEXTSPRITES];
extern SDL_Surface *gfx_messageBox;
void gfx_init();
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);

View File

@ -26,9 +26,9 @@ static void intermission_doCursor()
{
getPlayerInput();
LIMIT(engine.cursor_x, 10, screen->w - 10 - shape[0]->w);
LIMIT(engine.cursor_y, 10, screen->h - 10 - shape[0]->h);
screen_blit(shape[0], engine.cursor_x, engine.cursor_y);
LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[0]->w);
LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[0]->h);
screen_blit(gfx_sprites[0], engine.cursor_x, engine.cursor_y);
}
/*
@ -146,20 +146,20 @@ static void intermission_setStatusLines()
gfx_createTextObject(26, string, -1, 0, FONT_WHITE);
gfx_createTextObject(27, "Current Status", -1, 0, FONT_WHITE);
gfx_text[0].y = 400;
gfx_text[0].x = 150;
gfx_textSprites[0].y = 400;
gfx_textSprites[0].x = 150;
for (int i = 1 ; i < 25 ; i++)
{
gfx_text[i].y = gfx_text[i - 1].y + 20;
gfx_textSprites[i].y = gfx_textSprites[i - 1].y + 20;
if ((i == 7) || (i == 16) || (i == 19))
gfx_text[i].y += 25;
gfx_textSprites[i].y += 25;
gfx_text[i].x = 150;
gfx_textSprites[i].x = 150;
}
gfx_text[26].y = 404;
gfx_text[27].y = 83;
gfx_textSprites[26].y = 404;
gfx_textSprites[27].y = 83;
}
/*
@ -204,7 +204,7 @@ static void intermission_setSystemPlanets()
systemPlanet[i].y = distance;
strcpy(systemPlanet[i].name, name);
systemPlanet[i].image = shape[image];
systemPlanet[i].image = gfx_sprites[image];
}
int messageMission;
@ -247,7 +247,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
bool rtn = false;
// Blit the sun
screen_blit(shape[30], 370, 220);
screen_blit(gfx_sprites[30], 370, 220);
for (int i = 50 ; i < 300 ; i+= planetSpace)
{
@ -320,20 +320,20 @@ static void intermission_showStatus(SDL_Surface *infoSurface)
for (int i = 0 ; i < 22 ; i++)
{
gfx_text[i].y -= speed;
if ((gfx_text[i].y > 80) && (gfx_text[i].y < 400))
gfx_textSprites[i].y -= speed;
if ((gfx_textSprites[i].y > 80) && (gfx_textSprites[i].y < 400))
screen_blitText(i);
}
if (gfx_text[21].y < 65)
if (gfx_textSprites[21].y < 65)
{
gfx_text[0].y = 400;
gfx_textSprites[0].y = 400;
for (int i = 1 ; i < 25 ; i++)
{
gfx_text[i].y = gfx_text[i - 1].y + 20;
gfx_textSprites[i].y = gfx_textSprites[i - 1].y + 20;
if ((i == 7) || (i == 16) || (i == 19))
gfx_text[i].y += 25;
gfx_textSprites[i].y += 25;
}
}
@ -353,7 +353,7 @@ static void intermission_updateCommsSurface(SDL_Surface *comms)
char string[255];
gfx_drawRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
gfx_blit(shape[FACE_CHRIS], 20, 15, comms);
gfx_blit(gfx_sprites[FACE_CHRIS], 20, 15, comms);
gfx_renderString("Chris Bainfield", 80, 15, FONT_WHITE, 0, comms);
sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
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;
gfx_drawRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
gfx_blit(shape[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
gfx_blit(gfx_sprites[systemPlanet[i].faceImage], 20, 110 + yOffset, 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("INCOMPLETE", 350, 110 + yOffset, FONT_RED, 0, comms);
@ -426,7 +426,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
faceNumber = getFace(string);
if (faceNumber > -1)
{
gfx_blit(shape[faceNumber], 10, y, comms);
gfx_blit(gfx_sprites[faceNumber], 10, y, comms);
col = FONT_WHITE;
}
else
@ -587,33 +587,33 @@ int intermission()
engine.cursor_x = screen->w / 2;
engine.cursor_y = screen->h / 2;
shape[0] = gfx_loadImage("gfx/cursor.png");
gfx_sprites[0] = gfx_loadImage("gfx/cursor.png");
// Icons 1 - 29
for (int i = 0 ; i < 26 ; i++)
{
sprintf(string, "gfx/icon%d.png", (i + 1));
shape[i + 1] = gfx_loadImage(string);
gfx_sprites[i + 1] = gfx_loadImage(string);
}
shape[27] = gfx_loadImage("gfx/buyIcon.png");
shape[28] = gfx_loadImage("gfx/sellIcon.png");
shape[29] = gfx_loadImage("gfx/firefly1.png");
gfx_sprites[27] = gfx_loadImage("gfx/buyIcon.png");
gfx_sprites[28] = gfx_loadImage("gfx/sellIcon.png");
gfx_sprites[29] = gfx_loadImage("gfx/firefly1.png");
// Planets 30 - 39
shape[30] = gfx_loadImage("gfx/planet_sun.png");
shape[31] = gfx_loadImage("gfx/planet_green.png");
shape[32] = gfx_loadImage("gfx/planet_blue.png");
shape[33] = gfx_loadImage("gfx/planet_red.png");
shape[34] = gfx_loadImage("gfx/planet_orange.png");
gfx_sprites[30] = gfx_loadImage("gfx/planet_sun.png");
gfx_sprites[31] = gfx_loadImage("gfx/planet_green.png");
gfx_sprites[32] = gfx_loadImage("gfx/planet_blue.png");
gfx_sprites[33] = gfx_loadImage("gfx/planet_red.png");
gfx_sprites[34] = gfx_loadImage("gfx/planet_orange.png");
// Faces (as defines)
shape[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
shape[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
shape[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
shape[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
shape[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
shape[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
gfx_sprites[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
gfx_sprites[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
gfx_sprites[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
gfx_sprites[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
gfx_sprites[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
gfx_sprites[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
engine.done = 0;
engine.keyState[KEY_FIRE] = 0;
@ -911,13 +911,13 @@ int intermission()
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
continue;
else if (game.stationedPlanet == game.destinationPlanet)
screen_blit(shape[1], 80 + (i * 90), 500);
screen_blit(gfx_sprites[1], 80 + (i * 90), 500);
else if (game.stationedPlanet != game.destinationPlanet)
screen_blit(shape[26], 80 + (i * 90), 500);
screen_blit(gfx_sprites[26], 80 + (i * 90), 500);
}
else
{
screen_blit(shape[i + 1], 80 + (i * 90), 500);
screen_blit(gfx_sprites[i + 1], 80 + (i * 90), 500);
}
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))

View File

@ -23,15 +23,15 @@ void clearInfoLines()
{
for (int i = 0 ; i < 4 ; i++)
{
gfx_text[i].life = 0;
gfx_textSprites[i].life = 0;
}
}
// from a to b
void copyInfoLine(int a, int b)
{
gfx_createTextObject(b, gfx_text[a].text, -1, 0, gfx_text[a].fontColor);
gfx_text[b].life = gfx_text[a].life;
gfx_createTextObject(b, gfx_textSprites[a].text, -1, 0, gfx_textSprites[a].fontColor);
gfx_textSprites[b].life = gfx_textSprites[a].life;
}
/*
@ -46,7 +46,7 @@ void setInfoLine(const char *in, int color)
for (int i = 0 ; i < MAX_INFOLINES ; i++)
{
if ((gfx_text[i].life == 0) && (index == -1))
if ((gfx_textSprites[i].life == 0) && (index == -1))
{
index = i;
}
@ -63,7 +63,7 @@ void setInfoLine(const char *in, int color)
}
gfx_createTextObject(index, in, -1, 0, color);
gfx_text[index].life = 240;
gfx_textSprites[index].life = 240;
}
/*
@ -73,15 +73,15 @@ Phoebe or Ursula's banter to interrupt an important message
*/
void setRadioMessage(signed char face, const char *in, int priority)
{
if ((gfx_text[TS_RADIO].life > 0) && (priority == 0))
if ((gfx_textSprites[TS_RADIO].life > 0) && (priority == 0))
return;
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
gfx_text[TS_RADIO].life = 240;
gfx_textSprites[TS_RADIO].life = 240;
SDL_Surface *faceShape = NULL;
if (face > -1)
faceShape = shape[face];
faceShape = gfx_sprites[face];
gfx_createMessageBox(faceShape, in, 1);
}

View File

@ -34,8 +34,8 @@ void initPlayer()
player.systemPower = player.maxShield;
player.face = 0;
player.image[0] = shipShape[0];
player.image[1] = shipShape[1];
player.image[0] = gfx_shipSprites[0];
player.image[1] = gfx_shipSprites[1];
player.engineX = player.image[0]->w;
player.engineY = (player.image[0]->h / 2);

View File

@ -41,8 +41,8 @@ void loadGameGraphics()
gfx_free();
shipShape[0] = gfx_loadImage("gfx/firefly1.png");
shipShape[1] = gfx_loadImage("gfx/firefly2.png");
gfx_shipSprites[0] = gfx_loadImage("gfx/firefly1.png");
gfx_shipSprites[1] = gfx_loadImage("gfx/firefly2.png");
switch(game.system)
{
@ -67,7 +67,7 @@ void loadGameGraphics()
while (fscanf(fp, "%d %s", &index, string) == 2)
{
shipShape[index] = gfx_loadImage(string);
gfx_shipSprites[index] = gfx_loadImage(string);
}
fclose(fp);
@ -75,54 +75,54 @@ void loadGameGraphics()
/*
Create images of ships being hit that show a lot of red
*/
for (int i = SHIP_HIT_INDEX ; i < MAX_SHIPSHAPES ; i++)
for (int i = SHIP_HIT_INDEX ; i < MAX_SHIPSPRITES ; i++)
{
if (shipShape[i - SHIP_HIT_INDEX] == NULL)
if (gfx_shipSprites[i - SHIP_HIT_INDEX] == NULL)
continue;
shipShape[i] = gfx_createSurface(shipShape[i - SHIP_HIT_INDEX]->w,
shipShape[i - SHIP_HIT_INDEX]->h);
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_NONE);
gfx_blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]);
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_BLEND);
gfx_shipSprites[i] = gfx_createSurface(gfx_shipSprites[i - SHIP_HIT_INDEX]->w,
gfx_shipSprites[i - SHIP_HIT_INDEX]->h);
SDL_SetSurfaceBlendMode(gfx_shipSprites[i - SHIP_HIT_INDEX], SDL_BLENDMODE_NONE);
gfx_blit(gfx_shipSprites[i - SHIP_HIT_INDEX], 0, 0, gfx_shipSprites[i]);
SDL_SetSurfaceBlendMode(gfx_shipSprites[i - SHIP_HIT_INDEX], SDL_BLENDMODE_BLEND);
switch (shipShape[i]->format->BitsPerPixel)
switch (gfx_shipSprites[i]->format->BitsPerPixel)
{
case 32:
SDL_LockSurface(shipShape[i]);
p32 = (Uint32 *)shipShape[i]->pixels;
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
SDL_LockSurface(gfx_shipSprites[i]);
p32 = (Uint32 *)gfx_shipSprites[i]->pixels;
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
{
if (p32[j])
p32[j] |= shipShape[i]->format->Rmask;
p32[j] |= gfx_shipSprites[i]->format->Rmask;
}
SDL_UnlockSurface(shipShape[i]);
SDL_UnlockSurface(gfx_shipSprites[i]);
break;
case 16:
SDL_LockSurface(shipShape[i]);
p16 = (Uint16 *)shipShape[i]->pixels;
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
SDL_LockSurface(gfx_shipSprites[i]);
p16 = (Uint16 *)gfx_shipSprites[i]->pixels;
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
{
if (p16[j])
p16[j] |= shipShape[i]->format->Rmask;
p16[j] |= gfx_shipSprites[i]->format->Rmask;
}
SDL_UnlockSurface(shipShape[i]);
SDL_UnlockSurface(gfx_shipSprites[i]);
break;
case 8:
SDL_LockSurface(shipShape[i]);
p8 = (Uint8 *)shipShape[i]->pixels;
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
SDL_LockSurface(gfx_shipSprites[i]);
p8 = (Uint8 *)gfx_shipSprites[i]->pixels;
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
{
if (p8[j])
p8[j] = SDL_MapRGB(shipShape[i]->format, 255, 0, 0);
p8[j] = SDL_MapRGB(gfx_shipSprites[i]->format, 255, 0, 0);
}
SDL_UnlockSurface(shipShape[i]);
SDL_UnlockSurface(gfx_shipSprites[i]);
break;
}
SDL_SetColorKey(shipShape[i], SDL_TRUE,
SDL_MapRGB(shipShape[i]->format, 0, 0, 0));
SDL_SetColorKey(gfx_shipSprites[i], SDL_TRUE,
SDL_MapRGB(gfx_shipSprites[i]->format, 0, 0, 0));
}
strcpy(string, "data/resources_all.dat");
@ -131,7 +131,7 @@ void loadGameGraphics()
while (fscanf(fp, "%d %s", &index, string) == 2)
{
shape[index] = gfx_loadImage(string);
gfx_sprites[index] = gfx_loadImage(string);
}
fclose(fp);
@ -140,10 +140,10 @@ void loadGameGraphics()
for (int i = 0 ; i < CD_MAX ; i++)
{
if (shipShape[alien_defs[i].imageIndex[0]] != NULL)
if (gfx_shipSprites[alien_defs[i].imageIndex[0]] != NULL)
{
alien_defs[i].image[0] = shipShape[alien_defs[i].imageIndex[0]];
alien_defs[i].image[1] = shipShape[alien_defs[i].imageIndex[1]];
alien_defs[i].image[0] = gfx_shipSprites[alien_defs[i].imageIndex[0]];
alien_defs[i].image[1] = gfx_shipSprites[alien_defs[i].imageIndex[1]];
alien_defs[i].engineX = alien_defs[i].image[0]->w;
alien_defs[i].engineY = (alien_defs[i].image[0]->h / 2);
}
@ -161,7 +161,7 @@ void loadFont()
{
SDL_Surface *image, *newImage;
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
{
image = IMG_Load("gfx/smallFont.png");
@ -191,7 +191,7 @@ void loadFont()
newImage = SDL_ConvertSurface(image, screen->format, 0);
fontShape[i] = gfx_setTransparent(newImage);
gfx_fontSprites[i] = gfx_setTransparent(newImage);
SDL_FreeSurface(image);
}

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011, 2012, 2013 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "structs.h"
SDL_Surface *screen;
bRect *screen_bufferHead;
bRect *screen_bufferTail;
void screen_blit(SDL_Surface *image, int x, int y)
{
@ -34,7 +36,7 @@ void screen_blit(SDL_Surface *image, int x, int y)
void screen_blitText(int i)
{
screen_blit(gfx_text[i].image, (int)gfx_text[i].x, (int)gfx_text[i].y);
screen_blit(gfx_textSprites[i].image, (int)gfx_textSprites[i].x, (int)gfx_textSprites[i].y);
}
int screen_renderString(const char *in, int x, int y, int fontColor)

View File

@ -25,8 +25,13 @@ static void setScene(int scene)
{
FILE *fp;
char string[255], face[255];
float sx, sy, x, y, speed;
int index, shape;
float sx;
float sy;
float x;
float y;
float speed;
int index;
int img;
sprintf(string, "data/cutscene%d.dat", scene);
@ -47,15 +52,15 @@ static void setScene(int scene)
engine.ssy = sy;
// Read in the specs for each ship
while (fscanf(fp, "%d %d %f %f %f", &index, &shape, &x, &y, &speed) == 5)
while (fscanf(fp, "%d %d %f %f %f", &index, &img, &x, &y, &speed) == 5)
{
if (x < 0) x = (rand() % abs((int)x));
if (y < 0) y = (rand() % abs((int)y));
if (speed <= -1) speed = 1 + (rand() % abs((int)speed));
if (shape > -1)
if (img > -1)
{
aliens[index].image[0] = shipShape[shape];
aliens[index].image[0] = gfx_shipSprites[img];
aliens[index].x = x;
aliens[index].y = y;
aliens[index].dx = speed;
@ -188,13 +193,13 @@ void doCutscene(int scene)
face = NULL;
if (cutMessage[currentMessage].face != -1)
face = shape[cutMessage[currentMessage].face];
face = gfx_sprites[cutMessage[currentMessage].face];
gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
}
}
if ((showMessage) && (messageBox != NULL))
screen_blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100);
if ((showMessage) && (gfx_messageBox != NULL))
screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100);
screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE);

View File

@ -28,7 +28,7 @@ static void drawSecondaryWeaponSurface()
{
char description[50] = "";
gfx_renderString("Secondary Weapon", 10, 3, FONT_WHITE, 0, shopSurface[2]);
gfx_renderString("Secondary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[2]);
switch (player.weaponType[1])
{
@ -60,13 +60,13 @@ static void drawSecondaryWeaponSurface()
strcpy(description, "Type : Mcr Homing Missiles");
break;
}
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[2]);
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[2]);
if ((player.weaponType[1] != W_LASER) &&
(player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_NONE))
{
sprintf(description, "Capacity : %d", game.maxRocketAmmo);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[2]);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[2]);
}
}
@ -144,25 +144,25 @@ static void drawShop()
{
adjustShopPrices();
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
{
if (shopSurface[i] != NULL)
if (gfx_shopSprites[i] != NULL)
{
SDL_FreeSurface(shopSurface[i]);
SDL_FreeSurface(gfx_shopSprites[i]);
}
}
for (int i = 0 ; i < 3 ; i++)
shopSurface[i] = gfx_createSurface(246, 91);
gfx_shopSprites[i] = gfx_createSurface(246, 91);
for (int i = 0 ; i < 3 ; i++)
{
gfx_drawRect(shopSurface[i], 0, 0, 245, 90, 0x00, 0x00, 0x55);
gfx_drawRect(shopSurface[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 90, 0x00, 0x00, 0x55);
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
}
shopSurface[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
gfx_drawRect(shopSurface[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
gfx_shopSprites[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
switch (shopSelectedItem)
{
@ -177,63 +177,63 @@ static void drawShop()
case 1:
case 2:
case 8:
gfx_drawRect(shopSurface[1], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(shopSurface[1], 0, 0, 245, 20, 0x99, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 20, 0x99, 0x00, 0x00);
break;
case 3:
case 4:
gfx_drawRect(shopSurface[4], 0, 0, 600, 100, 0x33, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x33, 0x00, 0x00);
break;
case 5:
case 6:
case 7:
gfx_drawRect(shopSurface[0], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(shopSurface[0], 0, 0, 245, 20, 0x99, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 20, 0x99, 0x00, 0x00);
break;
default:
gfx_drawRect(shopSurface[2], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(shopSurface[2], 0, 0, 245, 20, 0x99, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 90, 0x55, 0x00, 0x00);
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 20, 0x99, 0x00, 0x00);
break;
}
char description[100];
strcpy(description, "");
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, shopSurface[0]);
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[0]);
sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[0]);
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[0]);
sprintf(description, "Plasma Power : Stage %d",
game.minPlasmaDamage);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[0]);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[0]);
sprintf(description, "Cooler : Stage %d",
game.minPlasmaRate);
gfx_renderString(description, 10, 52, FONT_WHITE, 0, shopSurface[0]);
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[0]);
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, shopSurface[1]);
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[1]);
sprintf(description, "Plasma Output : Stage %d",
game.maxPlasmaOutput);
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[1]);
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[1]);
sprintf(description, "Plasma Condensor : Stage %d",
game.maxPlasmaDamage);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[1]);
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[1]);
sprintf(description, "Liquid Nitrogen : Stage %d",
game.maxPlasmaRate);
gfx_renderString(description, 10, 52, FONT_WHITE, 0, shopSurface[1]);
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[1]);
sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
gfx_renderString(description, 10, 67, FONT_WHITE, 0, shopSurface[1]);
gfx_renderString(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[1]);
drawSecondaryWeaponSurface();
shopSurface[3] = gfx_createSurface(601, 121);
gfx_shopSprites[3] = gfx_createSurface(601, 121);
gfx_drawRect(shopSurface[3], 0, 0, 600, 120, 0x00, 0x00, 0x22);
gfx_drawRect(gfx_shopSprites[3], 0, 0, 600, 120, 0x00, 0x00, 0x22);
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, shopSurface[3]);
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, shopSurface[3]);
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, shopSurface[3]);
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, shopSurface[3]);
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
signed char icons = MAX_SHOPITEMS;
@ -246,23 +246,23 @@ static void drawShop()
for (int i = 0 ; i < icons ; i++)
{
gfx_blit(shape[shopItems[i].image], shopItems[i].x - 90,
shopItems[i].y - 178, shopSurface[3]);
gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x - 90,
shopItems[i].y - 178, gfx_shopSprites[3]);
}
sprintf(description, "Shield Units : %d", player.maxShield);
gfx_renderString(description, 10, 4, FONT_WHITE, 0, shopSurface[4]);
gfx_renderString(description, 10, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
sprintf(description, "Cash : $%d", game.cash);
gfx_renderString(description, 10, 80, FONT_WHITE, 0, shopSurface[4]);
gfx_renderString(description, 10, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
gfx_renderString(description, 430, 4, FONT_WHITE, 0, shopSurface[4]);
gfx_renderString(description, 430, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
sprintf(description, "Rockets : %.3d", player.ammo[1]);
gfx_renderString(description, 475, 80, FONT_WHITE, 0, shopSurface[4]);
gfx_renderString(description, 475, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
shopSurface[5] = gfx_createSurface(601, 56);
gfx_drawRect(shopSurface[5], 0, 0, 600, 35, 0x00, 0x99, 0x00);
gfx_drawRect(shopSurface[5], 0, 20, 600, 35, 0x00, 0x33, 0x00);
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, shopSurface[5]);
gfx_shopSprites[5] = gfx_createSurface(601, 56);
gfx_drawRect(gfx_shopSprites[5], 0, 0, 600, 35, 0x00, 0x99, 0x00);
gfx_drawRect(gfx_shopSprites[5], 0, 20, 600, 35, 0x00, 0x33, 0x00);
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, gfx_shopSprites[5]);
switch (shopSelectedItem)
{
@ -270,37 +270,37 @@ static void drawShop()
break;
case -2:
gfx_renderString("You don't have enough money", 20, 30, FONT_WHITE,
0, shopSurface[5]);
0, gfx_shopSprites[5]);
break;
case -3:
gfx_renderString("Cannot upgrade ship", 5, 22, FONT_WHITE, 0,
shopSurface[5]);
gfx_shopSprites[5]);
gfx_renderString("Hardware capacity has been reached", 20, 38,
FONT_CYAN, 0, shopSurface[5]);
FONT_CYAN, 0, gfx_shopSprites[5]);
break;
case -4:
gfx_renderString("Ammunition limit reached", 20, 30, FONT_WHITE, 0,
shopSurface[5]);
gfx_shopSprites[5]);
break;
case -5:
gfx_renderString("You cannot sell that item", 20, 30, FONT_WHITE,
0, shopSurface[5]);
0, gfx_shopSprites[5]);
break;
case -6:
gfx_renderString("Nothing to sell", 20, 30, FONT_WHITE, 0,
shopSurface[5]);
gfx_shopSprites[5]);
break;
case -7:
gfx_renderString("Rockets cannot be bought for Laser or Charger Cannon",
5, 30, FONT_WHITE, 0, shopSurface[5]);
5, 30, FONT_WHITE, 0, gfx_shopSprites[5]);
break;
case -8:
gfx_renderString("You already have that weapon", 20, 30,
FONT_WHITE, 0, shopSurface[5]);
FONT_WHITE, 0, gfx_shopSprites[5]);
break;
case -9:
gfx_renderString("This weapon's ammo limit has been reached", 20,
30, FONT_WHITE, 0, shopSurface[5]);
30, FONT_WHITE, 0, gfx_shopSprites[5]);
break;
default:
if (shopItems[shopSelectedItem].price != 0)
@ -315,8 +315,8 @@ static void drawShop()
shopItems[shopSelectedItem].description);
}
gfx_renderString(shopItems[shopSelectedItem].name, 5, 22,
FONT_WHITE, 0, shopSurface[5]);
gfx_renderString(description, 20, 38, FONT_CYAN, 0, shopSurface[5]);
FONT_WHITE, 0, gfx_shopSprites[5]);
gfx_renderString(description, 20, 38, FONT_CYAN, 0, gfx_shopSprites[5]);
break;
}
}
@ -485,7 +485,7 @@ void initShop()
shopSelectedItem = -1;
player.image[0] = shape[0];
player.image[0] = gfx_sprites[0];
player.x = 380;
player.y = 95;
@ -1018,20 +1018,20 @@ static void sell(int i)
void showShop()
{
screen_blit(shopSurface[0], 20, 395);
screen_blit(shopSurface[1], 275, 395);
screen_blit(shopSurface[2], 530, 395);
screen_blit(shopSurface[3], 100, 180);
screen_blit(shopSurface[4], 100, 50);
screen_blit(shopSurface[5], 100, 320);
screen_blit(gfx_shopSprites[0], 20, 395);
screen_blit(gfx_shopSprites[1], 275, 395);
screen_blit(gfx_shopSprites[2], 530, 395);
screen_blit(gfx_shopSprites[3], 100, 180);
screen_blit(gfx_shopSprites[4], 100, 50);
screen_blit(gfx_shopSprites[5], 100, 320);
if (shopSelectedItem > -1)
{
screen_blit(shape[27], 60, 350);
screen_blit(shape[28], 710, 350);
screen_blit(gfx_sprites[27], 60, 350);
screen_blit(gfx_sprites[28], 710, 350);
}
screen_blit(shape[29], (int)player.x, (int)player.y);
screen_blit(gfx_sprites[29], (int)player.x, (int)player.y);
signed char icons = MAX_SHOPITEMS;

View File

@ -30,12 +30,12 @@ static signed char showGameMenu(signed char continueSaveSlot)
screen_blitText(TS_OPTIONS);
if (engine.cheat)
{
gfx_text[TS_QUIT].y = screen->h / 3 + 150;
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 150;
screen_blitText(TS_CHEAT_OPTIONS);
}
else
{
gfx_text[TS_QUIT].y = screen->h / 3 + 130;
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 130;
}
screen_blitText(TS_QUIT);
@ -52,10 +52,10 @@ static signed char showLoadMenu()
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
{
rtn++;
if (gfx_text[i].image != NULL)
if (gfx_textSprites[i].image != NULL)
{
screen_blitText(i);
gfx_text[TS_BACK_TO_MAIN_MENU].y = gfx_text[i].y + 40;
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = gfx_textSprites[i].y + 40;
}
}
screen_blitText(TS_BACK_TO_MAIN_MENU);
@ -87,7 +87,7 @@ static void createDifficultyMenu()
static signed char showDifficultyMenu()
{
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
screen_blitText(TS_START_GAME);
screen_blitText(TS_DIFFICULTY);
@ -129,7 +129,7 @@ static void createOptionsMenu()
static signed char showOptionsMenu()
{
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
screen_blitText(TS_SOUND);
screen_blitText(TS_MUSIC);
@ -173,7 +173,7 @@ static void createCheatMenu()
static signed char showCheatMenu()
{
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
screen_blitText(TS_UNLIMITED_SHIELD);
screen_blitText(TS_UNLIMITED_AMMO);
@ -635,11 +635,11 @@ void showStory()
// XXX: The fact that it's line 8 that's watched is completely
// arbitrary. It might be prudent to replace this with something else.
if (gfx_text[8].y > (screen->h / 2) + 150)
if (gfx_textSprites[8].y > (screen->h / 2) + 150)
{
for (int i = 0 ; i < 9 ; i++)
{
gfx_text[i].y -= 0.33333;
gfx_textSprites[i].y -= 0.33333;
screen_blitText(i);
}
}

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011, 2013 Guus Sliepen
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -25,8 +25,8 @@ void setWeaponShapes()
{
for (int i = 0 ; i < MAX_WEAPONS ; i++)
{
weapon[i].image[0] = shape[weapon[i].imageIndex[0]];
weapon[i].image[1] = shape[weapon[i].imageIndex[1]];
weapon[i].image[0] = gfx_sprites[weapon[i].imageIndex[0]];
weapon[i].image[1] = gfx_sprites[weapon[i].imageIndex[1]];
}
}