Bug Tracker – Attachment #494: don't set spectator flags on a dead player object for bug #1071

View | Details | Raw Unified | Return to bug 1071
Collapse All | Expand All

(-)client/src/cl_mobj.cpp (-1 / +5 lines)
Lines 76-82 Link Here
76
	if (p->playerstate == PST_REBORN || p->playerstate == PST_ENTER)
76
	if (p->playerstate == PST_REBORN || p->playerstate == PST_ENTER)
77
		G_PlayerReborn (*p);
77
		G_PlayerReborn (*p);
78
78
79
	AActor *mobj = new AActor (mthing->x << FRACBITS, mthing->y << FRACBITS, ONFLOORZ, MT_PLAYER);
79
	AActor *mobj;
80
	if (player.deadspectator)
81
		mobj = new AActor (p->mo->x, p->mo->y, ONFLOORZ, MT_PLAYER);
82
	else
83
		mobj = new AActor (mthing->x << FRACBITS, mthing->y << FRACBITS, ONFLOORZ, MT_PLAYER);
80
84
81
	// set color translations for player sprites
85
	// set color translations for player sprites
82
	// [RH] Different now: MF_TRANSLATION is not used.
86
	// [RH] Different now: MF_TRANSLATION is not used.
(-)client/src/g_game.cpp (-1 / +1 lines)
Lines 1200-1206 Link Here
1200
		return false;
1200
		return false;
1201
1201
1202
	// spawn a teleport fog
1202
	// spawn a teleport fog
1203
	if (!player.spectator)	// ONLY IF THEY ARE NOT A SPECTATOR
1203
	if (!player.spectator && !player.deadspectator)	// ONLY IF THEY ARE NOT A SPECTATOR
1204
	{
1204
	{
1205
		// emulate out-of-bounds access to finecosine / finesine tables
1205
		// emulate out-of-bounds access to finecosine / finesine tables
1206
		// which cause west-facing player spawns to have the spawn-fog
1206
		// which cause west-facing player spawns to have the spawn-fog
(-)common/d_player.h (+1 lines)
Lines 234-239 Link Here
234
234
235
	byte spying;				// [SL] id of player being spynext'd by this player
235
	byte spying;				// [SL] id of player being spynext'd by this player
236
	bool spectator;             // [GhostlyDeath] spectating?
236
	bool spectator;             // [GhostlyDeath] spectating?
237
	bool deadspectator;			// [tm512] spectating as a dead player?
237
	int joinafterspectatortime; // Nes - Join after spectator time.
238
	int joinafterspectatortime; // Nes - Join after spectator time.
238
	int timeout_callvote;       // [AM] Tic when a vote last finished.
239
	int timeout_callvote;       // [AM] Tic when a vote last finished.
239
	int timeout_vote;           // [AM] Tic when a player last voted.
240
	int timeout_vote;           // [AM] Tic when a player last voted.
(-)server/src/g_game.cpp (-1 / +1 lines)
Lines 467-473 Link Here
467
		return false;
467
		return false;
468
468
469
	// spawn a teleport fog
469
	// spawn a teleport fog
470
	if (!player.spectator)	// ONLY IF THEY ARE NOT A SPECTATOR
470
	if (!player.spectator && !player.deadspectator)	// ONLY IF THEY ARE NOT A SPECTATOR
471
	{
471
	{
472
		// emulate out-of-bounds access to finecosine / finesine tables
472
		// emulate out-of-bounds access to finecosine / finesine tables
473
		// which cause west-facing player spawns to have the spawn-fog
473
		// which cause west-facing player spawns to have the spawn-fog
(-)server/src/sv_main.cpp (+9 lines)
Lines 3687-3692 Link Here
3687
			CTF_CheckFlags(player);
3687
			CTF_CheckFlags(player);
3688
		}
3688
		}
3689
3689
3690
		// [tm512 2014/04/18] Avoid setting spectator flags on a dead player
3691
		// Instead we respawn the player, move him back, and immediately spectate him afterwards
3692
		if (player.playerstate == PST_DEAD)
3693
		{
3694
			player.deadspectator = true; // prevent teleport fog
3695
			G_DoReborn (player);
3696
			player.deadspectator = false;
3697
		}
3698
3690
		player.spectator = true;
3699
		player.spectator = true;
3691
3700
3692
		// [AM] Set player unready if we're in warmup mode.
3701
		// [AM] Set player unready if we're in warmup mode.
(-)server/src/sv_mobj.cpp (-2 / +11 lines)
Lines 82-94 Link Here
82
	if (p->playerstate == PST_REBORN || p->playerstate == PST_ENTER)
82
	if (p->playerstate == PST_REBORN || p->playerstate == PST_ENTER)
83
		G_PlayerReborn (*p);
83
		G_PlayerReborn (*p);
84
84
85
	AActor *mobj = new AActor (mthing->x << FRACBITS, mthing->y << FRACBITS, ONFLOORZ, MT_PLAYER);
85
	AActor *mobj;
86
	if (player.deadspectator)
87
		mobj = new AActor (p->mo->x, p->mo->y, ONFLOORZ, MT_PLAYER);
88
	else
89
		mobj = new AActor (mthing->x << FRACBITS, mthing->y << FRACBITS, ONFLOORZ, MT_PLAYER);
86
90
87
	// set color translations for player sprites
91
	// set color translations for player sprites
88
	// [RH] Different now: MF_TRANSLATION is not used.
92
	// [RH] Different now: MF_TRANSLATION is not used.
89
	//		  mobj->translation = translationtables + 256*playernum;
93
	//		  mobj->translation = translationtables + 256*playernum;
90
94
91
	mobj->angle = ANG45 * (mthing->angle/45);
95
	// retain old angle
96
	if (player.deadspectator)
97
		mobj->angle = player.mo->angle;
98
	else
99
		mobj->angle = ANG45 * (mthing->angle/45);
100
92
	mobj->pitch = 0;
101
	mobj->pitch = 0;
93
	mobj->player = p;
102
	mobj->player = p;
94
	mobj->health = p->health;
103
	mobj->health = p->health;

Return to bug 1071