From fd43740b94137503a58bc4819a83c616ad660c0d Mon Sep 17 00:00:00 2001 From: James Haley Date: Fri, 24 Sep 2010 02:12:18 +0000 Subject: Implementation of teleflags for EV_Teleport. Fix to somewhat serious bug that let 0-damage tracers pass through walls. Other changes are only comments or formatting. Subversion-branch: /branches/strife-branch Subversion-revision: 2132 --- src/strife/p_map.c | 6 +- src/strife/p_maputl.c | 2 + src/strife/p_mobj.c | 5 +- src/strife/p_spec.c | 33 +++++------ src/strife/p_spec.h | 24 +++++++- src/strife/p_telept.c | 151 +++++++++++++++++++++++++++----------------------- 6 files changed, 125 insertions(+), 96 deletions(-) diff --git a/src/strife/p_map.c b/src/strife/p_map.c index e4b00eac..44f12689 100644 --- a/src/strife/p_map.c +++ b/src/strife/p_map.c @@ -1140,10 +1140,10 @@ hitline: P_SpawnPuff(x, y, z); // Spawn bullet puffs. else P_SpawnMobj(x, y, z, MT_STRIFEPUFF3); - - // don't go any farther - return false; } + + // don't go any farther + return false; } // shoot a thing diff --git a/src/strife/p_maputl.c b/src/strife/p_maputl.c index 4ab5d1d5..4cf681fe 100644 --- a/src/strife/p_maputl.c +++ b/src/strife/p_maputl.c @@ -685,6 +685,8 @@ boolean PIT_AddThingIntercepts (mobj_t* thing) // P_TraverseIntercepts // Returns true if the traverser function returns true // for all lines. +// +// [STRIFE] Verified unmodified. // boolean P_TraverseIntercepts diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c index d52669de..6f4cd774 100644 --- a/src/strife/p_mobj.c +++ b/src/strife/p_mobj.c @@ -987,12 +987,13 @@ P_SpawnPuff // // P_SpawnSparkPuff +// // villsa [STRIFE] new function // - mobj_t* P_SpawnSparkPuff(fixed_t x, fixed_t y, fixed_t z) { - return P_SpawnMobj(x, y, ((P_Random() - P_Random()) << 10) + z, MT_SPARKPUFF); + int t = P_Random(); + return P_SpawnMobj(x, y, ((t - P_Random()) << 10) + z, MT_SPARKPUFF); } diff --git a/src/strife/p_spec.c b/src/strife/p_spec.c index 8e34b0c9..627966f3 100644 --- a/src/strife/p_spec.c +++ b/src/strife/p_spec.c @@ -788,8 +788,8 @@ P_CrossSpecialLine break; case 39: - // TELEPORT! - [STRIFE] Verified unmodified. - EV_Teleport( line, side, thing ); + // TELEPORT! - [STRIFE] Verified unmodified (except for 0 flags param) + EV_Teleport( line, side, thing, TF_NORMAL ); line->special = 0; break; @@ -902,10 +902,11 @@ P_CrossSpecialLine break; case 125: - // TELEPORT MonsterONLY - [STRIFE] Verified unmodified. + // TELEPORT MonsterONLY - [STRIFE] Verified unmodified + // (except for 0 flags parameter) if (!thing->player) { - EV_Teleport( line, side, thing ); + EV_Teleport( line, side, thing, TF_NORMAL ); line->special = 0; } break; @@ -1220,8 +1221,8 @@ P_CrossSpecialLine break; case 97: - // TELEPORT! - [STRIFE] Verified unmodified. - EV_Teleport( line, side, thing ); + // TELEPORT! - [STRIFE] Verified unmodified (except for 0 flags param) + EV_Teleport( line, side, thing, TF_NORMAL ); break; case 98: @@ -1250,9 +1251,9 @@ P_CrossSpecialLine break; case 126: - // TELEPORT MonsterONLY. - [STRIFE] Verified unmodified. + // TELEPORT MonsterONLY. - [STRIFE] Verified unmodified (except for 0 flags param) if (!thing->player) - EV_Teleport( line, side, thing ); + EV_Teleport( line, side, thing, TF_NORMAL ); break; case 128: @@ -1357,16 +1358,12 @@ P_CrossSpecialLine case 185: // haleyjd 09/21/10: [STRIFE] Silent Teleport (used for Converter) - // STRIFE-TODO: Figure out the flags that have been added to EV_Teleport! - // flag = 51; - EV_Teleport(line, side, thing /*, flag*/); + EV_Teleport(line, side, thing, TF_FULLSILENCE); break; case 195: // haleyjd 09/21/10: [STRIFE] Silent Teleport and Change Zombie - // STRIFE-TODO: Figure out the flags that have been added to EV_Teleport! - // flag = 51; - EV_Teleport(line, side, thing /*, flag*/); + EV_Teleport(line, side, thing, TF_FULLSILENCE); P_SetMobjState(thing, S_AGRD_00); // 419 break; @@ -1378,9 +1375,8 @@ P_CrossSpecialLine break; case 231: - // haleyjd 09/21/10: [STRIFE] WR Teleport ???? - STRIFE-TODO: figure out flags - // flag = 33; - EV_Teleport(line, side, thing /*, flag*/); + // haleyjd 09/21/10: [STRIFE] WR Teleport (Silent at Source) + EV_Teleport(line, side, thing, TF_SRCSILENCE); break; // haleyjd 09/21/10: Moved one-time-use lines up above with the others. @@ -1406,9 +1402,8 @@ P_ShootSpecialLine ok = 0; switch(line->special) { - case 46: + case 46: // OPEN DOOR IMPACT case 182: // villsa [STRIFE] for windows - // OPEN DOOR IMPACT ok = 1; break; } diff --git a/src/strife/p_spec.h b/src/strife/p_spec.h index 49c5fbd9..2179bf9b 100644 --- a/src/strife/p_spec.h +++ b/src/strife/p_spec.h @@ -655,10 +655,28 @@ void T_MoveFloor( floormove_t* floor); // // P_TELEPT // + +// [STRIFE] Teleportation flags - teleflags +// Not to be conflated with telefrags, though they be tangentially related ;) +typedef enum teleflags +{ + TF_NOSRCSND = 0x01, + TF_NODSTSND = 0x02, + TF_NODSTFOG = 0x10, + TF_NOSRCFOG = 0x20, + + TF_NORMAL = 0, + TF_DSTSILENCE = (TF_NODSTSND|TF_NODSTFOG), // 0x12 (18) (Not used) + TF_SRCSILENCE = (TF_NOSRCSND|TF_NOSRCFOG), // 0x21 (33) + TF_FULLSILENCE = (TF_SRCSILENCE|TF_DSTSILENCE) // 0x33 (51) + +} teleflags_e; + int EV_Teleport -( line_t* line, - int side, - mobj_t* thing ); +( line_t* line, + int side, + mobj_t* thing, + teleflags_e flags); #endif diff --git a/src/strife/p_telept.c b/src/strife/p_telept.c index abd307c5..f947a9d9 100644 --- a/src/strife/p_telept.c +++ b/src/strife/p_telept.c @@ -46,65 +46,69 @@ // // TELEPORTATION // +// haleyjd 09/22/10: [STRIFE] Modified to take a flags parameter to control +// silent teleportation. +// int EV_Teleport -( line_t* line, - int side, - mobj_t* thing ) +( line_t* line, + int side, + mobj_t* thing, + teleflags_e flags) { - int i; - int tag; - mobj_t* m; - mobj_t* fog; - unsigned an; - thinker_t* thinker; - sector_t* sector; - fixed_t oldx; - fixed_t oldy; - fixed_t oldz; + int i; + int tag; + mobj_t* m; + mobj_t* fog; + unsigned an; + thinker_t* thinker; + sector_t* sector; + fixed_t oldx; + fixed_t oldy; + fixed_t oldz; // don't teleport missiles if (thing->flags & MF_MISSILE) - return 0; + return 0; // Don't teleport if hit back of line, // so you can get out of teleporter. - if (side == 1) - return 0; + if (side == 1) + return 0; + - tag = line->tag; for (i = 0; i < numsectors; i++) { - if (sectors[ i ].tag == tag ) - { - thinker = thinkercap.next; - for (thinker = thinkercap.next; - thinker != &thinkercap; - thinker = thinker->next) - { - // not a mobj - if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - m = (mobj_t *)thinker; - - // not a teleportman - if (m->type != MT_TELEPORTMAN ) - continue; - - sector = m->subsector->sector; - // wrong sector - if (sector-sectors != i ) - continue; - - oldx = thing->x; - oldy = thing->y; - oldz = thing->z; - - if (!P_TeleportMove (thing, m->x, m->y)) - return 0; - + if (sectors[ i ].tag == tag ) + { + thinker = thinkercap.next; + for (thinker = thinkercap.next; + thinker != &thinkercap; + thinker = thinker->next) + { + // not a mobj + if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + m = (mobj_t *)thinker; + + // not a teleportman + if (m->type != MT_TELEPORTMAN ) + continue; + + sector = m->subsector->sector; + // wrong sector + if (sector-sectors != i ) + continue; + + oldx = thing->x; + oldy = thing->y; + oldz = thing->z; + + if (!P_TeleportMove (thing, m->x, m->y)) + return 0; + // fraggle: this was changed in final doom, // problem between normal doom2 1.9 and final doom // @@ -112,30 +116,39 @@ EV_Teleport // it does not have this quirk. if (gameversion < exe_final || gameversion == exe_chex) - thing->z = thing->floorz; + thing->z = thing->floorz; + + if (thing->player) + thing->player->viewz = thing->z+thing->player->viewheight; + + // spawn teleport fog at source and destination + // haleyjd 09/22/10: [STRIFE] controlled by teleport flags + // BUG: Behavior would be undefined if this function were passed + // any combination of teleflags that has the NO*FOG but not the + // corresponding NO*SND flag - fortunately this is never done + // anywhere in the code. + if(!(flags & TF_NOSRCFOG)) + fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); + if(!(flags & TF_NOSRCSND)) + S_StartSound (fog, sfx_telept); + + an = m->angle >> ANGLETOFINESHIFT; - if (thing->player) - thing->player->viewz = thing->z+thing->player->viewheight; - - // spawn teleport fog at source and destination - fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); - S_StartSound (fog, sfx_telept); - an = m->angle >> ANGLETOFINESHIFT; - fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] - , thing->z, MT_TFOG); - - // emit sound, where? - S_StartSound (fog, sfx_telept); - - // don't move for a bit - if (thing->player) - thing->reactiontime = 18; - - thing->angle = m->angle; - thing->momx = thing->momy = thing->momz = 0; - return 1; - } - } + if(!(flags & TF_NODSTFOG)) + fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an], + thing->z, MT_TFOG); + if(!(flags & TF_NODSTSND)) + S_StartSound (fog, sfx_telept); + + // don't move for a bit + if (thing->player) + thing->reactiontime = 18; + + thing->angle = m->angle; + thing->momx = thing->momy = thing->momz = 0; + return 1; + } + } } return 0; } -- cgit v1.2.3