drawString -> screen_renderString
This commit is contained in:
parent
67d464433d
commit
4bdf871e66
|
@ -87,8 +87,8 @@ int main(int argc, char **argv)
|
||||||
if (cheatAttempt && !engine.cheat)
|
if (cheatAttempt && !engine.cheat)
|
||||||
{
|
{
|
||||||
clearScreen(black);
|
clearScreen(black);
|
||||||
drawString("That doesn't work anymore", -1, 285, FONT_WHITE);
|
screen_renderString("That doesn't work anymore", -1, 285, FONT_WHITE);
|
||||||
drawString("Try harder...", -1, 315, FONT_WHITE);
|
screen_renderString("Try harder...", -1, 315, FONT_WHITE);
|
||||||
renderer_update();
|
renderer_update();
|
||||||
SDL_Delay(2000);
|
SDL_Delay(2000);
|
||||||
clearScreen(black);
|
clearScreen(black);
|
||||||
|
|
|
@ -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);
|
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
|
Draws the background surface that has been loaded
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,7 +35,6 @@ void gfx_init();
|
||||||
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
||||||
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);
|
||||||
int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, 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 drawBackGround();
|
||||||
extern void clearScreen(Uint32 color);
|
extern void clearScreen(Uint32 color);
|
||||||
extern void delayFrame();
|
extern void delayFrame();
|
||||||
|
|
24
src/init.cpp
24
src/init.cpp
|
@ -49,7 +49,7 @@ void showErrorAndExit(int errorId, const char *name)
|
||||||
|
|
||||||
if (errorId != 2)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -63,24 +63,24 @@ void showErrorAndExit(int errorId, const char *name)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sprintf(string, "%s was not found in the Starfighter data package", name);
|
sprintf(string, "%s was not found in the Starfighter data package", name);
|
||||||
drawString(string, -1, 250, FONT_WHITE);
|
screen_renderString(string, -1, 250, FONT_WHITE);
|
||||||
drawString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE);
|
screen_renderString("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("or reinstall the game", -1, 300, FONT_WHITE);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
drawString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE);
|
screen_renderString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE);
|
||||||
drawString("attempting to load game data. Please try running", -1, 275, FONT_WHITE);
|
screen_renderString("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("the game again. If the errors persist, reinstall the game", -1, 300, FONT_WHITE);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
drawString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE);
|
screen_renderString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE);
|
||||||
drawString("while attempting to perform a required program function.", -1, 275, FONT_WHITE);
|
screen_renderString("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("Please contact the authors with details.", -1, 300, FONT_WHITE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawString("Project: Starfighter will now exit", -1, 450, FONT_WHITE);
|
screen_renderString("Project: Starfighter will now exit", -1, 450, FONT_WHITE);
|
||||||
drawString("Press Space to continue", -1, 475, FONT_WHITE);
|
screen_renderString("Press Space to continue", -1, 475, FONT_WHITE);
|
||||||
|
|
||||||
renderer_update();
|
renderer_update();
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
|
||||||
r.x, r.y, systemPlanet[planet].image->w,
|
r.x, r.y, systemPlanet[planet].image->w,
|
||||||
systemPlanet[planet].image->h))
|
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 ((engine.keyState[KEY_FIRE]))
|
||||||
{
|
{
|
||||||
if (game.system == 0)
|
if (game.system == 0)
|
||||||
|
|
|
@ -715,13 +715,13 @@ static void drawBriefScreen()
|
||||||
|
|
||||||
blevelRect(140, 70, 500, 20, 0x00, 0x77, 0x00);
|
blevelRect(140, 70, 500, 20, 0x00, 0x77, 0x00);
|
||||||
blevelRect(140, 90, 500, 130, 0x00, 0x33, 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++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if ((currentMission.primaryType[i] != NONE) && (currentMission.completed1[i] != OB_HIDDEN))
|
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, 230, 500, 20, 0x00, 0x77, 0x77);
|
||||||
blevelRect(140, 250, 500, 130, 0x00, 0x33, 0x33);
|
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++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if (currentMission.secondaryType[i] != NONE)
|
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++;
|
game.secondaryMissions++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -743,7 +743,7 @@ static void drawBriefScreen()
|
||||||
|
|
||||||
blevelRect(140, 390, 500, 20, 0x77, 0x77, 0x00);
|
blevelRect(140, 390, 500, 20, 0x77, 0x77, 0x00);
|
||||||
blevelRect(140, 410, 500, 130, 0x33, 0x33, 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]);
|
sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]);
|
||||||
else
|
else
|
||||||
sprintf(temp, "SURVIVAL FOR %d minutes", currentMission.timeLimit1[0]);
|
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)
|
switch (game.area)
|
||||||
|
@ -780,16 +780,16 @@ void missionBriefScreen()
|
||||||
case MISN_ELLESH:
|
case MISN_ELLESH:
|
||||||
case MISN_MARS:
|
case MISN_MARS:
|
||||||
case MISN_VENUS:
|
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)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((game.area == MISN_URUSOR) ||
|
if ((game.area == MISN_URUSOR) ||
|
||||||
(game.area == MISN_POSWIC) ||
|
(game.area == MISN_POSWIC) ||
|
||||||
(game.area == MISN_EARTH))
|
(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();
|
renderer_update();
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ void missionBriefScreen()
|
||||||
|
|
||||||
if (game.area != MISN_INTERCEPTION)
|
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();
|
renderer_update();
|
||||||
|
|
||||||
|
@ -870,9 +870,9 @@ void missionFinishedScreen()
|
||||||
if (currentMission.primaryType[i] != NONE)
|
if (currentMission.primaryType[i] != NONE)
|
||||||
{
|
{
|
||||||
if ((game.area != MISN_POSWIC) || (i != 1))
|
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
|
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]);
|
strcpy(temp, currentMission.secondaryObjective[i]);
|
||||||
if (currentMission.completed2[i] >= 1)
|
if (currentMission.completed2[i] >= 1)
|
||||||
{
|
{
|
||||||
drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN);
|
screen_renderString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN);
|
||||||
game.secondaryMissionsCompleted++;
|
game.secondaryMissionsCompleted++;
|
||||||
}
|
}
|
||||||
else
|
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;
|
shield_bonus = player.shield * 10;
|
||||||
sprintf(temp, "Shield Bonus: $%.3d", shield_bonus);
|
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.cash += shield_bonus;
|
||||||
game.cashEarned += shield_bonus;
|
game.cashEarned += shield_bonus;
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ void missionFinishedScreen()
|
||||||
engine.timeTaken / 3600, (engine.timeTaken / 60) % 60,
|
engine.timeTaken / 3600, (engine.timeTaken / 60) % 60,
|
||||||
engine.timeTaken % 60);
|
engine.timeTaken % 60);
|
||||||
|
|
||||||
drawString(temp, -1, 500, FONT_WHITE);
|
screen_renderString(temp, -1, 500, FONT_WHITE);
|
||||||
|
|
||||||
// Do some mission specific stuff here...
|
// Do some mission specific stuff here...
|
||||||
if (game.area == MISN_HAIL)
|
if (game.area == MISN_HAIL)
|
||||||
|
|
|
@ -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);
|
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)
|
void screen_addBuffer(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
bRect *rect = new bRect;
|
bRect *rect = new bRect;
|
||||||
|
|
|
@ -28,6 +28,7 @@ extern bRect *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);
|
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_addBuffer(int x, int y, int w, int h);
|
||||||
void screen_flushBuffer();
|
void screen_flushBuffer();
|
||||||
void screen_unBuffer();
|
void screen_unBuffer();
|
||||||
|
|
|
@ -301,7 +301,7 @@ void doCutscene(int scene)
|
||||||
if ((showMessage) && (messageBox != NULL))
|
if ((showMessage) && (messageBox != NULL))
|
||||||
screen_blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100);
|
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();
|
delayFrame();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue