MOAR MOAR

This commit is contained in:
Julie Marchant 2019-06-11 20:08:29 -04:00
parent cea10fd3fb
commit 5434ce43c4
3 changed files with 49 additions and 32 deletions

View File

@ -1865,7 +1865,8 @@ static void game_doHud()
int shieldColor = 0;
SDL_Rect bar;
int fontColor;
char text[25];
int tTextIndex;
char text[STRMAX_SHORT];
int i;
screen_addBuffer(0, 20, screen->w, 25);
@ -1873,16 +1874,31 @@ static void game_doHud()
if (engine.minutes > -1)
{
if ((engine.minutes == 0) && (engine.seconds <= 29))
fontColor = FONT_RED;
else if ((engine.minutes == 0) && (engine.seconds > 29))
fontColor = FONT_YELLOW;
else
if (game.area == MISN_MARS)
{
fontColor = FONT_WHITE;
screen_blitText(TS_TIME_T, screen->w / 2 - 140, 20);
sprintf(text, "%.2d:%.2d", engine.minutes, engine.seconds);
}
else
{
if ((engine.minutes == 0) && (engine.seconds <= 29))
fontColor = FONT_RED;
else if ((engine.minutes == 0) && (engine.seconds > 29))
fontColor = FONT_YELLOW;
else
fontColor = FONT_WHITE;
}
/// Each "%.2d" must be retained. They are replaced with the minutes and seconds left
/// to complete the mission, respectively (or, in the case of the Mars mission, the
/// minutes and seconds, respectively, until the mission is completed).
/// If you are familiar with C string formatting, they can be modified as long as
/// the "d" type remains. For example, you can replace "%.2d" with "%d" to allow the
/// timer to use single-digit numbers.
/// The ":" can also be replaced just like any text. For example, this would be fine:
/// "Time Remaining - %d minutes and %d seconds"
sprintf(text, _("Time Remaining - %.2d:%.2d"), engine.minutes, engine.seconds);
gfx_createTextObject(TS_TIME, text, 0, 0, fontColor);
screen_blitText(TS_TIME, screen->w / 2 + 10, 21);
screen_blitText(TS_TIME, screen->w / 2 - gfx_textSprites[TS_TIME].image->w / 2, 20);
}
if (game.area != MISN_INTERCEPTION)
@ -2059,23 +2075,25 @@ static void game_doHud()
{
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
screen_blitText(TS_TARGET, screen->w * 11 / 16, screen->h - 50);
tTextIndex = TS_TARGET;
}
else
{
if (engine.targetIndex == ALIEN_SID)
screen_blitText(TS_TARGET_SID, screen->w * 11 / 16 + 27, screen->h - 50);
tTextIndex = TS_TARGET_SID;
else if (engine.targetIndex == ALIEN_PHOEBE)
screen_blitText(TS_TARGET_PHOEBE, screen->w * 11 / 16, screen->h - 50);
tTextIndex = TS_TARGET_PHOEBE;
else if (engine.targetIndex == ALIEN_KLINE)
screen_blitText(TS_TARGET_KLINE, screen->w * 11 / 16 + 9, screen->h - 50);
tTextIndex = TS_TARGET_KLINE;
else
screen_blitText(TS_TARGET, screen->w * 11 / 16, screen->h - 50);
tTextIndex = TS_TARGET;
}
screen_blitText(tTextIndex, screen->w * 11 / 16, screen->h - 50);
bar.w = MAX(screen->w / 800, 1);
bar.h = 12;
bar.x = screen->w * 11 / 16 + 65;
bar.x = screen->w * 11 / 16 + gfx_textSprites[tTextIndex].image->w + 10;
bar.y = screen->h - 50;
for (float i = 0 ; i < (engine.targetShield * aliens[engine.targetIndex].shield) ; i++)
@ -2097,7 +2115,7 @@ static void game_doHud()
bar.w = screen->w / 32;
bar.h = 12;
bar.x = screen->w / 32 + 55;
bar.x = screen->w / 32 + gfx_textSprites[TS_POWER].image->w + 10;
bar.y = screen->h - 29;
for (int i = 1 ; i <= 5 ; i++)
@ -2116,7 +2134,7 @@ static void game_doHud()
bar.w = screen->w / 32;
bar.h = 12;
bar.x = screen->w * 5 / 16 + 65;
bar.x = screen->w * 5 / 16 + gfx_textSprites[TS_OUTPUT].image->w + 10;
bar.y = screen->h - 29;
SDL_FillRect(screen, &bar, yellow);
@ -2137,7 +2155,7 @@ static void game_doHud()
bar.w = screen->w / 32;
bar.h = 12;
bar.x = screen->w * 97 / 160 + 65;
bar.x = screen->w * 97 / 160 + gfx_textSprites[TS_COOLER].image->w + 10;
bar.y = screen->h - 29;
for (int i = 1 ; i <= 5 ; i++)
@ -2167,7 +2185,7 @@ static void game_doHud()
bar.w = blockSize;
bar.h = 12;
bar.x = screen->w / 32 + 65;
bar.x = screen->w / 32 + gfx_textSprites[TS_SHIELD].image->w + 10;
bar.y = screen->h - 50;
for (int i = 0 ; i < player.shield ; i += blockSize)

View File

@ -1169,8 +1169,6 @@ mission begins playing here.
*/
void mission_showStartScreen()
{
// TODO: Replace all "TS_*_T" objs with string formatting, plus adjust
// spacing for things like TS_SHIELD
screen_clear(black);
renderer_update();
@ -1182,7 +1180,6 @@ void mission_showStartScreen()
gfx_createTextObject(TS_TARGET_SID, _("Sid"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET_PHOEBE, _("Phoebe"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET_KLINE, _("Kline"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TIME_T, "Time Remaining - ", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_POWER, "Power", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_OUTPUT, "Output", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_COOLER, "Cooler", 0, 0, FONT_WHITE);

View File

@ -276,24 +276,24 @@ static void drawShop()
gfx_renderUnicode(_("Primary Weapon"), 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
/// Retain "%d" as-is. It is replaced with the min plasma output.
sprintf(description, _("Cannons : %d"), game.minPlasmaOutput);
sprintf(description, _("Cannons: %d"), game.minPlasmaOutput);
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
/// Retain "%d" as-is. It is replaced with the min plasma damage.
sprintf(description, _("Power : Stage %d"),
sprintf(description, _("Power: Stage %d"),
game.minPlasmaDamage);
gfx_renderUnicode(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
/// Retain "%d" as-is. It is replaced with the min plasma cooling.
sprintf(description, _("Cooling : Stage %d"),
sprintf(description, _("Cooling: Stage %d"),
game.minPlasmaRate);
gfx_renderUnicode(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
gfx_renderUnicode(_("Powerup Weapon"), 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
/// Retain "%d" as-is. It is replaced with the max plasma output.
sprintf(description, _("Splitter : Stage %d"),
sprintf(description, _("Splitter: Stage %d"),
game.maxPlasmaOutput);
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
/// Retain "%d" as-is. It is replaced with the max plasma damage.
sprintf(description, _("Condensor : Stage %d"),
sprintf(description, _("Condensor: Stage %d"),
game.maxPlasmaDamage);
gfx_renderUnicode(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
/// Retain "%d" as-is. It is replaced with the max plasma cooling.
@ -301,7 +301,7 @@ static void drawShop()
game.maxPlasmaRate);
gfx_renderUnicode(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
/// Retain "%d" as-is. It is replaced with the Firefly's plasma ammo capacity.
sprintf(description, _("Capacity : %d"), game.maxPlasmaAmmo);
sprintf(description, _("Capacity: %d"), game.maxPlasmaAmmo);
gfx_renderUnicode(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
drawSecondaryWeaponSurface();
@ -331,20 +331,22 @@ static void drawShop()
}
/// Retain "%d" as-is. It is replaced with the Firefly's max shield.
sprintf(description, _("Shield : %d"), player.maxShield);
sprintf(description, _("Shield: %d"), player.maxShield);
gfx_renderUnicode(description, 10, 6, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
/// Retain "%d" as-is. It is replaced with the player's current cash.
sprintf(description, _(" Cash : $%d"), game.cash);
sprintf(description, _("Cash: $%d"), game.cash);
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
/// Retain "%.3d". It is replaced with the ship's current number of plasma cells.
/// "%.3d" can be changed to "%d" if you wish to not fill in space with zeroes,
/// e.g. render the number 5 as "5" rather than "005".
sprintf(description, _("Plasma Cells : %.3d"), player.ammo[0]);
sprintf(description, _("Plasma Cells: %.3d"), player.ammo[0]);
// XXX: Bad positioning
gfx_renderUnicode(description, 430, 6, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
/// Retain "%.2d". It is replaced with the ship's current number of rockets.
/// "%.2d" can be changed to "%d" if you wish to not fill in space with zeroes,
/// e.g. render the number 3 as "3" rather than "03".
sprintf(description, _("Rockets : %.2d"), player.ammo[1]);
sprintf(description, _("Rockets: %.2d"), player.ammo[1]);
// XXX: Bad positioning
gfx_renderUnicode(description, 475, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
gfx_shopSprites[SHOP_S_ITEM_INFO] = gfx_createSurface(601, 56);