Anders
No one knows I'm schepe

Posts: 427
Registered: 03-02 |
Quasar, i decided to have a look at that bug we talked about.
After lots of tracking and comparing with linux doom's sources i found the cause, and a possible solution.
this is the code in G_DoLoadLevel() that makes sure the player get a fresh (ie. pistol, 100% health) start if he enters the level dead.
code: for(i = 0; i < MAXPLAYERS; i++)
{
if(playeringame[i] && players[i].playerstate == PST_DEAD)
players[i].playerstate = PST_REBORN;
memset(players[i].frags, 0, sizeof(players[i].frags));
}
this doesn't work in eternity, because it calls P_SetupLevel() BEFORE this code, while linux doom calls P_SetupLevel() AFTER this code.
P_SetupLevel() calls P_SpawnPlayer() which does this:
code: if(p->playerstate == PST_REBORN)
G_PlayerReborn(mthing->type - 1);
but in eternity playerstate will be PST_DEAD when it enters P_SpawnPlayer and thus the player isn't given the pistol and health.
further down in P_SpawnPlayer():
code: p->playerstate = PST_LIVE;
So, the playerstate will just be set from PST_DEAD to PST_LIVE without the player being given the pistol and health.
The obvious solution is to move the call to P_SetupLevel (in G_DoLoadLevel() ) so it'll get called after the code above, or will that that cause other problems?
I tried this, and the testdemo i had erik make worked fine.
__________________
++++++++++[>++++++++++>++++++++++++>+++++++++++>++
+>+<<<<<-]>.>-.>>++.<<<++.>>+.+++.<--.>-----.+++++
+.>.<<<-----.>>-.<<++++.>>>.<<<++.------.>++++.>>>.
Last edited by Anders on 12-27-03 at 07:26
|