r567 Spectator check
This bug is for the recently committed spectator code. If you see any spectator-related problems, feel free to comment in this bug. One bug I can't figure out how to solve is an obvious one (when playing): Spectators joining the game will show WHERE the joined by a corpse dying at their location. It would be pretty funny to see someone freaking out because a corpse died in front of him, but it's not supposed to happen.
About crushers crushing specs spewing blood everywhere and the crushers being slowed, adding the following to common/p_map.cc:1774 seems to fix it (in PIT_ChangeSector) ================================================================================ // GhostlyDeath -- if it's a spectator, keep checking if (thing->player && thing->player->spectator) return true; ================================================================================
(In reply to comment #1) > About crushers crushing specs spewing blood everywhere and the crushers being > slowed, adding the following to common/p_map.cc:1774 seems to fix it (in > PIT_ChangeSector) > > ================================================================================ > // GhostlyDeath -- if it's a spectator, keep checking > if (thing->player && thing->player->spectator) > return true; > ================================================================================ > Fix r569. Thanks.
Fixed the body bug, hopefully I didn't screw up when I made the patch... ================================================================================ diff -u -r client/src/p_interaction.cpp client/src/p_interaction.cpp --- client/src/p_interaction.cpp 2008-04-14 04:07:20.000000000 -0400 +++ client/src/p_interaction.cpp 2008-04-14 03:48:34.000000000 -0400 @@ -992,6 +992,10 @@ target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); + // GhostlyDeath -- Joinkill is only set on players, so we should be safe! + if (joinkill) + target->flags |= MF_SPECTATOR; + if (target->type != MT_SKULL) target->flags &= ~MF_NOGRAVITY; diff -u -r client/src/p_mobj.cpp client/src/p_mobj.cpp --- client/src/p_mobj.cpp 2008-04-14 04:07:21.000000000 -0400 +++ client/src/p_mobj.cpp 2008-04-14 03:42:08.000000000 -0400 @@ -775,6 +775,10 @@ { if(!subsector) return; + + // GhostlyDeath -- Was a spectator but now it's nothing! + if ((this->flags & MF_SPECTATOR ) && !player) + P_SetMobjState(this, S_NULL); // [RH] Fade a stealth monster in and out of visibility if (visdir > 0) @@ -1115,7 +1119,7 @@ P_SetupPsprites (p); if (p->spectator) - p->mo->flags |= MF_INVISIBLE; + p->mo->flags |= MF_SPECTATOR; // give all cards in death match mode if (deathmatch) diff -u -r client/src/r_things.cpp client/src/r_things.cpp --- client/src/r_things.cpp 2008-04-14 04:07:20.000000000 -0400 +++ client/src/r_things.cpp 2008-04-14 03:38:51.000000000 -0400 @@ -683,7 +683,7 @@ // [RH] Tutti-Frutti fix (also allows sprites up to 256 pixels tall) dc_mask = 0xff; - if (vis->mobjflags & MF_INVISIBLE) + if (vis->mobjflags & MF_SPECTATOR) return; if (vis->patch == -1) diff -u -r common/actor.h common/actor.h --- common/actor.h 2008-04-14 04:06:59.000000000 -0400 +++ common/actor.h 2008-04-14 03:35:56.000000000 -0400 @@ -197,8 +197,8 @@ // use a translation table for player colormaps MF_TRANSLATION = 0xc000000, - // GhostlyDeath -- thing is invisible and can't be seen! - MF_INVISIBLE = 0x40000000, + // GhostlyDeath -- thing is/was a spectator and can't be seen! + MF_SPECTATOR = 0x40000000, // a frozen corpse (for blasting) [RH] was 0x800000 MF_ICECORPSE = 0x80000000 diff -u -r common/p_map.cpp common/p_map.cpp --- common/p_map.cpp 2008-04-14 04:06:59.000000000 -0400 +++ common/p_map.cpp 2008-04-14 03:38:46.000000000 -0400 @@ -399,7 +399,7 @@ if (thing == tmthing) return true; - if (thing->flags & MF_INVISIBLE) + if (thing->flags & MF_SPECTATOR) return true; if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_SHOOTABLE)) ) diff -u -r server/src/p_interaction.cpp server/src/p_interaction.cpp --- server/src/p_interaction.cpp 2008-04-14 04:07:08.000000000 -0400 +++ server/src/p_interaction.cpp 2008-04-14 03:48:22.000000000 -0400 @@ -954,6 +954,10 @@ AActor *mo; target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); + + // GhostlyDeath -- Joinkill is only set on players, so we should be safe! + if (joinkill) + target->flags |= MF_SPECTATOR; if (target->type != MT_SKULL) target->flags &= ~MF_NOGRAVITY; diff -u -r server/src/p_mobj.cpp server/src/p_mobj.cpp --- server/src/p_mobj.cpp 2008-04-14 04:07:08.000000000 -0400 +++ server/src/p_mobj.cpp 2008-04-14 03:41:57.000000000 -0400 @@ -781,6 +781,10 @@ { if (type == MT_PLAYER && health <= 0) deadtic++; + + // GhostlyDeath -- Was a spectator but now it's nothing! + if ((this->flags & MF_SPECTATOR ) && !player) + P_SetMobjState(this, S_NULL); // remove dead players but don't tell clients about it if (type == MT_PLAYER && !player && deadtic >= REMOVECOPRSESTIC) @@ -1145,7 +1149,7 @@ } if (p->spectator) - p->mo->flags |= MF_INVISIBLE; + p->mo->flags |= MF_SPECTATOR; if(serverside) { diff -u -r server/src/sv_main.cpp server/src/sv_main.cpp --- server/src/sv_main.cpp 2008-04-14 04:07:08.000000000 -0400 +++ server/src/sv_main.cpp 2008-04-14 03:57:09.000000000 -0400 @@ -973,6 +973,8 @@ ok = true; else if(!mo->player) ok = true; + else if (mo->flags & MF_SPECTATOR) // GhostlyDeath -- Spectating things + ok = false; else if(player.mo && mo->player && mo->player->spectator) ok = false; else if(player.mo && mo->player && SV_IsTeammate(player, *mo->player)) @@ -1045,7 +1047,10 @@ // bool SV_IsPlayerAllowedToSee(player_t &p, AActor *mo) { - return std::find(mo->players_aware.begin(), mo->players_aware.end(), p.id) != mo->players_aware.end(); + if (mo->flags & MF_SPECTATOR) + return false; // GhostlyDeath -- always false, as usual! + else + return std::find(mo->players_aware.begin(), mo->players_aware.end(), p.id) != mo->players_aware.end(); } #define HARDWARE_CAPABILITY 1000 ================================================================================
Please make it an attachment of the bug.. don't post it directly in here. Also, spectator breaks demos in singleplayer
(In reply to comment #3) > Fixed the body bug, hopefully I didn't screw up when I made the patch... > > ================================================================================ > STUFF > ================================================================================ > Looks like you didn't screw up. (But please upload patches rather than posting it here) Fix r572.
reassigning to Nes
marking fixed