diff --git a/src/cdogs/emitter.c b/src/cdogs/emitter.c index cefb43709..fecc03439 100644 --- a/src/cdogs/emitter.c +++ b/src/cdogs/emitter.c @@ -29,12 +29,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "game_events.h" - void EmitterInit( Emitter *em, const ParticleClass *p, const struct vec2 offset, - const float minSpeed, const float maxSpeed, - const int minDZ, const int maxDZ, - const double minRotation, const double maxRotation, + const float minSpeed, const float maxSpeed, const int minDZ, + const int maxDZ, const double minRotation, const double maxRotation, const int ticksPerEmit) { memset(em, 0, sizeof *em); @@ -62,8 +60,8 @@ void EmitterStart(Emitter *em, const AddParticle *data) e.u.AddParticle.Class = em->p; } const float speed = RAND_FLOAT(em->minSpeed, em->maxSpeed); - const struct vec2 baseVel = svec2_rotate( - svec2(0, speed), RAND_FLOAT(0, MPI * 2)); + const struct vec2 baseVel = + svec2_rotate(svec2(0, speed), RAND_FLOAT(0, MPI * 2)); e.u.AddParticle.Vel = svec2_add(data->Vel, baseVel); if (isnan(data->Angle)) { @@ -71,9 +69,10 @@ void EmitterStart(Emitter *em, const AddParticle *data) } e.u.AddParticle.DZ = RAND_FLOAT(em->minDZ, em->maxDZ); e.u.AddParticle.Spin = RAND_DOUBLE(em->minRotation, em->maxRotation); - if (strlen(e.u.AddParticle.Text) == 0 && em->p->Type == PARTICLE_TEXT) + if (strlen(e.u.AddParticle.Text) == 0 && + e.u.AddParticle.Class->Type == PARTICLE_TEXT) { - strcpy(e.u.AddParticle.Text, em->p->u.Text.Value); + strcpy(e.u.AddParticle.Text, e.u.AddParticle.Class->u.Text.Value); } GameEventsEnqueue(&gGameEvents, e); } diff --git a/src/game.c b/src/game.c index e026205d8..210830751 100644 --- a/src/game.c +++ b/src/game.c @@ -352,16 +352,7 @@ static void RunGameInput(GameLoopData *data) // or the last frame data->SkipNextFrame = data->SuperhotMode && !lastCmdAll; - // Don't show map if pause menu is shown - if (PauseMenuIsShown(&rData->pm)) - { - rData->isMap = false; - // Clear all user inputs if we're using the pause menu - memset(rData->cmds, 0, sizeof rData->cmds); - memset(rData->lastCmds, 0, sizeof rData->lastCmds); - KeyLockKeys(&gEventHandlers.keyboard); - JoyLock(&gEventHandlers.joysticks); - } + const bool wasPaused = PauseMenuIsShown(&rData->pm); // Update and check if we want to quit if (PauseMenuUpdate(&rData->pm, rData->cmds, rData->lastCmds)) @@ -385,6 +376,23 @@ static void RunGameInput(GameLoopData *data) &gSoundDevice, StrSound(rData->isMap ? "map_open" : "map_close")); } + if (wasPaused) + { + // Clear all user inputs if we're using the pause menu + memset(rData->cmds, 0, sizeof rData->cmds); + memset(rData->lastCmds, 0, sizeof rData->lastCmds); + KeyLockKeys(&gEventHandlers.keyboard); + JoyLock(&gEventHandlers.joysticks); + } + } + + if (!wasPaused && PauseMenuIsShown(&rData->pm)) + { + // Don't show map if pause menu is shown + rData->isMap = false; + // Clear all user inputs if we're using the pause menu + memset(rData->cmds, 0, sizeof rData->cmds); + memset(rData->lastCmds, 0, sizeof rData->lastCmds); } CameraInput(&rData->Camera, rData->cmds[0], rData->lastCmds[0]);