Updated all remaining blitTextInPlace calls. Removed legacy function.

This commit is contained in:
Julie Marchant 2019-06-01 23:04:19 -04:00
parent a4760466fe
commit 4a2b05b6d6
3 changed files with 39 additions and 75 deletions

View File

@ -45,16 +45,6 @@ void screen_blitText(int i, int x, int y)
(x + (int)gfx_textSprites[i].x), (y +(int)gfx_textSprites[i].y)); (x + (int)gfx_textSprites[i].x), (y +(int)gfx_textSprites[i].y));
} }
// Legacy function; will be removed later
void screen_blitTextInPlace(int i)
{
int x = gfx_textSprites[i].x;
if (x == -1)
x = (screen->w - gfx_textSprites[i].image->w) / 2;
screen_blit(gfx_textSprites[i].image, x, (int)gfx_textSprites[i].y);
}
int screen_renderString(const char *in, int x, int y, int fontColor) int screen_renderString(const char *in, int x, int y, int fontColor)
{ {
return gfx_renderString(in, x, y, fontColor, 0, screen); return gfx_renderString(in, x, y, fontColor, 0, screen);

View File

@ -31,7 +31,6 @@ extern LinkedRect *screen_bufferTail;
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, int x, int y); void screen_blitText(int i, int x, int y);
void screen_blitTextInPlace(int i);
int screen_renderString(const char *in, int x, int y, int fontColor); int screen_renderString(const char *in, int x, int y, int fontColor);
void screen_drawBackground(); void screen_drawBackground();
void screen_addBuffer(int x, int y, int w, int h); void screen_addBuffer(int x, int y, int w, int h);

View File

@ -86,33 +86,26 @@ static int showLoadMenu()
static void createDifficultyMenu() static void createDifficultyMenu()
{ {
gfx_createTextObject(TS_START_GAME, "START GAME", gfx_createTextObject(TS_START_GAME, "START GAME", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 50, FONT_WHITE);
if (game.difficulty == DIFFICULTY_EASY) if (game.difficulty == DIFFICULTY_EASY)
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - EASY", gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - EASY", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else if (game.difficulty == DIFFICULTY_HARD) else if (game.difficulty == DIFFICULTY_HARD)
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - HARD", gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - HARD", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else if (game.difficulty == DIFFICULTY_NIGHTMARE) else if (game.difficulty == DIFFICULTY_NIGHTMARE)
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!", gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else if (game.difficulty == DIFFICULTY_ORIGINAL) else if (game.difficulty == DIFFICULTY_ORIGINAL)
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - CLASSIC", gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - CLASSIC", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else else
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NORMAL", gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NORMAL", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
} }
static int showDifficultyMenu() static int showDifficultyMenu()
{ {
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110; screen_blitText(TS_START_GAME, -1, screen->h / 3 + 50);
screen_blitText(TS_DIFFICULTY, -1, screen->h / 3 + 70);
screen_blitTextInPlace(TS_START_GAME); gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = 0;
screen_blitTextInPlace(TS_DIFFICULTY); screen_blitText(TS_BACK_TO_MAIN_MENU, -1, screen->h / 3 + 110);
screen_blitTextInPlace(TS_BACK_TO_MAIN_MENU);
return 3; return 3;
} }
@ -120,43 +113,34 @@ static int showDifficultyMenu()
static void createOptionsMenu() static void createOptionsMenu()
{ {
if (engine.useSound) if (engine.useSound)
gfx_createTextObject(TS_SOUND, "SOUND - ON", gfx_createTextObject(TS_SOUND, "SOUND - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 50, FONT_WHITE);
else else
gfx_createTextObject(TS_SOUND, "SOUND - OFF", gfx_createTextObject(TS_SOUND, "SOUND - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 50, FONT_WHITE);
if (engine.useMusic) if (engine.useMusic)
gfx_createTextObject(TS_MUSIC, "MUSIC - ON", gfx_createTextObject(TS_MUSIC, "MUSIC - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else else
gfx_createTextObject(TS_MUSIC, "MUSIC - OFF", gfx_createTextObject(TS_MUSIC, "MUSIC - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
if (engine.fullScreen) if (engine.fullScreen)
gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - ON", gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 90, FONT_WHITE);
else else
gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - OFF", gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 90, FONT_WHITE);
if (engine.autoPause) if (engine.autoPause)
gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - ON", gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 110, FONT_WHITE);
else else
gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - OFF", gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 110, FONT_WHITE);
} }
static int showOptionsMenu() static int showOptionsMenu()
{ {
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150; screen_blitText(TS_SOUND, -1, screen->h / 3 + 50);
screen_blitText(TS_MUSIC, -1, screen->h / 3 + 70);
screen_blitTextInPlace(TS_SOUND); screen_blitText(TS_FULLSCREEN, -1, screen->h / 3 + 90);
screen_blitTextInPlace(TS_MUSIC); screen_blitText(TS_AUTOPAUSE, -1, screen->h / 3 + 110);
screen_blitTextInPlace(TS_FULLSCREEN); gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = 0;
screen_blitTextInPlace(TS_AUTOPAUSE); screen_blitText(TS_BACK_TO_MAIN_MENU, -1, screen->h / 3 + 150);
screen_blitTextInPlace(TS_BACK_TO_MAIN_MENU);
return 5; return 5;
} }
@ -164,43 +148,34 @@ static int showOptionsMenu()
static void createCheatMenu() static void createCheatMenu()
{ {
if (engine.cheatShield) if (engine.cheatShield)
gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - ON", gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 50, FONT_WHITE);
else else
gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - OFF", gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 50, FONT_WHITE);
if (engine.cheatAmmo) if (engine.cheatAmmo)
gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - ON", gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
else else
gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - OFF", gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 70, FONT_WHITE);
if (engine.cheatCash) if (engine.cheatCash)
gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - ON", gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 90, FONT_WHITE);
else else
gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - OFF", gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 90, FONT_WHITE);
if (engine.cheatTime) if (engine.cheatTime)
gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - ON", gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - ON", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 110, FONT_WHITE);
else else
gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - OFF", gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - OFF", 0, 0, FONT_WHITE);
-1, screen->h / 3 + 110, FONT_WHITE);
} }
static int showCheatMenu() static int showCheatMenu()
{ {
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150; screen_blitText(TS_UNLIMITED_SHIELD, -1, screen->h / 3 + 50);
screen_blitText(TS_UNLIMITED_AMMO, -1, screen->h / 3 + 70);
screen_blitTextInPlace(TS_UNLIMITED_SHIELD); screen_blitText(TS_UNLIMITED_CASH, -1, screen->h / 3 + 90);
screen_blitTextInPlace(TS_UNLIMITED_AMMO); screen_blitText(TS_UNLIMITED_TIME, -1, screen->h / 3 + 110);
screen_blitTextInPlace(TS_UNLIMITED_CASH); gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = 0;
screen_blitTextInPlace(TS_UNLIMITED_TIME); screen_blitText(TS_BACK_TO_MAIN_MENU, -1, screen->h / 3 + 150);
screen_blitTextInPlace(TS_BACK_TO_MAIN_MENU);
return 5; return 5;
} }
@ -263,7 +238,7 @@ int title_show()
createOptionsMenu(); createOptionsMenu();
createDifficultyMenu(); createDifficultyMenu();
gfx_createTextObject(TS_BACK_TO_MAIN_MENU, "BACK TO MAIN MENU", -1, 0, FONT_WHITE); gfx_createTextObject(TS_BACK_TO_MAIN_MENU, "BACK TO MAIN MENU", 0, 0, FONT_WHITE);
createCheatMenu(); createCheatMenu();