diff --git a/src/game.cpp b/src/game.cpp index 6dca657..80f73eb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2110,7 +2110,7 @@ int game_mainLoop() } } - drawBackGround(); + screen_drawBackground(); screen_flushBuffer(); // Default to no aliens dead... diff --git a/src/gfx.cpp b/src/gfx.cpp index fb9c438..5967f71 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . 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); diff --git a/src/gfx.h b/src/gfx.h index f5d5879..b064960 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -22,7 +22,7 @@ along with this program. If not, see . #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); diff --git a/src/init.cpp b/src/init.cpp index 1185eb4..97e4a11 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -222,7 +222,7 @@ atexit(); void cleanUp() { freeGraphics(); - SDL_FreeSurface(background); + SDL_FreeSurface(gfx_background); audio_free(); resetLists(); delete(engine.bulletHead); diff --git a/src/intermission.cpp b/src/intermission.cpp index b9ea3b2..732bd3a 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -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; } diff --git a/src/resources.cpp b/src/resources.cpp index 2d6f9b1..fdf8b1f 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -21,13 +21,13 @@ along with this program. If not, see . 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() diff --git a/src/screen.cpp b/src/screen.cpp index 8c7593e..15e9b65 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -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, ""); diff --git a/src/screen.h b/src/screen.h index 7171dd3..c0c185f 100644 --- a/src/screen.h +++ b/src/screen.h @@ -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(); diff --git a/src/script.cpp b/src/script.cpp index d71703e..78e01bc 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -232,7 +232,7 @@ void doCutscene(int scene) signed char currentMessage = -1; int timer = 60 * 4; - drawBackGround(); + screen_drawBackground(); SDL_Surface *face; diff --git a/src/title.cpp b/src/title.cpp index f9b275b..bcce46d 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -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);