Some more cleanup.
This commit is contained in:
parent
c68cb3f920
commit
134a52e5f0
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
||||||
CXXFLAGS ?= -O2 -Wall -g
|
CXXFLAGS ?= -O2 -Wall -g
|
||||||
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
|
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
|
||||||
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
|
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
|
||||||
OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o explosion.o game.o gfx.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o
|
OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o explosion.o game.o gfx.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o window.o
|
||||||
|
|
||||||
VERSION = 1.4.1-dev
|
VERSION = 1.4.1-dev
|
||||||
PROG = starfighter
|
PROG = starfighter
|
||||||
|
|
|
@ -59,5 +59,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "shop.h"
|
#include "shop.h"
|
||||||
#include "title.h"
|
#include "title.h"
|
||||||
#include "weapons.h"
|
#include "weapons.h"
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
50
src/game.cpp
50
src/game.cpp
|
@ -1615,7 +1615,7 @@ static void game_doArrow(int i)
|
||||||
if (i != engine.targetIndex)
|
if (i != engine.targetIndex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (textShape[3].life > 0)
|
if (gfx_text[3].life > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sxy == sx) {
|
if (sxy == sx) {
|
||||||
|
@ -1647,24 +1647,24 @@ static void game_doHud()
|
||||||
fontColor = FONT_YELLOW;
|
fontColor = FONT_YELLOW;
|
||||||
else
|
else
|
||||||
fontColor = FONT_WHITE;
|
fontColor = FONT_WHITE;
|
||||||
blitText(10); // time remaining
|
screen_blitText(10); // time remaining
|
||||||
sprintf(text, "%.2d:%.2d", engine.minutes, engine.seconds);
|
sprintf(text, "%.2d:%.2d", engine.minutes, engine.seconds);
|
||||||
textSurface(30, text, 410, 21, fontColor);
|
textSurface(30, text, 410, 21, fontColor);
|
||||||
blitText(30);
|
screen_blitText(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.area != MISN_INTERCEPTION)
|
if (game.area != MISN_INTERCEPTION)
|
||||||
{
|
{
|
||||||
blitText(9); // mission objectives
|
screen_blitText(9); // mission objectives
|
||||||
sprintf(text, "%d", (currentMission.remainingObjectives1 + currentMission.remainingObjectives2));
|
sprintf(text, "%d", (currentMission.remainingObjectives1 + currentMission.remainingObjectives2));
|
||||||
textSurface(39, text, 745, 21, FONT_WHITE);
|
textSurface(39, text, 745, 21, FONT_WHITE);
|
||||||
blitText(39);
|
screen_blitText(39);
|
||||||
}
|
}
|
||||||
|
|
||||||
blitText(8); // cash
|
screen_blitText(8); // cash
|
||||||
sprintf(text, "%.6d", game.cash);
|
sprintf(text, "%.6d", game.cash);
|
||||||
textSurface(38, text, 90, 21, FONT_WHITE);
|
textSurface(38, text, 90, 21, FONT_WHITE);
|
||||||
blitText(38);
|
screen_blitText(38);
|
||||||
|
|
||||||
for (int i = 0; i < ALIEN_MAX; i++)
|
for (int i = 0; i < ALIEN_MAX; i++)
|
||||||
game_doArrow(i);
|
game_doArrow(i);
|
||||||
|
@ -1675,12 +1675,12 @@ static void game_doHud()
|
||||||
if (player.ammo[0] <= 25) fontColor = FONT_YELLOW;
|
if (player.ammo[0] <= 25) fontColor = FONT_YELLOW;
|
||||||
if (player.ammo[0] <= 10) fontColor = FONT_RED;
|
if (player.ammo[0] <= 10) fontColor = FONT_RED;
|
||||||
}
|
}
|
||||||
blitText(5); // plasma ammo
|
screen_blitText(5); // plasma ammo
|
||||||
sprintf(text, "%.3d", player.ammo[0]);
|
sprintf(text, "%.3d", player.ammo[0]);
|
||||||
textSurface(35, text, 320, 551, fontColor);
|
textSurface(35, text, 320, 551, fontColor);
|
||||||
blitText(35);
|
screen_blitText(35);
|
||||||
|
|
||||||
blitText(6);
|
screen_blitText(6);
|
||||||
|
|
||||||
if ((player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_LASER))
|
if ((player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_LASER))
|
||||||
{
|
{
|
||||||
|
@ -1690,7 +1690,7 @@ static void game_doHud()
|
||||||
fontColor = FONT_WHITE;
|
fontColor = FONT_WHITE;
|
||||||
sprintf(text, "%.3d", player.ammo[1]); // rocket ammo
|
sprintf(text, "%.3d", player.ammo[1]); // rocket ammo
|
||||||
textSurface(36, text, 465, 551, fontColor);
|
textSurface(36, text, 465, 551, fontColor);
|
||||||
blitText(36);
|
screen_blitText(36);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((player.weaponType[1] == W_CHARGER) || (player.weaponType[1] == W_LASER)) && (player.ammo[1] > 0))
|
if (((player.weaponType[1] == W_CHARGER) || (player.weaponType[1] == W_LASER)) && (player.ammo[1] > 0))
|
||||||
|
@ -1767,26 +1767,26 @@ static void game_doHud()
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if (textShape[i].life > 0)
|
if (gfx_text[i].life > 0)
|
||||||
{
|
{
|
||||||
textShape[i].y = (525 - (i * 20));
|
gfx_text[i].y = (525 - (i * 20));
|
||||||
blitText(i);
|
screen_blitText(i);
|
||||||
textShape[i].life--;
|
gfx_text[i].life--;
|
||||||
|
|
||||||
if (textShape[i].life == 0)
|
if (gfx_text[i].life == 0)
|
||||||
{
|
{
|
||||||
copyInfoLine(i + 1, i);
|
copyInfoLine(i + 1, i);
|
||||||
copyInfoLine(i + 2, i + 1);
|
copyInfoLine(i + 2, i + 1);
|
||||||
textShape[2].life = 0;
|
gfx_text[2].life = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the radio message if there is one
|
// Show the radio message if there is one
|
||||||
if (textShape[3].life > 0)
|
if (gfx_text[3].life > 0)
|
||||||
{
|
{
|
||||||
screen_blit(messageBox, (800 - messageBox->w) / 2, 50);
|
screen_blit(messageBox, (800 - messageBox->w) / 2, 50);
|
||||||
textShape[3].life--;
|
gfx_text[3].life--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the target's remaining shield (if required)
|
// Do the target's remaining shield (if required)
|
||||||
|
@ -1794,7 +1794,7 @@ static void game_doHud()
|
||||||
{
|
{
|
||||||
if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0) && (engine.targetIndex > 9))
|
if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0) && (engine.targetIndex > 9))
|
||||||
{
|
{
|
||||||
blitText(7);
|
screen_blitText(7);
|
||||||
bar.w = 1;
|
bar.w = 1;
|
||||||
bar.h = 12;
|
bar.h = 12;
|
||||||
bar.x = 620;
|
bar.x = 620;
|
||||||
|
@ -1814,7 +1814,7 @@ static void game_doHud()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blitText(11);
|
screen_blitText(11);
|
||||||
|
|
||||||
bar.w = 25;
|
bar.w = 25;
|
||||||
bar.h = 12;
|
bar.h = 12;
|
||||||
|
@ -1833,7 +1833,7 @@ static void game_doHud()
|
||||||
bar.x += 30;
|
bar.x += 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
blitText(12);
|
screen_blitText(12);
|
||||||
|
|
||||||
bar.w = 25;
|
bar.w = 25;
|
||||||
bar.h = 12;
|
bar.h = 12;
|
||||||
|
@ -1854,7 +1854,7 @@ static void game_doHud()
|
||||||
bar.x += 30;
|
bar.x += 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
blitText(13);
|
screen_blitText(13);
|
||||||
|
|
||||||
bar.w = 25;
|
bar.w = 25;
|
||||||
bar.h = 12;
|
bar.h = 12;
|
||||||
|
@ -1874,7 +1874,7 @@ static void game_doHud()
|
||||||
bar.x += 30;
|
bar.x += 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
blitText(4);
|
screen_blitText(4);
|
||||||
if (player.shield < 1)
|
if (player.shield < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2227,7 +2227,7 @@ int game_mainLoop()
|
||||||
if (engine.paused)
|
if (engine.paused)
|
||||||
{
|
{
|
||||||
textSurface(22, "PAUSED", -1, screen->h / 2, FONT_WHITE);
|
textSurface(22, "PAUSED", -1, screen->h / 2, FONT_WHITE);
|
||||||
blitText(22);
|
screen_blitText(22);
|
||||||
updateScreen();
|
updateScreen();
|
||||||
audio_pauseMusic();
|
audio_pauseMusic();
|
||||||
|
|
||||||
|
|
44
src/gfx.cpp
44
src/gfx.cpp
|
@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
static unsigned long frameLimit;
|
static unsigned long frameLimit;
|
||||||
static int thirds;
|
static int thirds;
|
||||||
|
|
||||||
SDL_Window *window;
|
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
SDL_Texture *texture;
|
SDL_Texture *texture;
|
||||||
SDL_Surface *background;
|
SDL_Surface *background;
|
||||||
|
@ -34,7 +33,7 @@ SDL_Surface *fontShape[MAX_FONTSHAPES];
|
||||||
SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
||||||
bRect *bufferHead;
|
bRect *bufferHead;
|
||||||
bRect *bufferTail;
|
bRect *bufferTail;
|
||||||
textObject textShape[MAX_TEXTSHAPES];
|
textObject gfx_text[MAX_TEXTSHAPES];
|
||||||
SDL_Surface *messageBox;
|
SDL_Surface *messageBox;
|
||||||
|
|
||||||
void gfx_init()
|
void gfx_init()
|
||||||
|
@ -50,7 +49,7 @@ void gfx_init()
|
||||||
shipShape[i] = NULL;
|
shipShape[i] = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
||||||
textShape[i].image = NULL;
|
gfx_text[i].image = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
|
||||||
shopSurface[i] = NULL;
|
shopSurface[i] = NULL;
|
||||||
|
@ -112,11 +111,6 @@ void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||||
gfx_addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
gfx_addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blitText(int i)
|
|
||||||
{
|
|
||||||
screen_blit(textShape[i].image, (int)textShape[i].x, (int)textShape[i].y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void flushBuffer()
|
void flushBuffer()
|
||||||
{
|
{
|
||||||
bRect *prevRect = bufferHead;
|
bRect *prevRect = bufferHead;
|
||||||
|
@ -497,25 +491,25 @@ SDL_Surface *textSurface(const char *inString, int color)
|
||||||
void textSurface(int index, const char *inString, int x, int y, int fontColor)
|
void textSurface(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. */
|
/* Shortcut: if we already rendered the same string in the same color, don't render it again. */
|
||||||
if(textShape[index].text && textShape[index].image && textShape[index].fontColor == fontColor && !strcmp(textShape[index].text, inString)) {
|
if(gfx_text[index].text && gfx_text[index].image && gfx_text[index].fontColor == fontColor && !strcmp(gfx_text[index].text, inString)) {
|
||||||
textShape[index].x = x;
|
gfx_text[index].x = x;
|
||||||
textShape[index].y = y;
|
gfx_text[index].y = y;
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
textShape[index].x = (800 - textShape[index].image->w) / 2;
|
gfx_text[index].x = (800 - gfx_text[index].image->w) / 2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(textShape[index].text, inString);
|
strcpy(gfx_text[index].text, inString);
|
||||||
textShape[index].x = x;
|
gfx_text[index].x = x;
|
||||||
textShape[index].y = y;
|
gfx_text[index].y = y;
|
||||||
textShape[index].fontColor = fontColor;
|
gfx_text[index].fontColor = fontColor;
|
||||||
if (textShape[index].image != NULL)
|
if (gfx_text[index].image != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(textShape[index].image);
|
SDL_FreeSurface(gfx_text[index].image);
|
||||||
}
|
}
|
||||||
textShape[index].image = textSurface(inString, fontColor);
|
gfx_text[index].image = textSurface(inString, fontColor);
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
textShape[index].x = (800 - textShape[index].image->w) / 2;
|
gfx_text[index].x = (800 - gfx_text[index].image->w) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
||||||
|
@ -580,10 +574,10 @@ void freeGraphics()
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
||||||
{
|
{
|
||||||
if (textShape[i].image != NULL)
|
if (gfx_text[i].image != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(textShape[i].image);
|
SDL_FreeSurface(gfx_text[i].image);
|
||||||
textShape[i].image = NULL;
|
gfx_text[i].image = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +612,9 @@ SDL_Surface *loadImage(const char *filename)
|
||||||
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
||||||
if ( newImage ) {
|
if ( newImage ) {
|
||||||
SDL_FreeSurface(image);
|
SDL_FreeSurface(image);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// This happens when we are loading the window icon image
|
// This happens when we are loading the window icon image
|
||||||
newImage = image;
|
newImage = image;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
extern SDL_Window *window;
|
|
||||||
extern SDL_Renderer *renderer;
|
extern SDL_Renderer *renderer;
|
||||||
extern SDL_Texture *texture;
|
extern SDL_Texture *texture;
|
||||||
extern SDL_Surface *background;
|
extern SDL_Surface *background;
|
||||||
|
@ -32,7 +31,7 @@ extern SDL_Surface *fontShape[MAX_FONTSHAPES];
|
||||||
extern SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
extern SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
||||||
extern bRect *bufferHead;
|
extern bRect *bufferHead;
|
||||||
extern bRect *bufferTail;
|
extern bRect *bufferTail;
|
||||||
extern textObject textShape[MAX_TEXTSHAPES];
|
extern textObject gfx_text[MAX_TEXTSHAPES];
|
||||||
extern SDL_Surface *messageBox;
|
extern SDL_Surface *messageBox;
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +39,6 @@ void gfx_init();
|
||||||
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
||||||
void gfx_addBuffer(int x, int y, int w, int h);
|
void gfx_addBuffer(int x, int y, int w, int h);
|
||||||
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
|
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
|
||||||
extern void blitText(int i);
|
|
||||||
extern void flushBuffer();
|
extern void flushBuffer();
|
||||||
extern void unBuffer();
|
extern void unBuffer();
|
||||||
extern int drawString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest);
|
extern int drawString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest);
|
||||||
|
|
|
@ -146,20 +146,20 @@ static void intermission_setStatusLines()
|
||||||
textSurface(26, string, -1, 0, FONT_WHITE);
|
textSurface(26, string, -1, 0, FONT_WHITE);
|
||||||
textSurface(27, "Current Status", -1, 0, FONT_WHITE);
|
textSurface(27, "Current Status", -1, 0, FONT_WHITE);
|
||||||
|
|
||||||
textShape[0].y = 400;
|
gfx_text[0].y = 400;
|
||||||
textShape[0].x = 150;
|
gfx_text[0].x = 150;
|
||||||
|
|
||||||
for (int i = 1 ; i < 25 ; i++)
|
for (int i = 1 ; i < 25 ; i++)
|
||||||
{
|
{
|
||||||
textShape[i].y = textShape[i - 1].y + 20;
|
gfx_text[i].y = gfx_text[i - 1].y + 20;
|
||||||
if ((i == 7) || (i == 16) || (i == 19))
|
if ((i == 7) || (i == 16) || (i == 19))
|
||||||
textShape[i].y += 25;
|
gfx_text[i].y += 25;
|
||||||
|
|
||||||
textShape[i].x = 150;
|
gfx_text[i].x = 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
textShape[26].y = 404;
|
gfx_text[26].y = 404;
|
||||||
textShape[27].y = 83;
|
gfx_text[27].y = 83;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -320,20 +320,20 @@ static void intermission_showStatus(SDL_Surface *infoSurface)
|
||||||
|
|
||||||
for (int i = 0 ; i < 22 ; i++)
|
for (int i = 0 ; i < 22 ; i++)
|
||||||
{
|
{
|
||||||
textShape[i].y -= speed;
|
gfx_text[i].y -= speed;
|
||||||
if ((textShape[i].y > 80) && (textShape[i].y < 400))
|
if ((gfx_text[i].y > 80) && (gfx_text[i].y < 400))
|
||||||
blitText(i);
|
screen_blitText(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textShape[21].y < 65)
|
if (gfx_text[21].y < 65)
|
||||||
{
|
{
|
||||||
textShape[0].y = 400;
|
gfx_text[0].y = 400;
|
||||||
|
|
||||||
for (int i = 1 ; i < 25 ; i++)
|
for (int i = 1 ; i < 25 ; i++)
|
||||||
{
|
{
|
||||||
textShape[i].y = textShape[i - 1].y + 20;
|
gfx_text[i].y = gfx_text[i - 1].y + 20;
|
||||||
if ((i == 7) || (i == 16) || (i == 19))
|
if ((i == 7) || (i == 16) || (i == 19))
|
||||||
textShape[i].y += 25;
|
gfx_text[i].y += 25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,8 +341,8 @@ static void intermission_showStatus(SDL_Surface *infoSurface)
|
||||||
|
|
||||||
blevelRect(100, 400, 600, 20, 0x00, 0x00, 0x99);
|
blevelRect(100, 400, 600, 20, 0x00, 0x00, 0x99);
|
||||||
|
|
||||||
blitText(26);
|
screen_blitText(26);
|
||||||
blitText(27);
|
screen_blitText(27);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void intermission_updateCommsSurface(SDL_Surface *comms)
|
static void intermission_updateCommsSurface(SDL_Surface *comms)
|
||||||
|
|
14
src/misc.cpp
14
src/misc.cpp
|
@ -23,15 +23,15 @@ void clearInfoLines()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 4 ; i++)
|
for (int i = 0 ; i < 4 ; i++)
|
||||||
{
|
{
|
||||||
textShape[i].life = 0;
|
gfx_text[i].life = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// from a to b
|
// from a to b
|
||||||
void copyInfoLine(int a, int b)
|
void copyInfoLine(int a, int b)
|
||||||
{
|
{
|
||||||
textSurface(b, textShape[a].text, -1, 0, textShape[a].fontColor);
|
textSurface(b, gfx_text[a].text, -1, 0, gfx_text[a].fontColor);
|
||||||
textShape[b].life = textShape[a].life;
|
gfx_text[b].life = gfx_text[a].life;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,7 +46,7 @@ void setInfoLine(const char *in, int color)
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if ((textShape[i].life == 0) && (index == -1))
|
if ((gfx_text[i].life == 0) && (index == -1))
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ void setInfoLine(const char *in, int color)
|
||||||
}
|
}
|
||||||
|
|
||||||
textSurface(index, in, -1, 0, color);
|
textSurface(index, in, -1, 0, color);
|
||||||
textShape[index].life = 240;
|
gfx_text[index].life = 240;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -71,11 +71,11 @@ Phoebe or Ursula's banter to interrupt an important message
|
||||||
*/
|
*/
|
||||||
void setRadioMessage(signed char face, const char *in, int priority)
|
void setRadioMessage(signed char face, const char *in, int priority)
|
||||||
{
|
{
|
||||||
if ((textShape[3].life > 0) && (priority == 0))
|
if ((gfx_text[3].life > 0) && (priority == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
textSurface(3, in, -1, 50, FONT_WHITE);
|
textSurface(3, in, -1, 50, FONT_WHITE);
|
||||||
textShape[3].life = 240;
|
gfx_text[3].life = 240;
|
||||||
|
|
||||||
SDL_Surface *faceShape = NULL;
|
SDL_Surface *faceShape = NULL;
|
||||||
if (face > -1)
|
if (face > -1)
|
||||||
|
|
|
@ -27,3 +27,8 @@ void screen_blit(SDL_Surface *image, int x, int y)
|
||||||
{
|
{
|
||||||
gfx_blit(image, x, y, screen);
|
gfx_blit(image, x, y, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void screen_blitText(int i)
|
||||||
|
{
|
||||||
|
screen_blit(gfx_text[i].image, (int)gfx_text[i].x, (int)gfx_text[i].y);
|
||||||
|
}
|
||||||
|
|
|
@ -23,5 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern SDL_Surface *screen;
|
extern SDL_Surface *screen;
|
||||||
|
|
||||||
void screen_blit(SDL_Surface *image, int x, int y);
|
void screen_blit(SDL_Surface *image, int x, int y);
|
||||||
|
void screen_blitText(int i);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,23 +21,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
static signed char showGameMenu(signed char continueSaveSlot)
|
static signed char showGameMenu(signed char continueSaveSlot)
|
||||||
{
|
{
|
||||||
blitText(TS_START_NEW_GAME);
|
screen_blitText(TS_START_NEW_GAME);
|
||||||
if (continueSaveSlot != -1)
|
if (continueSaveSlot != -1)
|
||||||
{
|
{
|
||||||
blitText(TS_LOAD_GAME);
|
screen_blitText(TS_LOAD_GAME);
|
||||||
blitText(TS_CONTINUE_CURRENT_GAME);
|
screen_blitText(TS_CONTINUE_CURRENT_GAME);
|
||||||
}
|
}
|
||||||
blitText(TS_OPTIONS);
|
screen_blitText(TS_OPTIONS);
|
||||||
if (engine.cheat)
|
if (engine.cheat)
|
||||||
{
|
{
|
||||||
textShape[TS_QUIT].y = 450;
|
gfx_text[TS_QUIT].y = 450;
|
||||||
blitText(TS_CHEAT_OPTIONS);
|
screen_blitText(TS_CHEAT_OPTIONS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textShape[TS_QUIT].y = 430;
|
gfx_text[TS_QUIT].y = 430;
|
||||||
}
|
}
|
||||||
blitText(TS_QUIT);
|
screen_blitText(TS_QUIT);
|
||||||
|
|
||||||
if (engine.cheat)
|
if (engine.cheat)
|
||||||
return 6;
|
return 6;
|
||||||
|
@ -52,13 +52,13 @@ static signed char showLoadMenu()
|
||||||
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
||||||
{
|
{
|
||||||
rtn++;
|
rtn++;
|
||||||
if (textShape[i].image != NULL)
|
if (gfx_text[i].image != NULL)
|
||||||
{
|
{
|
||||||
blitText(i);
|
screen_blitText(i);
|
||||||
textShape[TS_BACK_TO_MAIN_MENU].y = textShape[i].y + 40;
|
gfx_text[TS_BACK_TO_MAIN_MENU].y = gfx_text[i].y + 40;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blitText(TS_BACK_TO_MAIN_MENU);
|
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
||||||
|
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
@ -81,11 +81,11 @@ static void createDifficultyMenu()
|
||||||
|
|
||||||
static signed char showDifficultyMenu()
|
static signed char showDifficultyMenu()
|
||||||
{
|
{
|
||||||
textShape[TS_BACK_TO_MAIN_MENU].y = 410;
|
gfx_text[TS_BACK_TO_MAIN_MENU].y = 410;
|
||||||
|
|
||||||
blitText(TS_START_GAME);
|
screen_blitText(TS_START_GAME);
|
||||||
blitText(TS_DIFFICULTY);
|
screen_blitText(TS_DIFFICULTY);
|
||||||
blitText(TS_BACK_TO_MAIN_MENU);
|
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
@ -115,13 +115,13 @@ static void createOptionsMenu()
|
||||||
|
|
||||||
static signed char showOptionsMenu()
|
static signed char showOptionsMenu()
|
||||||
{
|
{
|
||||||
textShape[TS_BACK_TO_MAIN_MENU].y = 450;
|
gfx_text[TS_BACK_TO_MAIN_MENU].y = 450;
|
||||||
|
|
||||||
blitText(TS_SOUND);
|
screen_blitText(TS_SOUND);
|
||||||
blitText(TS_MUSIC);
|
screen_blitText(TS_MUSIC);
|
||||||
blitText(TS_FULLSCREEN);
|
screen_blitText(TS_FULLSCREEN);
|
||||||
blitText(TS_AUTOPAUSE);
|
screen_blitText(TS_AUTOPAUSE);
|
||||||
blitText(TS_BACK_TO_MAIN_MENU);
|
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
@ -159,13 +159,13 @@ static void createCheatMenu()
|
||||||
|
|
||||||
static signed char showCheatMenu()
|
static signed char showCheatMenu()
|
||||||
{
|
{
|
||||||
textShape[TS_BACK_TO_MAIN_MENU].y = 450;
|
gfx_text[TS_BACK_TO_MAIN_MENU].y = 450;
|
||||||
|
|
||||||
blitText(TS_UNLIMITED_SHIELD);
|
screen_blitText(TS_UNLIMITED_SHIELD);
|
||||||
blitText(TS_UNLIMITED_AMMO);
|
screen_blitText(TS_UNLIMITED_AMMO);
|
||||||
blitText(TS_UNLIMITED_CASH);
|
screen_blitText(TS_UNLIMITED_CASH);
|
||||||
blitText(TS_UNLIMITED_TIME);
|
screen_blitText(TS_UNLIMITED_TIME);
|
||||||
blitText(TS_BACK_TO_MAIN_MENU);
|
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
@ -303,11 +303,11 @@ int doTitle()
|
||||||
}
|
}
|
||||||
else if ((now - then > 9000) && (now - then < 15000) && (!skip))
|
else if ((now - then > 9000) && (now - then < 15000) && (!skip))
|
||||||
{
|
{
|
||||||
blitText(TS_PRESENTS);
|
screen_blitText(TS_PRESENTS);
|
||||||
}
|
}
|
||||||
else if ((now - then > 16000) && (now - then < 21000) && (!skip))
|
else if ((now - then > 16000) && (now - then < 21000) && (!skip))
|
||||||
{
|
{
|
||||||
blitText(TS_AN_SDL_GAME);
|
screen_blitText(TS_AN_SDL_GAME);
|
||||||
}
|
}
|
||||||
else if ((now - then > 25500) || (skip))
|
else if ((now - then > 25500) || (skip))
|
||||||
{
|
{
|
||||||
|
@ -602,12 +602,12 @@ void showStory()
|
||||||
if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE]))
|
if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (textShape[8].y > (screen->h / 2) + 150)
|
if (gfx_text[8].y > (screen->h / 2) + 150)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 9 ; i++)
|
for (int i = 0 ; i < 9 ; i++)
|
||||||
{
|
{
|
||||||
textShape[i].y -= 0.33333;
|
gfx_text[i].y -= 0.33333;
|
||||||
blitText(i);
|
screen_blitText(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2003 Parallel Realities
|
||||||
|
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||||
|
Copyright (C) 2015 Julian Marchant
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 3
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
SDL_Window *window;
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2003 Parallel Realities
|
||||||
|
Copyright (C) 2011 Guus Sliepen
|
||||||
|
Copyright (C) 2015 Julian Marchant
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 3
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WINDOW_H
|
||||||
|
#define WINDOW_H
|
||||||
|
|
||||||
|
extern SDL_Window *window;
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue