- fixed: air_finished was sometimes checked against level.time, sometimes against level.maptime.

For a per-level effect it needs to always check against level.maptime.
This commit is contained in:
Christoph Oelckers 2019-03-30 18:52:32 +01:00
parent 8a243cf084
commit f5ad144934
4 changed files with 6 additions and 6 deletions

View file

@ -1461,7 +1461,7 @@ class CommandDrawNumber : public CommandDrawString
if(statusBar->CPlayer->mo->waterlevel < 3)
num = primaryLevel->airsupply/TICRATE;
else
num = clamp<int>((statusBar->CPlayer->air_finished - primaryLevel->time + (TICRATE-1))/TICRATE, 0, INT_MAX);
num = clamp<int>((statusBar->CPlayer->air_finished - primaryLevel->maptime + (TICRATE-1))/TICRATE, 0, INT_MAX);
break;
}
case SELECTEDINVENTORY:
@ -2751,7 +2751,7 @@ class CommandDrawBar : public SBarInfoCommand
break;
}
case AIRTIME:
value = clamp<int>(statusBar->CPlayer->air_finished - primaryLevel->time, 0, INT_MAX);
value = clamp<int>(statusBar->CPlayer->air_finished - primaryLevel->maptime, 0, INT_MAX);
max = primaryLevel->airsupply;
break;
case POWERUPTIME:

View file

@ -5419,7 +5419,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
}
else
{
return Level->Players[args[0]]->air_finished - Level->time;
return Level->Players[args[0]]->air_finished - Level->maptime;
}
}
@ -5431,7 +5431,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
}
else
{
Level->Players[args[0]]->air_finished = args[1] + Level->time;
Level->Players[args[0]]->air_finished = args[1] + Level->maptime;
return 1;
}
}

View file

@ -4330,7 +4330,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
else if (oldlevel == 3 && waterlevel < 3)
{
// Our head just came up.
if (player->air_finished > Level->time)
if (player->air_finished > Level->maptime)
{
// We hadn't run out of air yet.
S_Sound(this, CHAN_VOICE, "*surface", 1, ATTN_NORM);

View file

@ -599,7 +599,7 @@ class BaseStatusBar native ui
if(CPlayer.mo.waterlevel < 3)
return Level.airsupply;
else
return max(CPlayer.air_finished - Level.time, 0);
return max(CPlayer.air_finished - Level.maptime, 0);
}
int GetSelectedInventoryAmount()