Sign in to follow this  
Followers 0

bugfix

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.

   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:
   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():
   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.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0