Fix a level load bug

This commit is contained in:
Miloslav Číž 2020-10-24 13:46:25 +02:00
parent a03690a326
commit ec91af35ca
4 changed files with 34 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

3
game.h
View File

@ -3729,7 +3729,10 @@ void SFG_gameStepMenu()
SFG_game.save[i] = 0; SFG_game.save[i] = 0;
if (SFG_game.selectedLevel == 0) if (SFG_game.selectedLevel == 0)
{
SFG_currentLevel.levelNumber = 0; // to draw intro, not outro
SFG_setGameState(SFG_GAME_STATE_INTRO); SFG_setGameState(SFG_GAME_STATE_INTRO);
}
else else
SFG_setAndInitLevel(SFG_game.selectedLevel); SFG_setAndInitLevel(SFG_game.selectedLevel);

View File

@ -1369,7 +1369,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level7 =
13, // doorTextureIndex 13, // doorTextureIndex
4, // floorColor 4, // floorColor
66, // ceilingColor 66, // ceilingColor
{8 , 50, 240}, // player start: x, y, direction {34, 11, 240}, // player start: x, y, direction
1, // backgroundImage 1, // backgroundImage
{ // elements { // elements
{SFG_LEVEL_ELEMENT_FINISH, {60,1}},{SFG_LEVEL_ELEMENT_BULLETS, {54,1}}, {SFG_LEVEL_ELEMENT_FINISH, {60,1}},{SFG_LEVEL_ELEMENT_BULLETS, {54,1}},
@ -1438,6 +1438,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level7 =
{SFG_LEVEL_ELEMENT_NONE, {0,0}},{SFG_LEVEL_ELEMENT_NONE, {0,0}} {SFG_LEVEL_ELEMENT_NONE, {0,0}},{SFG_LEVEL_ELEMENT_NONE, {0,0}}
}, // elements }, // elements
} // level } // level
; ;
SFG_PROGRAM_MEMORY SFG_Level SFG_level8 = SFG_PROGRAM_MEMORY SFG_Level SFG_level8 =

View File

@ -36,6 +36,7 @@
// uncomment for perfomance debug // uncomment for perfomance debug
//#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent); //#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
#ifndef __EMSCRIPTEN__
#ifndef GAME_LQ #ifndef GAME_LQ
// higher quality // higher quality
#define SFG_FPS 60 #define SFG_FPS 60
@ -57,6 +58,18 @@
#define SFG_DITHERED_SHADOW 0 #define SFG_DITHERED_SHADOW 0
#define SFG_BACKGROUND_BLUR 0 #define SFG_BACKGROUND_BLUR 0
#endif #endif
#else
// emscripten
#define SFG_FPS 30
#define SFG_SCREEN_RESOLUTION_X 512
#define SFG_SCREEN_RESOLUTION_Y 320
#define SFG_CAN_EXIT 0
#define SFG_RESOLUTION_SCALEDOWN 2
#define SFG_BACKGROUND_BLUR 0
#include <emscripten.h>
#endif
// #define SFG_SCREEN_RESOLUTION_X 88 // #define SFG_SCREEN_RESOLUTION_X 88
// #define SFG_SCREEN_RESOLUTION_Y 110 // #define SFG_SCREEN_RESOLUTION_Y 110
@ -72,15 +85,6 @@
#define MUSIC_VOLUME 16 #define MUSIC_VOLUME 16
#ifdef __EMSCRIPTEN__
#define SFG_FPS 30
#define SFG_SCREEN_RESOLUTION_X 512
#define SFG_SCREEN_RESOLUTION_Y 320
#define SFG_CAN_EXIT 0
#define SFG_RESOLUTION_SCALEDOWN 2
#include <emscripten.h>
#endif
#if !SFG_OS_IS_MALWARE #if !SFG_OS_IS_MALWARE
#include <signal.h> #include <signal.h>