Talk:Deathmatch start


TFOG sprite[edit]

Player starts (deathmatch or single/coop) do not have any associated mobj type. When a player respawns (in deathmatch or coop) and you see a TFOG sprite, it's not the player start that you see -- it's an MT_FOG mobj spawned at the same place, same as when a teleport happens. If you look at the map with the map cheat on, you can see there is an additional object spawned at the position of the player start. See G_CheckSpot in g_game.c.

<source lang=C>

boolean G_CheckSpot ( int playernum,

 mapthing_t*	mthing ) 


   fixed_t		x;
   fixed_t		y; 
   subsector_t*	ss; 
   unsigned		an; 
   mobj_t*		mo; 
   int			i;
   if (!players[playernum].mo)

// first spawn of level, before corpses for (i=0 ; i<playernum ; i++) if (players[i].mo->x == mthing->x << FRACBITS && players[i].mo->y == mthing->y << FRACBITS) return false; return true;

   x = mthing->x << FRACBITS; 
   y = mthing->y << FRACBITS; 
   if (!P_CheckPosition (players[playernum].mo, x, y) ) 

return false;

   // flush an old corpse if needed 
   if (bodyqueslot >= BODYQUESIZE) 

P_RemoveMobj (bodyque[bodyqueslot%BODYQUESIZE]);

   bodyque[bodyqueslot%BODYQUESIZE] = players[playernum].mo; 
   // spawn a teleport fog 
   ss = R_PointInSubsector (x,y); 
   an = ( ANG45 * (mthing->angle/45) ) >> ANGLETOFINESHIFT; 

   mo = P_SpawnMobj (x+20*finecosine[an], y+20*finesine[an] 

, ss->sector->floorheight , MT_TFOG);

   if (players[consoleplayer].viewz != 1) 

S_StartSound (mo, sfx_telept); // don't start sound on first frame

   return true; 

} </source>

This function is called by both G_DoReborn (used for respawning players in coop) and G_DeathMatchSpawnPlayer (which does what its name implies). Yeah, conceptually, the "check" function shouldn't do the corpse flushing, fog spawning, and sound playing stuff: if it's supposed to be a check function, it shouldn't have any side effect. At least it doesn't have any side effect when it returns false. Anyway, my point was that player starts are map things without a corresponding mobj (while players themselves are mobjs without a corresponding map thing) so the player starts are never seen. --Gez 10:11, 24 March 2014 (UTC)

Wow, thank you — I wouldn't have found that if I'd spent the rest of my life studying the code.  Actually, I'd have had no problem removing the sprite name without knowing every detail, as long as the articles were mutually consistent, but you've left no room for doubt now.    Ryan W 22:44, 24 March 2014 (UTC)