Add outro

This commit is contained in:
Miloslav Číž 2020-09-17 20:15:05 +02:00
parent de83e675a3
commit e2b73f6d4a
6 changed files with 52 additions and 13 deletions

View File

@ -198,7 +198,7 @@
/** /**
Time in ms of the level start stage. Time in ms of the level start stage.
*/ */
#define SFG_LEVEL_START_DURATION 2000 #define SFG_LEVEL_START_DURATION 1500
/** /**
Vertical sprite size, in RCL_Units. Vertical sprite size, in RCL_Units.

46
game.h
View File

@ -3648,7 +3648,12 @@ void SFG_gameStep()
if (t > SFG_WIN_ANIMATION_DURATION) if (t > SFG_WIN_ANIMATION_DURATION)
{ {
if (SFG_keyIsDown(SFG_KEY_RIGHT) || if (SFG_currentLevel.levelNumber == (SFG_NUMBER_OF_LEVELS - 1))
{
if (SFG_keyIsDown(SFG_KEY_A))
SFG_setGameState(SFG_GAME_STATE_OUTRO);
}
else if (SFG_keyIsDown(SFG_KEY_RIGHT) ||
SFG_keyIsDown(SFG_KEY_LEFT)) SFG_keyIsDown(SFG_KEY_LEFT))
{ {
SFG_setAndInitLevel(SFG_currentLevel.levelNumber); SFG_setAndInitLevel(SFG_currentLevel.levelNumber);
@ -3673,6 +3678,14 @@ void SFG_gameStep()
break; break;
case SFG_GAME_STATE_OUTRO:
if (((SFG_game.frameTime - SFG_game.stateChangeTime) >
SFG_STORYTEXT_DURATION) && (SFG_keyIsDown(SFG_KEY_A) ||
SFG_keyIsDown(SFG_KEY_B)))
SFG_setGameState(SFG_GAME_STATE_MENU);
break;
case SFG_GAME_STATE_LEVEL_START: case SFG_GAME_STATE_LEVEL_START:
{ {
SFG_updateLevel(); SFG_updateLevel();
@ -3787,9 +3800,29 @@ void SFG_drawMap()
*/ */
void SFG_drawStoryText() void SFG_drawStoryText()
{ {
SFG_clearScreen(0); const char *text;
const char *text = SFG_introText; uint16_t textColor;
if (SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1)) // intro?
{
text = SFG_introText;
textColor = 7;
SFG_clearScreen(0);
}
else // outro
{
text = SFG_outroText;
textColor = 23;
SFG_clearScreen(9);
SFG_blitImage(SFG_monsterSprites[18],
(SFG_GAME_RESOLUTION_X - SFG_TEXTURE_SIZE * SFG_FONT_SIZE_SMALL) / 2,
SFG_GAME_RESOLUTION_Y - (SFG_TEXTURE_SIZE + 3) * SFG_FONT_SIZE_SMALL,
SFG_FONT_SIZE_SMALL);
}
uint16_t textLen = 0; uint16_t textLen = 0;
@ -3801,7 +3834,7 @@ void SFG_drawStoryText()
((SFG_game.frameTime - SFG_game.stateChangeTime) * textLen) / ((SFG_game.frameTime - SFG_game.stateChangeTime) * textLen) /
SFG_STORYTEXT_DURATION + 1); SFG_STORYTEXT_DURATION + 1);
SFG_drawText(text,SFG_HUD_MARGIN,SFG_HUD_MARGIN,SFG_FONT_SIZE_SMALL,7, SFG_drawText(text,SFG_HUD_MARGIN,SFG_HUD_MARGIN,SFG_FONT_SIZE_SMALL,textColor,
drawLen,SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN); drawLen,SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN);
} }
@ -4127,7 +4160,8 @@ void SFG_drawWinOverlay()
SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0); SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0);
if (t >= (SFG_WIN_ANIMATION_DURATION - 1)) 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; y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;

View File

@ -1080,7 +1080,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_monsterSprites[][SFG_TEXTURE_STORE_SIZE] =
16,0,0,17,17,17,16,0,0,0,0,0,26,205,238,17,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,0,0, 16,0,0,17,17,17,16,0,0,0,0,0,26,205,238,17,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,0,0,
0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0
}, },
{ // 6. warrior idle { // 6, warrior idle
175,0,3,5,1,4,6,7,2,62,170,63,92,93,95,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 175,0,3,5,1,4,6,7,2,62,170,63,92,93,95,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,17,17,17,17, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,17,17,17,17,
17,17,16,0,0,0,0,0,0,0,23,119,119,119,119,119,119,119,113,0,0,0,0,0,0,1,136,255, 17,17,16,0,0,0,0,0,0,0,23,119,119,119,119,119,119,119,113,0,0,0,0,0,0,1,136,255,

View File

@ -19,7 +19,7 @@
#define SFG_START_LEVEL 8 #define SFG_START_LEVEL 8
#define SFG_FPS 25 #define SFG_FPS 25
#define SFG_TEXTURE_DISTANCE 6000 //#define SFG_TEXTURE_DISTANCE 6000
#define SFG_SCREEN_RESOLUTION_X 110 #define SFG_SCREEN_RESOLUTION_X 110
#define SFG_SCREEN_RESOLUTION_Y 88 #define SFG_SCREEN_RESOLUTION_Y 88
#define SFG_RESOLUTION_SCALEDOWN 1 #define SFG_RESOLUTION_SCALEDOWN 1
@ -145,7 +145,7 @@ int main()
{ {
pokitto.begin(); pokitto.begin();
timerInit(8000); // timerInit(8000);
for (uint16_t i = 0; i < SFG_SFX_SAMPLE_COUNT; ++i) for (uint16_t i = 0; i < SFG_SFX_SAMPLE_COUNT; ++i)
audioBuff[i] = 127; audioBuff[i] = 127;

View File

@ -27,11 +27,11 @@
#define SFG_LOG(str) puts(str); #define SFG_LOG(str) puts(str);
#define SFG_START_LEVEL 8 #define SFG_START_LEVEL 6
#define SFG_IMMORTAL 1 #define SFG_IMMORTAL 1
// #define SFG_UNLOCK_DOOR 1 // #define SFG_UNLOCK_DOOR 1
#define SFG_REVEAL_MAP 1 #define SFG_REVEAL_MAP 1
#define SFG_INFINITE_AMMO 1 // #define SFG_INFINITE_AMMO 1
#include <stdio.h> #include <stdio.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
@ -330,7 +330,7 @@ int main(int argc, char *argv[])
for (int i = 0; i < SFG_SFX_SAMPLE_COUNT; ++i) for (int i = 0; i < SFG_SFX_SAMPLE_COUNT; ++i)
audioBuff[i] = 127; audioBuff[i] = 127;
// SDL_PauseAudio(0); SDL_PauseAudio(0);
running = 1; running = 1;

View File

@ -36,6 +36,11 @@ SFG_PROGRAM_MEMORY char *SFG_introText =
"only destroy, not suffer - it is not wrong to end them! You grab your gear " "only destroy, not suffer - it is not wrong to end them! You grab your gear "
"and run towards Macrochip HQ."; "and run towards Macrochip HQ.";
SFG_PROGRAM_MEMORY char *SFG_outroText =
"You killed the main computer, the world is saved! Thank you my friend. We "
"learned a lesson, never again allow capitalism and hierarchy. We can now "
"rebuild society in peaceful anarchy.";
#define SFG_MALWARE_WARNING "" #define SFG_MALWARE_WARNING ""
#if SFG_OS_IS_MALWARE #if SFG_OS_IS_MALWARE