Fix a few bugs

This commit is contained in:
Miloslav Číž 2020-10-23 19:11:50 +02:00
parent 6437ebfe85
commit cbfacc49e8
5 changed files with 21 additions and 13 deletions

View File

@ -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?

4
game.h
View File

@ -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;

View File

@ -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;
}

View File

@ -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)
{

View File

@ -82,7 +82,9 @@
/**
How quickly player turns left/right, in degrees per second.
*/
#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