Use enums for swngame

This replaces the swngame int variable with a named enum and enforces
strict typechecking on it.

Strict typechecking is okay here as the swngame variable is not part of
the API surface of the game in any way and is completely internal.

And just to make things clear, I've added a SWN_NONE enum to use for
initialization, because previously it was being initialized to 0, even
though 0 was the Gravitron.
This commit is contained in:
Misa
2023-06-04 23:24:31 -07:00
parent 414b0647aa
commit 14d034e4c6
8 changed files with 66 additions and 44 deletions

View File

@@ -316,7 +316,7 @@ void Game::init(void)
inertia = 1.1f;
swnmode = false;
swntimer = 0;
swngame = 0;//Not playing sine wave ninja!
swngame = SWN_NONE; // Not playing sine wave ninja!
swnstate = 0;
swnstate2 = 0;
swnstate3 = 0;
@@ -943,7 +943,7 @@ void Game::updatestate(void)
obj.removetrigger(9);
swnmode = true;
swngame = 6;
swngame = SWN_START_SUPERGRAVITRON_STEP_1;
swndelay = 150;
swntimer = 60 * 30;
@@ -964,7 +964,7 @@ void Game::updatestate(void)
obj.removetrigger(10);
swnmode = true;
swngame = 4;
swngame = SWN_START_GRAVITRON_STEP_1;
swndelay = 150;
swntimer = 60 * 30;
@@ -7479,7 +7479,9 @@ bool Game::incompetitive(void)
return (
!map.custommode
&& swnmode
&& (swngame == 1 || swngame == 6 || swngame == 7)
&& (swngame == SWN_SUPERGRAVITRON ||
swngame == SWN_START_SUPERGRAVITRON_STEP_1 ||
swngame == SWN_START_SUPERGRAVITRON_STEP_2)
)
|| intimetrial
|| nodeathmode;