From 4bdf871e667836c8b8c013980b0eac0004c62dc7 Mon Sep 17 00:00:00 2001 From: onpon4 Date: Fri, 6 Nov 2015 19:36:20 -0500 Subject: [PATCH] drawString -> screen_renderString --- src/Starfighter.cpp | 4 ++-- src/gfx.cpp | 5 ----- src/gfx.h | 1 - src/init.cpp | 24 ++++++++++++------------ src/intermission.cpp | 2 +- src/missions.cpp | 32 ++++++++++++++++---------------- src/screen.cpp | 5 +++++ src/screen.h | 1 + src/script.cpp | 2 +- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Starfighter.cpp b/src/Starfighter.cpp index 31ea92e..8a3fde0 100644 --- a/src/Starfighter.cpp +++ b/src/Starfighter.cpp @@ -87,8 +87,8 @@ int main(int argc, char **argv) if (cheatAttempt && !engine.cheat) { clearScreen(black); - drawString("That doesn't work anymore", -1, 285, FONT_WHITE); - drawString("Try harder...", -1, 315, FONT_WHITE); + screen_renderString("That doesn't work anymore", -1, 285, FONT_WHITE); + screen_renderString("Try harder...", -1, 315, FONT_WHITE); renderer_update(); SDL_Delay(2000); clearScreen(black); diff --git a/src/gfx.cpp b/src/gfx.cpp index 4265d9e..fb9c438 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -186,11 +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); } -int drawString(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 */ diff --git a/src/gfx.h b/src/gfx.h index 5c7a13e..f5d5879 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -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 int drawString(const char *in, int x, int y, int fontColor); extern void drawBackGround(); extern void clearScreen(Uint32 color); extern void delayFrame(); diff --git a/src/init.cpp b/src/init.cpp index bb8e089..1185eb4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -49,7 +49,7 @@ void showErrorAndExit(int errorId, const char *name) if (errorId != 2) { - drawString("A file error has occurred", -1, 200, FONT_RED); + screen_renderString("A file error has occurred", -1, 200, FONT_RED); } else { @@ -63,24 +63,24 @@ void showErrorAndExit(int errorId, const char *name) { case 0: sprintf(string, "%s was not found in the Starfighter data package", name); - drawString(string, -1, 250, FONT_WHITE); - drawString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE); - drawString("or reinstall the game", -1, 300, FONT_WHITE); + screen_renderString(string, -1, 250, FONT_WHITE); + screen_renderString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE); + screen_renderString("or reinstall the game", -1, 300, FONT_WHITE); break; case 1: - drawString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE); - drawString("attempting to load game data. Please try running", -1, 275, FONT_WHITE); - drawString("the game again. If the errors persist, reinstall the game", -1, 300, FONT_WHITE); + screen_renderString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE); + screen_renderString("attempting to load game data. Please try running", -1, 275, FONT_WHITE); + screen_renderString("the game again. If the errors persist, reinstall the game", -1, 300, FONT_WHITE); break; case 2: - drawString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE); - drawString("while attempting to perform a required program function.", -1, 275, FONT_WHITE); - drawString("Please contact the authors with details.", -1, 300, FONT_WHITE); + screen_renderString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE); + screen_renderString("while attempting to perform a required program function.", -1, 275, FONT_WHITE); + screen_renderString("Please contact the authors with details.", -1, 300, FONT_WHITE); break; } - drawString("Project: Starfighter will now exit", -1, 450, FONT_WHITE); - drawString("Press Space to continue", -1, 475, FONT_WHITE); + screen_renderString("Project: Starfighter will now exit", -1, 450, FONT_WHITE); + screen_renderString("Press Space to continue", -1, 475, FONT_WHITE); renderer_update(); diff --git a/src/intermission.cpp b/src/intermission.cpp index f612910..b9ea3b2 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -270,7 +270,7 @@ static bool intermission_showSystem(float x, float y, bool selectable) r.x, r.y, systemPlanet[planet].image->w, systemPlanet[planet].image->h)) { - drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE); + screen_renderString(systemPlanet[planet].name, -1, 545, FONT_WHITE); if ((engine.keyState[KEY_FIRE])) { if (game.system == 0) diff --git a/src/missions.cpp b/src/missions.cpp index 42989ce..c530ee3 100644 --- a/src/missions.cpp +++ b/src/missions.cpp @@ -715,13 +715,13 @@ static void drawBriefScreen() blevelRect(140, 70, 500, 20, 0x00, 0x77, 0x00); blevelRect(140, 90, 500, 130, 0x00, 0x33, 0x00); - drawString("Primary Objectives", 150, 74, FONT_WHITE); + screen_renderString("Primary Objectives", 150, 74, FONT_WHITE); for (int i = 0 ; i < 3 ; i++) { if ((currentMission.primaryType[i] != NONE) && (currentMission.completed1[i] != OB_HIDDEN)) { - drawString(currentMission.primaryObjective[i], 160, 114 + (i * 30), FONT_WHITE); + screen_renderString(currentMission.primaryObjective[i], 160, 114 + (i * 30), FONT_WHITE); } } @@ -729,13 +729,13 @@ static void drawBriefScreen() { blevelRect(140, 230, 500, 20, 0x00, 0x77, 0x77); blevelRect(140, 250, 500, 130, 0x00, 0x33, 0x33); - drawString("Secondary Objectives", 150, 234, FONT_WHITE); + screen_renderString("Secondary Objectives", 150, 234, FONT_WHITE); for (int i = 0 ; i < 3 ; i++) { if (currentMission.secondaryType[i] != NONE) { - drawString(currentMission.secondaryObjective[i], 160, 274 + (i * 30), FONT_WHITE); + screen_renderString(currentMission.secondaryObjective[i], 160, 274 + (i * 30), FONT_WHITE); game.secondaryMissions++; } } @@ -743,7 +743,7 @@ static void drawBriefScreen() blevelRect(140, 390, 500, 20, 0x77, 0x77, 0x00); blevelRect(140, 410, 500, 130, 0x33, 0x33, 0x00); - drawString("Additional Information", 150, 394, FONT_WHITE); + screen_renderString("Additional Information", 150, 394, FONT_WHITE); } /* @@ -768,7 +768,7 @@ void missionBriefScreen() sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]); else sprintf(temp, "SURVIVAL FOR %d minutes", currentMission.timeLimit1[0]); - drawString(temp, -1, 500, FONT_RED); + screen_renderString(temp, -1, 500, FONT_RED); } switch (game.area) @@ -780,16 +780,16 @@ void missionBriefScreen() case MISN_ELLESH: case MISN_MARS: case MISN_VENUS: - drawString("Phoebe Lexx will not be present", 160, 420, FONT_WHITE); + screen_renderString("Phoebe Lexx will not be present", 160, 420, FONT_WHITE); if (game.hasWingMate2) - drawString("Ursula Lexx will not be present", 160, 450, FONT_WHITE); + screen_renderString("Ursula Lexx will not be present", 160, 450, FONT_WHITE); break; } if ((game.area == MISN_URUSOR) || (game.area == MISN_POSWIC) || (game.area == MISN_EARTH)) - drawString("Sid Wilson will join you on this mission", 160, 480, FONT_WHITE); + screen_renderString("Sid Wilson will join you on this mission", 160, 480, FONT_WHITE); renderer_update(); } @@ -816,7 +816,7 @@ void missionBriefScreen() if (game.area != MISN_INTERCEPTION) { - drawString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE); + screen_renderString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE); renderer_update(); @@ -870,9 +870,9 @@ void missionFinishedScreen() if (currentMission.primaryType[i] != NONE) { if ((game.area != MISN_POSWIC) || (i != 1)) - drawString("COMPLETED", 550, 114 + (i * 30), FONT_GREEN); + screen_renderString("COMPLETED", 550, 114 + (i * 30), FONT_GREEN); else - drawString("FAILED", 550, 114 + (i * 30), FONT_RED); + screen_renderString("FAILED", 550, 114 + (i * 30), FONT_RED); } } @@ -885,12 +885,12 @@ void missionFinishedScreen() strcpy(temp, currentMission.secondaryObjective[i]); if (currentMission.completed2[i] >= 1) { - drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN); + screen_renderString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN); game.secondaryMissionsCompleted++; } else { - drawString("FAILED", 550, 274 + (i * 30), FONT_RED); + screen_renderString("FAILED", 550, 274 + (i * 30), FONT_RED); } } } @@ -900,7 +900,7 @@ void missionFinishedScreen() { shield_bonus = player.shield * 10; sprintf(temp, "Shield Bonus: $%.3d", shield_bonus); - drawString(temp, -1, 430, FONT_WHITE); + screen_renderString(temp, -1, 430, FONT_WHITE); game.cash += shield_bonus; game.cashEarned += shield_bonus; } @@ -911,7 +911,7 @@ void missionFinishedScreen() engine.timeTaken / 3600, (engine.timeTaken / 60) % 60, engine.timeTaken % 60); - drawString(temp, -1, 500, FONT_WHITE); + screen_renderString(temp, -1, 500, FONT_WHITE); // Do some mission specific stuff here... if (game.area == MISN_HAIL) diff --git a/src/screen.cpp b/src/screen.cpp index e1e6320..8c7593e 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -37,6 +37,11 @@ void screen_blitText(int i) screen_blit(gfx_text[i].image, (int)gfx_text[i].x, (int)gfx_text[i].y); } +int screen_renderString(const char *in, int x, int y, int fontColor) +{ + return gfx_renderString(in, x, y, fontColor, 0, screen); +} + void screen_addBuffer(int x, int y, int w, int h) { bRect *rect = new bRect; diff --git a/src/screen.h b/src/screen.h index 7dc04ad..7171dd3 100644 --- a/src/screen.h +++ b/src/screen.h @@ -28,6 +28,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_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 4edb428..d71703e 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -301,7 +301,7 @@ void doCutscene(int scene) if ((showMessage) && (messageBox != NULL)) screen_blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100); - drawString("Press [Escape] to skip", -1, 580, FONT_WHITE); + screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE); delayFrame();