mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- moved the main game ticker out of app_main.
This commit is contained in:
parent
3a3ba43985
commit
5ba384db35
2 changed files with 52 additions and 42 deletions
|
@ -528,6 +528,56 @@ void GameMove(void)
|
|||
moveframes--;
|
||||
}
|
||||
|
||||
|
||||
void GameTicker()
|
||||
{
|
||||
while ((totalclock - ototalclock) >= 1 || !bInMove)
|
||||
{
|
||||
ototalclock = ototalclock + 1;
|
||||
|
||||
if (!((int)ototalclock & 3) && moveframes < 4)
|
||||
moveframes++;
|
||||
|
||||
GetLocalInput();
|
||||
PlayerInterruptKeys();
|
||||
|
||||
nPlayerDAng = fix16_sadd(nPlayerDAng, localInput.nAngle);
|
||||
inita &= kAngleMask;
|
||||
|
||||
lPlayerXVel += localInput.yVel * Cos(inita) + localInput.xVel * Sin(inita);
|
||||
lPlayerYVel += localInput.yVel * Sin(inita) - localInput.xVel * Cos(inita);
|
||||
lPlayerXVel -= (lPlayerXVel >> 5) + (lPlayerXVel >> 6);
|
||||
lPlayerYVel -= (lPlayerYVel >> 5) + (lPlayerYVel >> 6);
|
||||
|
||||
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
||||
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
|
||||
sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes;
|
||||
sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng;
|
||||
sPlayerInput[nLocalPlayer].nTarget = besttarget;
|
||||
|
||||
Ra[nLocalPlayer].nTarget = besttarget;
|
||||
|
||||
lLocalCodes = 0;
|
||||
nPlayerDAng = 0;
|
||||
|
||||
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
|
||||
|
||||
while (!EndLevel && totalclock >= tclocks + 4)
|
||||
{
|
||||
tclocks += 4;
|
||||
GameMove();
|
||||
}
|
||||
}
|
||||
if (nPlayerLives[nLocalPlayer] <= 0) {
|
||||
//startmainmenu();
|
||||
}
|
||||
#if 0
|
||||
if (!bInDemo && levelnew > nBestLevel && levelnew != 0 && levelnew <= kMap20 && SavePosition > -1) {
|
||||
menu_GameSave(SavePosition);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
int32_t r_maxfpsoffset = 0;
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ void DoTitle(CompletionFunc completion);
|
|||
void ResetEngine();
|
||||
void CheckKeys();
|
||||
void CheckKeys2();
|
||||
void GameTicker();
|
||||
|
||||
void FinishLevel()
|
||||
{
|
||||
|
@ -436,49 +437,8 @@ GAMELOOP:
|
|||
}
|
||||
else
|
||||
{
|
||||
while ((totalclock - ototalclock) >= 1 || !bInMove)
|
||||
{
|
||||
ototalclock = ototalclock + 1;
|
||||
|
||||
if (!((int)ototalclock&3) && moveframes < 4)
|
||||
moveframes++;
|
||||
|
||||
GetLocalInput();
|
||||
PlayerInterruptKeys();
|
||||
|
||||
nPlayerDAng = fix16_sadd(nPlayerDAng, localInput.nAngle);
|
||||
inita &= kAngleMask;
|
||||
|
||||
lPlayerXVel += localInput.yVel * Cos(inita) + localInput.xVel * Sin(inita);
|
||||
lPlayerYVel += localInput.yVel * Sin(inita) - localInput.xVel * Cos(inita);
|
||||
lPlayerXVel -= (lPlayerXVel >> 5) + (lPlayerXVel >> 6);
|
||||
lPlayerYVel -= (lPlayerYVel >> 5) + (lPlayerYVel >> 6);
|
||||
|
||||
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
||||
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
|
||||
sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes;
|
||||
sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng;
|
||||
sPlayerInput[nLocalPlayer].nTarget = besttarget;
|
||||
|
||||
Ra[nLocalPlayer].nTarget = besttarget;
|
||||
|
||||
lLocalCodes = 0;
|
||||
nPlayerDAng = 0;
|
||||
|
||||
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
|
||||
|
||||
while (levelnew < 0 && totalclock >= tclocks + 4)
|
||||
{
|
||||
tclocks += 4;
|
||||
GameMove();
|
||||
if (EndLevel)
|
||||
{
|
||||
goto getoutofhere;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTicker();
|
||||
}
|
||||
getoutofhere:
|
||||
bInMove = false;
|
||||
|
||||
PlayerInterruptKeys();
|
||||
|
|
Loading…
Reference in a new issue