p_mobj.c
/*
============
=
= P_SpawnPlayer
=
= Called when a player is spawned on the level 
= Most of the player structure stays unchanged between levels
============
*/
P_SpawnPlayer
Called when a player is spawned on the level
Most of the player structure stays unchanged between levels
P_SpawnPlayer Called when a player is spawned on the level Most of the player structure stays unchanged between levels
void P_SpawnPlayer (mapthing_t *mthing)
{
	player_t	*p;
	fixed_t		x,y,z;
	mobj_t		*mobj;
	int	i;
	if (!playeringame[mthing->type-1])
		return;						
	p = &players[mthing->type-1];
	if (p->playerstate == PST_REBORN)
		G_PlayerReborn (mthing->type-1);
	x = mthing->x << FRACBITS;
	y = mthing->y << FRACBITS;
#if 0
if (mthing->type==1)
{
x = 0xffb00000;
y = 0xff500000;
}
#endif
	z = ONFLOORZ;
	mobj = P_SpawnMobj (x,y,z, MT_PLAYER);
	mobj->angle = ANG45 * (mthing->angle/45);
	mobj->player = p - players + 1;
	mobj->health = p->health;
	p->mo = mobj;
	p->playerstate = PST_LIVE;	
	p->refire = 0;
	p->message = NULL;
	p->damagecount = 0;
	p->bonuscount = 0;
	p->extralight = 0;
	p->viewheight = VIEWHEIGHT;
	P_SetupPsprites (p);		
	if (netgame == gt_deathmatch)
		for (i=0 ; i<NUMCARDS ; i++)
			p->cards[i] = true;		
}
void P_SpawnPlayer ( mapthing_t * mthing ) { player_t * p ; fixed_t x , y , z ; mobj_t * mobj ; int i ; if ( ! playeringame [ mthing -> type - 1 ] ) return ; p = & players [ mthing -> type - 1 ] ; if ( p -> playerstate == PST_REBORN ) G_PlayerReborn ( mthing -> type - 1 ) ; x = mthing -> x << FRACBITS ; y = mthing -> y << FRACBITS ; #if 0 if ( mthing -> type == 1 ) { x = 0xffb00000 ; y = 0xff500000 ; } #endif z = ONFLOORZ ; mobj = P_SpawnMobj ( x , y , z , MT_PLAYER ) ; mobj -> angle = ANG45 * ( mthing -> angle / 45 ) ; mobj -> player = p - players + 1 ; mobj -> health = p -> health ; p -> mo = mobj ; p -> playerstate = PST_LIVE ; p -> refire = 0 ; p -> message = NULL ; p -> damagecount = 0 ; p -> bonuscount = 0 ; p -> extralight = 0 ; p -> viewheight = VIEWHEIGHT ; P_SetupPsprites ( p ) ; if ( netgame == gt_deathmatch ) for ( i = 0 ; i < NUMCARDS ; i ++ ) p -> cards [ i ] = true ; }
P_SpawnPlayer
Called when a player is spawned on the level
Most of the player structure stays unchanged between levels
P_SpawnPlayer Called when a player is spawned on the level Most of the player structure stays unchanged between levels
/* not playing */ /* setup gun psprite	 */ /* give all cards in death match mode			 */