More cleanup.

This commit is contained in:
onpon4 2015-11-06 19:43:34 -05:00
parent 4bdf871e66
commit 7694d668ff
10 changed files with 37 additions and 37 deletions

View File

@ -2110,7 +2110,7 @@ int game_mainLoop()
}
}
drawBackGround();
screen_drawBackground();
screen_flushBuffer();
// Default to no aliens dead...

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static unsigned long frameLimit;
static int thirds;
SDL_Surface *background;
SDL_Surface *gfx_background;
SDL_Surface *shape[MAX_SHAPES];
SDL_Surface *shipShape[MAX_SHIPSHAPES];
SDL_Surface *fontShape[MAX_FONTSHAPES];
@ -55,7 +55,7 @@ void gfx_init()
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
fontShape[i] = NULL;
background = NULL;
gfx_background = NULL;
messageBox = NULL;
frameLimit = 0;
@ -186,14 +186,6 @@ int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, SDL_
return gfx_renderStringBase(in, x, y, fontColor, wrap, dest);
}
/*
Draws the background surface that has been loaded
*/
void drawBackGround()
{
screen_blit(background, 0, 0);
}
void clearScreen(Uint32 color)
{
SDL_FillRect(screen, NULL, color);

View File

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
extern SDL_Surface *background;
extern SDL_Surface *gfx_background;
extern SDL_Surface *shape[MAX_SHAPES];
extern SDL_Surface *shipShape[MAX_SHIPSHAPES];
extern SDL_Surface *fontShape[MAX_FONTSHAPES];
@ -35,7 +35,6 @@ void gfx_init();
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest);
extern void drawBackGround();
extern void clearScreen(Uint32 color);
extern void delayFrame();
extern void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);

View File

@ -222,7 +222,7 @@ atexit();
void cleanUp()
{
freeGraphics();
SDL_FreeSurface(background);
SDL_FreeSurface(gfx_background);
audio_free();
resetLists();
delete(engine.bulletHead);

View File

@ -697,7 +697,7 @@ int intermission()
iconInfo[11].image = textSurface("Go to Destination Planet", FONT_WHITE);
bool redrawBackGround = true;
bool rescreen_drawBackground = true;
if (game.distanceCovered > 0)
section = 0;
@ -712,10 +712,10 @@ int intermission()
{
renderer_update();
if (redrawBackGround)
if (rescreen_drawBackground)
{
drawBackGround();
redrawBackGround = false;
screen_drawBackground();
rescreen_drawBackground = false;
}
else
{
@ -880,7 +880,7 @@ int intermission()
iconInfo[9].image = textSurface(string, FONT_WHITE);
intermission_updateCommsSurface(commsSurface);
section = 1;
redrawBackGround = true;
rescreen_drawBackground = true;
saveGame(0);
}
else if (interceptionChance > 0)
@ -936,7 +936,7 @@ int intermission()
if ((engine.keyState[KEY_FIRE]))
{
redrawBackGround = true;
rescreen_drawBackground = true;
section = i;
engine.keyState[KEY_FIRE] = 0;
}

View File

@ -21,13 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void loadBackground(const char *filename)
{
if (background != NULL)
if (gfx_background != NULL)
{
SDL_FreeSurface(background);
background = NULL;
SDL_FreeSurface(gfx_background);
gfx_background = NULL;
}
background = loadImage(filename);
SDL_SetColorKey(background, 0, 0);
gfx_background = loadImage(filename);
SDL_SetColorKey(gfx_background, 0, 0);
}
void loadGameGraphics()

View File

@ -42,6 +42,14 @@ int screen_renderString(const char *in, int x, int y, int fontColor)
return gfx_renderString(in, x, y, fontColor, 0, screen);
}
/*
Draws the background surface that has been loaded
*/
void screen_drawBackground()
{
screen_blit(gfx_background, 0, 0);
}
void screen_addBuffer(int x, int y, int w, int h)
{
bRect *rect = new bRect;
@ -91,7 +99,7 @@ void screen_unBuffer()
blitRect.w = rect->w;
blitRect.h = rect->h;
if (SDL_BlitSurface(background, &blitRect, screen, &blitRect) < 0)
if (SDL_BlitSurface(gfx_background, &blitRect, screen, &blitRect) < 0)
{
printf("BlitSurface error: %s\n", SDL_GetError());
showErrorAndExit(2, "");

View File

@ -29,6 +29,7 @@ extern bRect *screen_bufferTail;
void screen_blit(SDL_Surface *image, int x, int y);
void screen_blitText(int i);
int screen_renderString(const char *in, int x, int y, int fontColor);
void screen_drawBackground();
void screen_addBuffer(int x, int y, int w, int h);
void screen_flushBuffer();
void screen_unBuffer();

View File

@ -232,7 +232,7 @@ void doCutscene(int scene)
signed char currentMessage = -1;
int timer = 60 * 4;
drawBackGround();
screen_drawBackground();
SDL_Surface *face;

View File

@ -266,7 +266,7 @@ int doTitle()
signed char listLength = 5; // menu list length
signed char menuType = MENU_MAIN;
drawBackGround();
screen_drawBackground();
engine.done = 0;
flushInput();
@ -369,11 +369,11 @@ int doTitle()
if (!skip)
{
gfx_renderString("Copyright Parallel Realities 2003", 5,
560, FONT_WHITE, 0, background);
560, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, 580, FONT_WHITE, 0, background);
5, 580, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, 794 - strlen(buildVersion) * 9,
580, FONT_WHITE, 0, background);
580, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, 560, 800, 40);
skip = true;
}
@ -394,11 +394,11 @@ int doTitle()
if ((now - then <= 27500) && (!skip))
{
gfx_renderString("Copyright Parallel Realities 2003", 5, 560,
FONT_WHITE, 0, background);
FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, 580, FONT_WHITE, 0, background);
5, 580, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, 794 - strlen(buildVersion) * 9,
580, FONT_WHITE, 0, background);
580, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, 560, 800, 40);
skip = true;
}
@ -592,7 +592,7 @@ void showStory()
fclose(fp);
loadBackground("gfx/startUp.jpg");
drawBackGround();
screen_drawBackground();
screen_flushBuffer();
flushInput();
@ -633,7 +633,7 @@ void gameover()
{
screen_flushBuffer();
freeGraphics();
SDL_FillRect(background, NULL, black);
SDL_FillRect(gfx_background, NULL, black);
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
engine.gameSection = SECTION_INTERMISSION;
@ -697,7 +697,7 @@ void doCredits()
renderer_update();
clearScreen(black);
drawBackGround();
screen_drawBackground();
audio_playMusic("music/rise_of_spirit.ogg", 1);