diff --git a/src/d_net.cpp b/src/d_net.cpp index d13570a33..2b97151a2 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2344,7 +2344,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) } if (!CheckCheatmode(player == consoleplayer)) { - LineSpecials[snum](NULL, players[player].mo, false, arg[0], arg[1], arg[2], arg[3], arg[4]); + P_ExecuteSpecial(snum, NULL, players[player].mo, false, arg[0], arg[1], arg[2], arg[3], arg[4]); } } break; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index a67f75853..120db9bd0 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -2221,7 +2221,7 @@ void FParser::SF_LineTrigger() mld.special=intvalue(t_argv[0]); mld.tag=t_argc > 1 ? intvalue(t_argv[1]) : 0; P_TranslateLineDef(&line, &mld); - LineSpecials[line.special](NULL, Script->trigger, false, + P_ExecuteSpecial(line.special, NULL, Script->trigger, false, line.args[0],line.args[1],line.args[2],line.args[3],line.args[4]); } } @@ -4042,7 +4042,7 @@ void FParser::SF_Ls() if (t_argc>=i+2) args[i]=intvalue(t_argv[i+1]); } if (spc>=0 && spc<256) - LineSpecials[spc](NULL,Script->trigger,false, args[0],args[1],args[2],args[3],args[4]); + P_ExecuteSpecial(spc, NULL,Script->trigger,false, args[0],args[1],args[2],args[3],args[4]); } } @@ -4421,7 +4421,7 @@ void FParser::RunLineSpecial(const FLineSpecial *spec) if (t_argc>i) args[i]=intvalue(t_argv[i]); else args[i] = 0; } - t_return.value.i = LineSpecials[spec->number](NULL,Script->trigger,false, args[0],args[1],args[2],args[3],args[4]); + t_return.value.i = P_ExecuteSpecial(spec->number, NULL,Script->trigger,false, args[0],args[1],args[2],args[3],args[4]); } } diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 60302c680..9c1fc398d 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -332,7 +332,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BellReset1) self->height <<= 2; if (self->special) { // Initiate death action - LineSpecials[self->special] (NULL, NULL, false, self->args[0], + P_ExecuteSpecial(self->special, NULL, NULL, false, self->args[0], self->args[1], self->args[2], self->args[3], self->args[4]); self->special = 0; } diff --git a/src/g_hexen/a_teleportother.cpp b/src/g_hexen/a_teleportother.cpp index 22f0673f5..8de2ab0c3 100644 --- a/src/g_hexen/a_teleportother.cpp +++ b/src/g_hexen/a_teleportother.cpp @@ -134,7 +134,7 @@ int ATelOtherFX1::DoSpecialDamage (AActor *target, int damage) if (target->flags3 & MF3_ISMONSTER && target->special) { target->RemoveFromHash (); - LineSpecials[target->special] (NULL, level.flags & LEVEL_ACTOWNSPECIAL + P_ExecuteSpecial(target->special, NULL, level.flags & LEVEL_ACTOWNSPECIAL ? target : (AActor *)(this->target), false, target->args[0], target->args[1], target->args[2], target->args[3], target->args[4]); target->special = 0; diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 2243d48a4..4a10ff08c 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -191,7 +191,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath) } else if (self->flags3 & MF3_ISMONSTER && self->special) { // Initiate monster death actions - LineSpecials [self->special] (NULL, self, false, self->args[0], + P_ExecuteSpecial(self->special, NULL, self, false, self->args[0], self->args[1], self->args[2], self->args[3], self->args[4]); self->special = 0; } diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index de67c51d9..17f6b626c 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -350,7 +350,7 @@ void APathFollower::NewNode () while ( (spec = iterator.Next ()) ) { - LineSpecials[spec->special] (NULL, NULL, false, spec->args[0], + P_ExecuteSpecial(spec->special, NULL, NULL, false, spec->args[0], spec->args[1], spec->args[2], spec->args[3], spec->args[4]); } } diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index f15da2f3a..116c62eca 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -951,7 +951,7 @@ void AInventory::DoPickupSpecial (AActor *toucher) { if (special) { - LineSpecials[special] (NULL, toucher, false, + P_ExecuteSpecial(special, NULL, toucher, false, args[0], args[1], args[2], args[3], args[4]); special = 0; } diff --git a/src/g_shared/a_sectoraction.cpp b/src/g_shared/a_sectoraction.cpp index acbafa656..ed73b5ae7 100644 --- a/src/g_shared/a_sectoraction.cpp +++ b/src/g_shared/a_sectoraction.cpp @@ -97,7 +97,7 @@ bool ASectorAction::CheckTrigger (AActor *triggerer) const ((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) || ((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS)))) { - bool res = !!LineSpecials[special] (NULL, triggerer, false, args[0], args[1], + bool res = !!P_ExecuteSpecial(special, NULL, triggerer, false, args[0], args[1], args[2], args[3], args[4]); return res; } diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 15e372aca..efc42361c 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -474,7 +474,13 @@ void P_Recalculate3DFloors(sector_t * sector) oldlist.Delete(pickindex); - if (pick->flags&(FF_SWIMMABLE|FF_TRANSLUCENT) && pick->flags&FF_EXISTS) + if (pick->flags & FF_THISINSIDE) + { + // These have the floor higher than the ceiling and cannot be processed + // by the clipping code below. + ffloors.Push(pick); + } + else if (pick->flags&(FF_SWIMMABLE|FF_TRANSLUCENT) && pick->flags&FF_EXISTS) { clipped=pick; clipped_top=height; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 19101bfb8..41f627bd1 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -761,7 +761,7 @@ void DPlaneWatcher::Tick () if ((LastD < WatchD && newd >= WatchD) || (LastD > WatchD && newd <= WatchD)) { - LineSpecials[Special] (Line, Activator, LineSide, Arg0, Arg1, Arg2, Arg3, Arg4); + P_ExecuteSpecial(Special, Line, Activator, LineSide, Arg0, Arg1, Arg2, Arg3, Arg4); Destroy (); } @@ -3760,39 +3760,39 @@ int DLevelScript::RunScript () break; case PCD_LSPEC1: - LineSpecials[NEXTBYTE] (activationline, activator, backSide, + P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(1), 0, 0, 0, 0); sp -= 1; break; case PCD_LSPEC2: - LineSpecials[NEXTBYTE] (activationline, activator, backSide, + P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(2), STACK(1), 0, 0, 0); sp -= 2; break; case PCD_LSPEC3: - LineSpecials[NEXTBYTE] (activationline, activator, backSide, + P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(3), STACK(2), STACK(1), 0, 0); sp -= 3; break; case PCD_LSPEC4: - LineSpecials[NEXTBYTE] (activationline, activator, backSide, + P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(4), STACK(3), STACK(2), STACK(1), 0); sp -= 4; break; case PCD_LSPEC5: - LineSpecials[NEXTBYTE] (activationline, activator, backSide, + P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(5), STACK(4), STACK(3), STACK(2), STACK(1)); sp -= 5; break; case PCD_LSPEC5RESULT: - STACK(5) = LineSpecials[NEXTBYTE] (activationline, activator, backSide, + STACK(5) = P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide, STACK(5), STACK(4), STACK(3), STACK(2), STACK(1)); sp -= 4; @@ -3800,66 +3800,66 @@ int DLevelScript::RunScript () case PCD_LSPEC1DIRECT: temp = NEXTBYTE; - LineSpecials[temp] (activationline, activator, backSide, + P_ExecuteSpecial(temp, activationline, activator, backSide, uallong(pc[0]), 0, 0, 0, 0); pc += 1; break; case PCD_LSPEC2DIRECT: temp = NEXTBYTE; - LineSpecials[temp] (activationline, activator, backSide, + P_ExecuteSpecial(temp, activationline, activator, backSide, uallong(pc[0]), uallong(pc[1]), 0, 0, 0); pc += 2; break; case PCD_LSPEC3DIRECT: temp = NEXTBYTE; - LineSpecials[temp] (activationline, activator, backSide, + P_ExecuteSpecial(temp, activationline, activator, backSide, uallong(pc[0]), uallong(pc[1]), uallong(pc[2]), 0, 0); pc += 3; break; case PCD_LSPEC4DIRECT: temp = NEXTBYTE; - LineSpecials[temp] (activationline, activator, backSide, + P_ExecuteSpecial(temp, activationline, activator, backSide, uallong(pc[0]), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), 0); pc += 4; break; case PCD_LSPEC5DIRECT: temp = NEXTBYTE; - LineSpecials[temp] (activationline, activator, backSide, + P_ExecuteSpecial(temp, activationline, activator, backSide, uallong(pc[0]), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), uallong(pc[4])); pc += 5; break; case PCD_LSPEC1DIRECTB: - LineSpecials[((BYTE *)pc)[0]] (activationline, activator, backSide, + P_ExecuteSpecial(((BYTE *)pc)[0], activationline, activator, backSide, ((BYTE *)pc)[1], 0, 0, 0, 0); pc = (int *)((BYTE *)pc + 2); break; case PCD_LSPEC2DIRECTB: - LineSpecials[((BYTE *)pc)[0]] (activationline, activator, backSide, + P_ExecuteSpecial(((BYTE *)pc)[0], activationline, activator, backSide, ((BYTE *)pc)[1], ((BYTE *)pc)[2], 0, 0, 0); pc = (int *)((BYTE *)pc + 3); break; case PCD_LSPEC3DIRECTB: - LineSpecials[((BYTE *)pc)[0]] (activationline, activator, backSide, + P_ExecuteSpecial(((BYTE *)pc)[0], activationline, activator, backSide, ((BYTE *)pc)[1], ((BYTE *)pc)[2], ((BYTE *)pc)[3], 0, 0); pc = (int *)((BYTE *)pc + 4); break; case PCD_LSPEC4DIRECTB: - LineSpecials[((BYTE *)pc)[0]] (activationline, activator, backSide, + P_ExecuteSpecial(((BYTE *)pc)[0], activationline, activator, backSide, ((BYTE *)pc)[1], ((BYTE *)pc)[2], ((BYTE *)pc)[3], ((BYTE *)pc)[4], 0); pc = (int *)((BYTE *)pc + 5); break; case PCD_LSPEC5DIRECTB: - LineSpecials[((BYTE *)pc)[0]] (activationline, activator, backSide, + P_ExecuteSpecial(((BYTE *)pc)[0], activationline, activator, backSide, ((BYTE *)pc)[1], ((BYTE *)pc)[2], ((BYTE *)pc)[3], ((BYTE *)pc)[4], ((BYTE *)pc)[5]); pc = (int *)((BYTE *)pc + 6); diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 5b023c28a..f9479c0cc 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1302,7 +1302,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply if (reply->ActionSpecial != 0) { - takestuff |= !!LineSpecials[reply->ActionSpecial](NULL, player->mo, false, + takestuff |= !!P_ExecuteSpecial(reply->ActionSpecial, NULL, player->mo, false, reply->Args[0], reply->Args[1], reply->Args[2], reply->Args[3], reply->Args[4]); } diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 60db36611..e25444b15 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2295,7 +2295,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi // as the goal. while ( (spec = specit.Next()) ) { - LineSpecials[spec->special] (NULL, actor, false, spec->args[0], + P_ExecuteSpecial(spec->special, NULL, actor, false, spec->args[0], spec->args[1], spec->args[2], spec->args[3], spec->args[4]); } @@ -3134,7 +3134,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath) } checked = true; - LineSpecials[sa->Action](NULL, self, false, + P_ExecuteSpecial(sa->Action, NULL, self, false, sa->Args[0], sa->Args[1], sa->Args[2], sa->Args[3], sa->Args[4]); } } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index aa6d06048..7f21756a5 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -3400,3 +3400,27 @@ int P_FindLineSpecial (const char *string, int *min_args, int *max_args) } return 0; } + + +//========================================================================== +// +// P_ExecuteSpecial +// +//========================================================================== + +int P_ExecuteSpecial(int num, + struct line_t *line, + class AActor *activator, + bool backSide, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5) +{ + if (num >= 0 && num <= 255) + { + return LineSpecials[num](line, activator, backSide, arg1, arg2, arg3, arg4, arg5); + } + return 0; +} diff --git a/src/p_lnspec.h b/src/p_lnspec.h index 050e0fe7b..1b842d29f 100644 --- a/src/p_lnspec.h +++ b/src/p_lnspec.h @@ -199,5 +199,14 @@ extern lnSpecFunc LineSpecials[256]; int P_FindLineSpecial (const char *string, int *min_args=NULL, int *max_args=NULL); bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death=false); +int P_ExecuteSpecial(int num, + struct line_t *line, + class AActor *activator, + bool backSide, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5); #endif //__P_LNSPEC_H__ diff --git a/src/p_map.cpp b/src/p_map.cpp index 49277e7f0..fe1dc5b13 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5532,7 +5532,7 @@ bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death) // Run the special, if any if (thing->special) { - res = !! LineSpecials[thing->special] (NULL, + res = !! P_ExecuteSpecial(thing->special, NULL, // TriggerActs overrides the level flag, which only concerns thing activated by death (((death && level.flags & LEVEL_ACTOWNSPECIAL && !(thing->activationtype & THINGSPEC_TriggerActs)) || (thing->activationtype & THINGSPEC_ThingActs)) // Who triggers? diff --git a/src/p_spec.cpp b/src/p_spec.cpp index cf97c16fc..91d531a36 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -222,8 +222,8 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType) lineActivation = line->activation; repeat = line->flags & ML_REPEAT_SPECIAL; buttonSuccess = false; - buttonSuccess = LineSpecials[line->special] - (line, mo, side == 1, line->args[0], + buttonSuccess = P_ExecuteSpecial(line->special, + line, mo, side == 1, line->args[0], line->args[1], line->args[2], line->args[3], line->args[4]); diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index 795cbc541..7b4aa0bab 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -79,7 +79,7 @@ public: bool TryPickup (AActor *&toucher) { - INTBOOL success = LineSpecials[special] (NULL, toucher, false, + INTBOOL success = P_ExecuteSpecial(special, NULL, toucher, false, args[0], args[1], args[2], args[3], args[4]); if (success) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 1717a77e1..2c6fddfc8 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -671,7 +671,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial) ACTION_PARAM_INT(arg4, 4); ACTION_PARAM_INT(arg5, 5); - bool res = !!LineSpecials[special](NULL, self, false, arg1, arg2, arg3, arg4, arg5); + bool res = !!P_ExecuteSpecial(special, NULL, self, false, arg1, arg2, arg3, arg4, arg5); ACTION_SET_RESULT(res); } @@ -3555,7 +3555,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LineEffect) { oldjunk.tag = tag; // Sector tag for linedef P_TranslateLineDef(&junk, &oldjunk); // Turn into native type - res = !!LineSpecials[junk.special](NULL, self, false, junk.args[0], + res = !!P_ExecuteSpecial(junk.special, NULL, self, false, junk.args[0], junk.args[1], junk.args[2], junk.args[3], junk.args[4]); if (res && !(junk.flags & ML_REPEAT_SPECIAL)) // If only once, self->flags6 |= MF6_LINEDONE; // no more for this thing diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index f31753b1b..364d6916d 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -2415,7 +2415,7 @@ ExpVal FxActionSpecialCall::EvalExpression (AActor *self) } ExpVal ret; ret.Type = VAL_Int; - ret.Int = LineSpecials[Special](NULL, self, false, v[0], v[1], v[2], v[3], v[4]); + ret.Int = P_ExecuteSpecial(Special, NULL, self, false, v[0], v[1], v[2], v[3], v[4]); return ret; }