components/prboom/g_game.c
//
// G_PlayerReborn
// Called after a player dies
// almost everything is cleared and initialized
//
G_PlayerReborn
Called after a player dies
almost everything is cleared and initialized
G_PlayerReborn Called after a player dies almost everything is cleared and initialized
void G_PlayerReborn (int player)
{
  player_t *p;
  int i;
  int frags[MAXPLAYERS];
  int killcount;
  int itemcount;
  int secretcount;
  memcpy (frags, players[player].frags, sizeof frags);
  killcount = players[player].killcount;
  itemcount = players[player].itemcount;
  secretcount = players[player].secretcount;
  p = &players[player];
  {
    int cheats = p->cheats;
    memset (p, 0, sizeof(*p));
    p->cheats = cheats;
  }
  memcpy(players[player].frags, frags, sizeof(players[player].frags));
  players[player].killcount = killcount;
  players[player].itemcount = itemcount;
  players[player].secretcount = secretcount;
  p->usedown = p->attackdown = true;  
  p->playerstate = PST_LIVE;
  p->health = initial_health;  
  p->readyweapon = p->pendingweapon = wp_pistol;
  p->weaponowned[wp_fist] = true;
  p->weaponowned[wp_pistol] = true;
  p->ammo[am_clip] = initial_bullets; 
  for (i=0 ; i<NUMAMMO ; i++)
    p->maxammo[i] = maxammo[i];
}
void G_PlayerReborn ( int player ) { player_t * p ; int i ; int frags [ MAXPLAYERS ] ; int killcount ; int itemcount ; int secretcount ; memcpy ( frags , players [ player ] . frags , sizeof frags ) ; killcount = players [ player ] . killcount ; itemcount = players [ player ] . itemcount ; secretcount = players [ player ] . secretcount ; p = & players [ player ] ; { int cheats = p -> cheats ; memset ( p , 0 , sizeof ( * p ) ) ; p -> cheats = cheats ; } memcpy ( players [ player ] . frags , frags , sizeof ( players [ player ] . frags ) ) ; players [ player ] . killcount = killcount ; players [ player ] . itemcount = itemcount ; players [ player ] . secretcount = secretcount ; p -> usedown = p -> attackdown = true ; p -> playerstate = PST_LIVE ; p -> health = initial_health ; p -> readyweapon = p -> pendingweapon = wp_pistol ; p -> weaponowned [ wp_fist ] = true ; p -> weaponowned [ wp_pistol ] = true ; p -> ammo [ am_clip ] = initial_bullets ; for ( i = 0 ; i < NUMAMMO ; i ++ ) p -> maxammo [ i ] = maxammo [ i ] ; }
G_PlayerReborn
Called after a player dies
almost everything is cleared and initialized
G_PlayerReborn Called after a player dies almost everything is cleared and initialized
// killough 3/10/98,3/21/98: preserve cheats across idclev // don't do anything immediately // Ty 03/12/98 - use dehacked values // Ty 03/12/98 - use dehacked values