diff --git a/TODO.txt b/TODO.txt index 177fa04..67ede68 100644 --- a/TODO.txt +++ b/TODO.txt @@ -131,9 +131,6 @@ level ideas: bugs: -- At the beginning "FPS cant be reached" is always displayed. -- Even if music is off, after turning on a few samples are played (also on - Pokitto). - On Pokitto/GB Meta sometimes after turn on the game starts midway loading the first level. @@ -216,6 +213,9 @@ done: near door. If this can't be prevented completely, automatically unstuck the player into a playable area. - Try to recolor textures and give them a bit more of variety. +- Even if music is off, after turning on a few samples are played (also on + Pokitto). +- At the beginning "FPS cant be reached" is always displayed. scratched: - option for disabling wall transparency, for performance? diff --git a/game.h b/game.h index 4f00556..d3599cb 100755 --- a/game.h +++ b/game.h @@ -4796,6 +4796,8 @@ uint8_t SFG_mainLoopBody() { uint8_t steps = 0; + uint8_t wasFirstFrame = SFG_game.frame == 0; + while (timeSinceLastFrame >= SFG_MS_PER_FRAME) { uint8_t previousWeapon = SFG_player.weapon; @@ -4813,7 +4815,7 @@ uint8_t SFG_mainLoopBody() steps++; } - if ((steps > 1) && (SFG_game.antiSpam == 0)) + if ((steps > 1) && (SFG_game.antiSpam == 0) && (!wasFirstFrame)) { SFG_LOG("failed to reach target FPS! consider setting a lower value") SFG_game.antiSpam = 30; diff --git a/main_pokitto.cpp b/main_pokitto.cpp index ca78879..c4d7e80 100644 --- a/main_pokitto.cpp +++ b/main_pokitto.cpp @@ -24,6 +24,7 @@ #define SFG_FPS 22 #define SFG_CAN_EXIT 0 +#define SFG_PLAYER_TURN_SPEED 135 //#define SFG_TEXTURE_DISTANCE 6000 #ifndef JOYHAT @@ -104,11 +105,17 @@ void SFG_getMouseOffset(int16_t *x, int16_t *y) uint8_t audioBuff[SFG_SFX_SAMPLE_COUNT]; uint16_t audioPos = 0; -uint8_t musicOn = 1; +uint8_t musicOn = 0; -void SFG_enableMusic(uint8_t enable) +void SFG_setMusic(uint8_t value) { - musicOn = enable; + switch (value) + { + case SFG_MUSIC_TURN_ON: musicOn = 1; break; + case SFG_MUSIC_TURN_OFF: musicOn = 0; break; + case SFG_MUSIC_NEXT: SFG_nextMusicTrack(); break; + defaule: break; + } } static inline uint8_t mixSamples(uint8_t sample1, uint8_t sample2) @@ -217,12 +224,8 @@ int main() SFG_init(); while (pokitto.isRunning()) - { if (pokitto.update()) - { SFG_mainLoopBody(); - } - } return 0; } diff --git a/main_sdl.c b/main_sdl.c index 9bb7f30..094e411 100644 --- a/main_sdl.c +++ b/main_sdl.c @@ -305,7 +305,8 @@ static inline int16_t mixSamples(int16_t sample1, int16_t sample2) return sample1 + sample2; } -uint8_t musicOn = 1; +uint8_t musicOn = 0; +// ^ this has to be init to 0 (not 1), else a few samples get played at start void audioFillCallback(void *userdata, uint8_t *s, int l) { diff --git a/settings.h b/settings.h index 790dc3c..98de913 100644 --- a/settings.h +++ b/settings.h @@ -82,7 +82,9 @@ /** How quickly player turns left/right, in degrees per second. */ -#define SFG_PLAYER_TURN_SPEED 180 +#ifndef SFG_PLAYER_TURN_SPEED + #define SFG_PLAYER_TURN_SPEED 180 +#endif /** Distance, in RCL_Units, to which textures will be drawn. Textures behind this