Browse Source

Redo win overlay

merge-requests/2/head
Miloslav Číž 2 years ago
parent
commit
544c7a955e
  1. 104
      game.h
  2. 1
      main_gbmeta.ino
  3. 2
      main_sdl.c
  4. 6
      texts.h

104
game.h

@ -4279,8 +4279,9 @@ void SFG_drawMenu() @@ -4279,8 +4279,9 @@ void SFG_drawMenu()
i++;
}
SFG_drawText("0.7 CC0",SFG_HUD_MARGIN,SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN
- SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE,SFG_FONT_SIZE_SMALL,4,0,0);
SFG_drawText(SFG_VERSION_STRING " CC0",SFG_HUD_MARGIN,SFG_GAME_RESOLUTION_Y -
SFG_HUD_MARGIN - SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE,
SFG_FONT_SIZE_SMALL,4,0,0);
#if SFG_OS_IS_MALWARE
if (SFG_game.blink)
@ -4296,7 +4297,103 @@ void SFG_drawMenu() @@ -4296,7 +4297,103 @@ void SFG_drawMenu()
void SFG_drawWinOverlay()
{
uint32_t t = RCL_min(SFG_WIN_ANIMATION_DURATION,
SFG_game.frameTime - SFG_game.stateChangeTime);
SFG_game.frameTime - SFG_game.stateChangeTime);
uint32_t t2 = RCL_min(t,SFG_WIN_ANIMATION_DURATION / 4);
#define STRIP_HEIGHT (SFG_GAME_RESOLUTION_Y / 2)
#define INNER_STRIP_HEIGHT ((STRIP_HEIGHT * 3) / 4)
#define STRIP_START ((SFG_GAME_RESOLUTION_Y - STRIP_HEIGHT) / 2)
RCL_Unit l = (t2 * STRIP_HEIGHT * 4) / SFG_WIN_ANIMATION_DURATION;
uint8_t n = (t * 5) / SFG_WIN_ANIMATION_DURATION;
for (uint16_t y = STRIP_START; y < STRIP_START + l; ++y)
for (uint16_t x = 0; x < SFG_GAME_RESOLUTION_X; ++x)
SFG_setGamePixel(x,y,
RCL_abs(y - (SFG_GAME_RESOLUTION_Y / 2)) <= (INNER_STRIP_HEIGHT / 2) ?
0 : 172);
char textLine[] = "level done";
uint16_t y = SFG_GAME_RESOLUTION_Y / 2 -
((STRIP_HEIGHT + INNER_STRIP_HEIGHT) / 2) / 2;
uint16_t x = (SFG_GAME_RESOLUTION_X -
SFG_textHorizontalSize(textLine,SFG_FONT_SIZE_BIG)) / 2;
SFG_drawText(textLine,x,y,SFG_FONT_SIZE_BIG,7 + SFG_game.blink * 95,255,0);
uint32_t timeTotal = SFG_SAVE_TOTAL_TIME;
// don't show totals in level 1:
uint8_t blink = (SFG_game.blink) && (SFG_currentLevel.levelNumber != 0)
&& (timeTotal != 0);
if (t >= (SFG_WIN_ANIMATION_DURATION / 2))
{
y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;
x = SFG_HUD_MARGIN;
#define CHAR_SIZE (SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE)
uint32_t time = blink ? timeTotal : SFG_currentLevel.completionTime10sOfS;
x += SFG_drawNumber(time / 10,x,y,SFG_FONT_SIZE_SMALL,7) *
CHAR_SIZE;
char timeRest[5] = ".X s";
timeRest[1] = '0' + (time % 10);
SFG_drawText(timeRest,x,y,SFG_FONT_SIZE_SMALL,7,4,0);
x = SFG_HUD_MARGIN;
y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;
if (blink)
{
x += (SFG_drawNumber(SFG_game.save[10] + SFG_game.save[11] * 256,x,y,
SFG_FONT_SIZE_SMALL,7) + 1) * CHAR_SIZE;
}
else
{
x += SFG_drawNumber(SFG_currentLevel.monstersDead,x,y,
SFG_FONT_SIZE_SMALL,7) * CHAR_SIZE;
SFG_drawText("/",x,y,SFG_FONT_SIZE_SMALL,7,1,0);
x += CHAR_SIZE;
x += (SFG_drawNumber(SFG_currentLevel.monsterRecordCount,x,y,
SFG_FONT_SIZE_SMALL,7) + 1) * CHAR_SIZE;
}
SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0);
if ((t >= (SFG_WIN_ANIMATION_DURATION - 1)) &&
(SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1)))
{
y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;
SFG_drawText(SFG_TEXT_SAVE_PROMPT,
(SFG_GAME_RESOLUTION_X - SFG_textHorizontalSize(SFG_TEXT_SAVE_PROMPT,
SFG_FONT_SIZE_MEDIUM)) / 2,y,SFG_FONT_SIZE_MEDIUM,7,255,0);
}
#undef CHAR_SIZE
}
#undef STRIP_HEIGHT
#undef STRIP_START
#undef INNER_STRIP_HEIGHT
}
/*
void SFG_drawWinOverlay()
{
uint32_t t = RCL_min(SFG_WIN_ANIMATION_DURATION,
SFG_game.frameTime - SFG_game.stateChangeTime);
uint32_t t2 = RCL_min(t,SFG_WIN_ANIMATION_DURATION / 4);
@ -4400,6 +4497,7 @@ void SFG_drawWinOverlay() @@ -4400,6 +4497,7 @@ void SFG_drawWinOverlay()
#undef STRIP_START
#undef INNER_STRIP_HEIGHT
}
*/
void SFG_draw()
{

1
main_gbmeta.ino

@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
#define SFG_RAYCASTING_MAX_STEPS 20
#define SFG_RAYCASTING_MAX_HITS 5
#define SFG_RAYCASTING_SUBSAMPLE 2
#define SFG_DIMINISH_SPRITES 0
#define SFG_DITHERED_SHADOW 0

2
main_sdl.c

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
// #define SFG_START_LEVEL 6
// #define SFG_IMMORTAL 1
// #define SFG_UNLOCK_DOOR 1
#define SFG_UNLOCK_DOOR 1
// #define SFG_REVEAL_MAP 1
// #define SFG_INFINITE_AMMO 1

6
texts.h

@ -32,6 +32,12 @@ static const char *SFG_menuItemTexts[] = @@ -32,6 +32,12 @@ static const char *SFG_menuItemTexts[] =
#define SFG_TEXT_KILLS "kills"
#define SFG_TEXT_SAVE_PROMPT "save? L no yes R"
#define SFG_TEXT_SAVED "saved"
#define SFG_VERSION_STRING "0.9d"
/**<
Version numbering is following: major.minor for stable releases,
in-development unstable versions have the version of the latest stable +
"d" postfix, e.g. 1.0d. This means the "d" versions can actually differ even
if they're marked the same. */
static const char *SFG_introText =
"Near future, capitalist hell, Macrochip corp has enslaved man via "

Loading…
Cancel
Save