From 2f6c98ead3029a5290455f2c7d6b25d994bad828 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 19 Jun 2016 22:56:35 +0200 Subject: [PATCH 01/14] - Added support for old Skulltag ACS PlayerTeam. --- src/p_acs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index b71fa1702..7829ca065 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8094,6 +8094,13 @@ scriptwait: break; // [BC] Start ST PCD's + case PCD_PLAYERTEAM: + if ( activator && activator->player ) + PushToStack( activator->player->userinfo.GetTeam() ); + else + PushToStack( 0 ); + break; + case PCD_PLAYERHEALTH: if (activator) PushToStack (activator->health); From dd410876cfc16e71cdc42bef49c6db399773ad60 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 17 Jun 2016 15:33:01 -0500 Subject: [PATCH 02/14] Added A_ClearOverlays(int start, int stop, bool safety). - Clears a set of overlays in ranges [start,stop]. If unspecified, wipes all non-hardcoded layers. Safety determines whether to affect core layers or not (i.e. weapon). Returns the number of layers cleared. Added no override boolean to A_Overlay and a boolean return type. - If true, and a layer already has an active layer, the function returns false. Otherwise, sets the layer and returns true. --- src/p_pspr.cpp | 49 ++++++++++++++++++++++++++++++++-- wadsrc/static/actors/actor.txt | 3 ++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 3b57dd283..2216ebf3a 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1135,16 +1135,61 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay) PARAM_ACTION_PROLOGUE; PARAM_INT (layer); PARAM_STATE_OPT (state) { state = nullptr; } + PARAM_BOOL_OPT (dontoverride) { dontoverride = false; } player_t *player = self->player; if (player == nullptr) - return 0; + ACTION_RETURN_BOOL(false); DPSprite *pspr; + if (dontoverride && (player->FindPSprite(layer) != nullptr)) + { + ACTION_RETURN_BOOL(false); + } pspr = new DPSprite(player, stateowner, layer); pspr->SetState(state); - return 0; + ACTION_RETURN_BOOL(true); +} + +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) +{ + PARAM_ACTION_PROLOGUE; + PARAM_INT_OPT(start) { start = 0; } + PARAM_INT_OPT(stop) { stop = 0; } + PARAM_BOOL_OPT(safety) { safety = true; } + + if (!ACTION_CALL_FROM_PSPRITE()) + { + ACTION_RETURN_INT(0); + } + player_t *player = self->player; + if (!start && !stop) + { + start = -INT_MAX; + stop = PSP_TARGETCENTER - 1; + } + + int count = 0; + for (int i = start; i <= stop; i++) + { + if (safety) + { + if (i >= PSP_TARGETCENTER) + break; + else if ((i >= PSP_STRIFEHANDS && i <= PSP_WEAPON) || (i == PSP_FLASH)) + continue; + } + // [MC]Don't affect non-hardcoded layers unless it's really desired. + DPSprite *pspr = player->FindPSprite(i); + if (pspr != nullptr) + { + pspr->SetState(nullptr); + count++; + } + + } + ACTION_RETURN_INT(count); } // diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 8e6f0f338..ea22edbf4 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -329,12 +329,13 @@ ACTOR Actor native //: Thinker native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); + action native int A_ClearOverlays(int start = 0, int stop = 0, bool safety = true); native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER); - action native A_Overlay(int layer, state start = ""); + action native bool A_Overlay(int layer, state start = "", bool nooverride = false); action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0); action native A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0); action native A_OverlayFlags(int layer, int flags, bool set); From 2b91db7b3aedba763014519a36c4f4432c4d69a0 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sat, 18 Jun 2016 07:43:59 -0500 Subject: [PATCH 03/14] Refactored A_ClearOverlays. --- src/p_pspr.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 2216ebf3a..bab47ea2b 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1139,14 +1139,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay) player_t *player = self->player; - if (player == nullptr) - ACTION_RETURN_BOOL(false); - - DPSprite *pspr; - if (dontoverride && (player->FindPSprite(layer) != nullptr)) + if (player == nullptr || (dontoverride && (player->FindPSprite(layer) != nullptr))) { ACTION_RETURN_BOOL(false); } + + DPSprite *pspr; pspr = new DPSprite(player, stateowner, layer); pspr->SetState(state); ACTION_RETURN_BOOL(true); @@ -1159,10 +1157,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) PARAM_INT_OPT(stop) { stop = 0; } PARAM_BOOL_OPT(safety) { safety = true; } - if (!ACTION_CALL_FROM_PSPRITE()) - { + if (!self->player) ACTION_RETURN_INT(0); - } + player_t *player = self->player; if (!start && !stop) { @@ -1171,23 +1168,27 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) } int count = 0; - for (int i = start; i <= stop; i++) + DPSprite *pspr = player->psprites; + while (pspr != nullptr) { + int id = pspr->GetID(); + + //Do not wipe out layer 0. Ever. + if (!id || id > stop || id < start) + continue; + if (safety) { - if (i >= PSP_TARGETCENTER) + if (id >= PSP_TARGETCENTER) break; - else if ((i >= PSP_STRIFEHANDS && i <= PSP_WEAPON) || (i == PSP_FLASH)) + else if ((id >= PSP_STRIFEHANDS && id <= PSP_WEAPON) || (id == PSP_FLASH)) continue; } - // [MC]Don't affect non-hardcoded layers unless it's really desired. - DPSprite *pspr = player->FindPSprite(i); - if (pspr != nullptr) - { - pspr->SetState(nullptr); - count++; - } + // [MC]Don't affect non-hardcoded layers unless it's really desired. + pspr->SetState(nullptr); + count++; + pspr->GetNext(); } ACTION_RETURN_INT(count); } From 30880aab79cb410d7d3a354cb37755e277fe4a26 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sat, 18 Jun 2016 07:49:15 -0500 Subject: [PATCH 04/14] And a bit more optimization... --- src/p_pspr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index bab47ea2b..4fc5bdece 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1174,8 +1174,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) int id = pspr->GetID(); //Do not wipe out layer 0. Ever. - if (!id || id > stop || id < start) + if (!id || id < start) continue; + if (id > stop) + break; if (safety) { From ecfa7415b3216ad7e6af82453703a3f6a46129a1 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 19 Jun 2016 12:34:42 -0500 Subject: [PATCH 05/14] This small change was left out by mistake. --- src/p_pspr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 4fc5bdece..a1d7157e1 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1190,7 +1190,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) // [MC]Don't affect non-hardcoded layers unless it's really desired. pspr->SetState(nullptr); count++; - pspr->GetNext(); + pspr = pspr->GetNext(); } ACTION_RETURN_INT(count); } From e02ed3a6f7011a2fdce38dcb979d5e43234211c0 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 19 Jun 2016 12:43:05 -0500 Subject: [PATCH 06/14] Take in the targeter layers if someone disables the safety and uses 0 for start and stop. --- src/p_pspr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index a1d7157e1..ebfc14da3 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1163,8 +1163,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays) player_t *player = self->player; if (!start && !stop) { - start = -INT_MAX; - stop = PSP_TARGETCENTER - 1; + start = INT_MIN; + stop = safety ? PSP_TARGETCENTER - 1 : INT_MAX; } int count = 0; From 630dc8c8cd47bb6e94eb2c030db2e2e46aa15af1 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 19 Jun 2016 22:18:43 -0500 Subject: [PATCH 07/14] Fixed execution prevention. --- wadsrc/static/actors/actor.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index ea22edbf4..01fa8a2a2 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -329,7 +329,7 @@ ACTOR Actor native //: Thinker native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native int A_ClearOverlays(int start = 0, int stop = 0, bool safety = true); + action native int A_ClearOverlays(int sstart = 0, int sstop = 0, bool safety = true); native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); From 6384e81d0f135a2c292ac3e874f6fe26093f45b1 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Mon, 20 Jun 2016 01:42:20 +0200 Subject: [PATCH 08/14] - Add support for Skulltag ACS IsNetworkGame. Once known as PlayerOnTeam, then it became IsMultiplayer, but Skulltag code ignored emulated multiplayer, hence the new and clearer name. --- src/p_acs.cpp | 4 ++++ src/p_acs.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 7829ca065..9fc887dae 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8094,6 +8094,10 @@ scriptwait: break; // [BC] Start ST PCD's + case PCD_ISNETWORKGAME: + PushToStack(netgame); + break; + case PCD_PLAYERTEAM: if ( activator && activator->player ) PushToStack( activator->player->userinfo.GetTeam() ); diff --git a/src/p_acs.h b/src/p_acs.h index 9cd4eedd7..13dad4651 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -504,7 +504,7 @@ public: PCD_PLAYERGOLDSKULL, PCD_PLAYERBLACKCARD, PCD_PLAYERSILVERCARD, - PCD_PLAYERONTEAM, + PCD_ISNETWORKGAME, PCD_PLAYERTEAM, /*120*/ PCD_PLAYERHEALTH, PCD_PLAYERARMORPOINTS, From 85a34bbb88c041da62fe4a1cb55cfacd1b760bed Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 20 Jun 2016 08:49:57 -0500 Subject: [PATCH 09/14] Added GetPlayerInput(int numinput, int ptr = AAPTR_PLAYER1). - Works exactly like the ACS version, but with pointers instead. The pointer can be anything, so long as it can be identified as a player. --- src/p_acs.cpp | 25 ------------- src/p_local.h | 25 +++++++++++++ src/thingdef/thingdef_codeptr.cpp | 57 +++++++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + wadsrc/static/actors/constants.txt | 59 ++++++++++++++++++++++++++++++ 5 files changed, 142 insertions(+), 25 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 9fc887dae..1dfb1145a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4190,31 +4190,6 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b return tex == TexMan[secpic]; } -enum -{ - // These are the original inputs sent by the player. - INPUT_OLDBUTTONS, - INPUT_BUTTONS, - INPUT_PITCH, - INPUT_YAW, - INPUT_ROLL, - INPUT_FORWARDMOVE, - INPUT_SIDEMOVE, - INPUT_UPMOVE, - - // These are the inputs, as modified by P_PlayerThink(). - // Most of the time, these will match the original inputs, but - // they can be different if a player is frozen or using a - // chainsaw. - MODINPUT_OLDBUTTONS, - MODINPUT_BUTTONS, - MODINPUT_PITCH, - MODINPUT_YAW, - MODINPUT_ROLL, - MODINPUT_FORWARDMOVE, - MODINPUT_SIDEMOVE, - MODINPUT_UPMOVE -}; int DLevelScript::GetPlayerInput(int playernum, int inputnum) { diff --git a/src/p_local.h b/src/p_local.h index 0acbdc35f..0d3035623 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -162,6 +162,31 @@ void InitSpawnablesFromMapinfo(); int P_Thing_Warp(AActor *caller, AActor *reference, double xofs, double yofs, double zofs, DAngle angle, int flags, double heightoffset, double radiusoffset, DAngle pitch); bool P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int count, int flags, int ptr); +enum +{ + // These are the original inputs sent by the player. + INPUT_OLDBUTTONS, + INPUT_BUTTONS, + INPUT_PITCH, + INPUT_YAW, + INPUT_ROLL, + INPUT_FORWARDMOVE, + INPUT_SIDEMOVE, + INPUT_UPMOVE, + + // These are the inputs, as modified by P_PlayerThink(). + // Most of the time, these will match the original inputs, but + // they can be different if a player is frozen or using a + // chainsaw. + MODINPUT_OLDBUTTONS, + MODINPUT_BUTTONS, + MODINPUT_PITCH, + MODINPUT_YAW, + MODINPUT_ROLL, + MODINPUT_FORWARDMOVE, + MODINPUT_SIDEMOVE, + MODINPUT_UPMOVE +}; enum CPXF { CPXF_ANCESTOR = 1 << 0, diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 610b6b17e..d4baefe27 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -543,6 +543,63 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetCVar) return 0; } +//========================================================================== +// +// GetPlayerInput +// +// NON-ACTION function that works like ACS's GetPlayerInput. +// Takes a pointer as anyone may or may not be a player. +//========================================================================== + +DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetPlayerInput) +{ + if (numret > 0) + { + assert(ret != nullptr); + PARAM_SELF_PROLOGUE(AActor); + PARAM_INT (inputnum); + PARAM_INT_OPT (ptr) { ptr = AAPTR_PLAYER1; } + + AActor *mobj = COPY_AAPTR(self, ptr); + + //Need a player. + if (!mobj || !mobj->player) + { + ret->SetInt(0); + } + else + { + player_t *p = mobj->player; + int renum = 0; + switch (inputnum) + { + case INPUT_OLDBUTTONS: renum = p->original_oldbuttons; break; + case INPUT_BUTTONS: renum = p->original_cmd.buttons; break; + case INPUT_PITCH: renum = p->original_cmd.pitch; break; + case INPUT_YAW: renum = p->original_cmd.yaw; break; + case INPUT_ROLL: renum = p->original_cmd.roll; break; + case INPUT_FORWARDMOVE: renum = p->original_cmd.forwardmove; break; + case INPUT_SIDEMOVE: renum = p->original_cmd.sidemove; break; + case INPUT_UPMOVE: renum = p->original_cmd.upmove; break; + + case MODINPUT_OLDBUTTONS: renum = p->oldbuttons; break; + case MODINPUT_BUTTONS: renum = p->cmd.ucmd.buttons; break; + case MODINPUT_PITCH: renum = p->cmd.ucmd.pitch; break; + case MODINPUT_YAW: renum = p->cmd.ucmd.yaw; break; + case MODINPUT_ROLL: renum = p->cmd.ucmd.roll; break; + case MODINPUT_FORWARDMOVE: renum = p->cmd.ucmd.forwardmove; break; + case MODINPUT_SIDEMOVE: renum = p->cmd.ucmd.sidemove; break; + case MODINPUT_UPMOVE: renum = p->cmd.ucmd.upmove; break; + + default: renum = 0; break; + } + ret->SetInt(renum); + } + return 1; + } + return 0; +} + //=========================================================================== // // __decorate_internal_state__ diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 01fa8a2a2..07ca5debb 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -48,6 +48,7 @@ ACTOR Actor native //: Thinker native int GetGibHealth(); native float GetCrouchFactor(int ptr = AAPTR_PLAYER1); native float GetCVar(string cvar); + native int GetPlayerInput(int inputnum, int ptr = AAPTR_PLAYER1); // Action functions // Meh, MBF redundant functions. Only for DeHackEd support. diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 160646ff0..7b75b481d 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -593,3 +593,62 @@ enum PSP_WEAPON = 1, PSP_FLASH = 1000, }; + +enum +{ + // These are the original inputs sent by the player. + INPUT_OLDBUTTONS, + INPUT_BUTTONS, + INPUT_PITCH, + INPUT_YAW, + INPUT_ROLL, + INPUT_FORWARDMOVE, + INPUT_SIDEMOVE, + INPUT_UPMOVE, + + // These are the inputs, as modified by P_PlayerThink(). + // Most of the time, these will match the original inputs, but + // they can be different if a player is frozen or using a + // chainsaw. + MODINPUT_OLDBUTTONS, + MODINPUT_BUTTONS, + MODINPUT_PITCH, + MODINPUT_YAW, + MODINPUT_ROLL, + MODINPUT_FORWARDMOVE, + MODINPUT_SIDEMOVE, + MODINPUT_UPMOVE +}; + +enum +{ + BT_ATTACK = 1<<0, // Press "Fire". + BT_USE = 1<<1, // Use button, to open doors, activate switches. + BT_JUMP = 1<<2, + BT_CROUCH = 1<<3, + BT_TURN180 = 1<<4, + BT_ALTATTACK = 1<<5, // Press your other "Fire". + BT_RELOAD = 1<<6, // [XA] Reload key. Causes state jump in A_WeaponReady. + BT_ZOOM = 1<<7, // [XA] Zoom key. Ditto. + + // The rest are all ignored by the play simulation and are for scripts. + BT_SPEED = 1<<8, + BT_STRAFE = 1<<9, + + BT_MOVERIGHT = 1<<10, + BT_MOVELEFT = 1<<11, + BT_BACK = 1<<12, + BT_FORWARD = 1<<13, + BT_RIGHT = 1<<14, + BT_LEFT = 1<<15, + BT_LOOKUP = 1<<16, + BT_LOOKDOWN = 1<<17, + BT_MOVEUP = 1<<18, + BT_MOVEDOWN = 1<<19, + BT_SHOWSCORES = 1<<20, + + BT_USER1 = 1<<21, + BT_USER2 = 1<<22, + BT_USER3 = 1<<23, + BT_USER4 = 1<<24, +}; From 26408a50434a5bec6a6472d3630b051fe5f1e375 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 20 Jun 2016 09:11:38 -0500 Subject: [PATCH 10/14] Switched the pointer to AAPTR_DEFAULT. --- src/thingdef/thingdef_codeptr.cpp | 2 +- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d4baefe27..491944253 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -558,7 +558,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetPlayerInput) assert(ret != nullptr); PARAM_SELF_PROLOGUE(AActor); PARAM_INT (inputnum); - PARAM_INT_OPT (ptr) { ptr = AAPTR_PLAYER1; } + PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } AActor *mobj = COPY_AAPTR(self, ptr); diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 07ca5debb..a531838d0 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -48,7 +48,7 @@ ACTOR Actor native //: Thinker native int GetGibHealth(); native float GetCrouchFactor(int ptr = AAPTR_PLAYER1); native float GetCVar(string cvar); - native int GetPlayerInput(int inputnum, int ptr = AAPTR_PLAYER1); + native int GetPlayerInput(int inputnum, int ptr = AAPTR_DEFAULT); // Action functions // Meh, MBF redundant functions. Only for DeHackEd support. From 9df65f73fcbc3dac6b62aa336ed80c53f6adf5f9 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 20 Jun 2016 09:41:46 -0500 Subject: [PATCH 11/14] Localized the input checker into P_Thing_CheckInputNum now called by both ACS and DECORATE.. --- src/p_acs.cpp | 23 +---------------------- src/p_local.h | 1 + src/p_things.cpp | 29 +++++++++++++++++++++++++++++ src/thingdef/thingdef_codeptr.cpp | 26 +------------------------- 4 files changed, 32 insertions(+), 47 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 1dfb1145a..7cbfd69b4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4216,28 +4216,7 @@ int DLevelScript::GetPlayerInput(int playernum, int inputnum) return 0; } - switch (inputnum) - { - case INPUT_OLDBUTTONS: return p->original_oldbuttons; break; - case INPUT_BUTTONS: return p->original_cmd.buttons; break; - case INPUT_PITCH: return p->original_cmd.pitch; break; - case INPUT_YAW: return p->original_cmd.yaw; break; - case INPUT_ROLL: return p->original_cmd.roll; break; - case INPUT_FORWARDMOVE: return p->original_cmd.forwardmove; break; - case INPUT_SIDEMOVE: return p->original_cmd.sidemove; break; - case INPUT_UPMOVE: return p->original_cmd.upmove; break; - - case MODINPUT_OLDBUTTONS: return p->oldbuttons; break; - case MODINPUT_BUTTONS: return p->cmd.ucmd.buttons; break; - case MODINPUT_PITCH: return p->cmd.ucmd.pitch; break; - case MODINPUT_YAW: return p->cmd.ucmd.yaw; break; - case MODINPUT_ROLL: return p->cmd.ucmd.roll; break; - case MODINPUT_FORWARDMOVE: return p->cmd.ucmd.forwardmove; break; - case MODINPUT_SIDEMOVE: return p->cmd.ucmd.sidemove; break; - case MODINPUT_UPMOVE: return p->cmd.ucmd.upmove; break; - - default: return 0; break; - } + return P_Thing_CheckInputNum(p, inputnum); } enum diff --git a/src/p_local.h b/src/p_local.h index 0d3035623..ac6b264d9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -159,6 +159,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser); bool P_Thing_CanRaise(AActor *thing); PClassActor *P_GetSpawnableType(int spawnnum); void InitSpawnablesFromMapinfo(); +int P_Thing_CheckInputNum(player_t *p, int inputnum); int P_Thing_Warp(AActor *caller, AActor *reference, double xofs, double yofs, double zofs, DAngle angle, int flags, double heightoffset, double radiusoffset, DAngle pitch); bool P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int count, int flags, int ptr); diff --git a/src/p_things.cpp b/src/p_things.cpp index 98826268c..e19323542 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -666,7 +666,36 @@ void InitSpawnablesFromMapinfo() InitClassMap(SpawnableThings, SpawnablesFromMapinfo); InitClassMap(StrifeTypes, ConversationIDsFromMapinfo); } +int P_Thing_CheckInputNum(player_t *p, int inputnum) +{ + int renum = 0; + if (p) + { + switch (inputnum) + { + case INPUT_OLDBUTTONS: renum = p->original_oldbuttons; break; + case INPUT_BUTTONS: renum = p->original_cmd.buttons; break; + case INPUT_PITCH: renum = p->original_cmd.pitch; break; + case INPUT_YAW: renum = p->original_cmd.yaw; break; + case INPUT_ROLL: renum = p->original_cmd.roll; break; + case INPUT_FORWARDMOVE: renum = p->original_cmd.forwardmove; break; + case INPUT_SIDEMOVE: renum = p->original_cmd.sidemove; break; + case INPUT_UPMOVE: renum = p->original_cmd.upmove; break; + case MODINPUT_OLDBUTTONS: renum = p->oldbuttons; break; + case MODINPUT_BUTTONS: renum = p->cmd.ucmd.buttons; break; + case MODINPUT_PITCH: renum = p->cmd.ucmd.pitch; break; + case MODINPUT_YAW: renum = p->cmd.ucmd.yaw; break; + case MODINPUT_ROLL: renum = p->cmd.ucmd.roll; break; + case MODINPUT_FORWARDMOVE: renum = p->cmd.ucmd.forwardmove; break; + case MODINPUT_SIDEMOVE: renum = p->cmd.ucmd.sidemove; break; + case MODINPUT_UPMOVE: renum = p->cmd.ucmd.upmove; break; + + default: renum = 0; break; + } + } + return renum; +} bool P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int count, int flags, int ptr) { AActor *ref = COPY_AAPTR(self, ptr); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 491944253..b0979885a 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -569,31 +569,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetPlayerInput) } else { - player_t *p = mobj->player; - int renum = 0; - switch (inputnum) - { - case INPUT_OLDBUTTONS: renum = p->original_oldbuttons; break; - case INPUT_BUTTONS: renum = p->original_cmd.buttons; break; - case INPUT_PITCH: renum = p->original_cmd.pitch; break; - case INPUT_YAW: renum = p->original_cmd.yaw; break; - case INPUT_ROLL: renum = p->original_cmd.roll; break; - case INPUT_FORWARDMOVE: renum = p->original_cmd.forwardmove; break; - case INPUT_SIDEMOVE: renum = p->original_cmd.sidemove; break; - case INPUT_UPMOVE: renum = p->original_cmd.upmove; break; - - case MODINPUT_OLDBUTTONS: renum = p->oldbuttons; break; - case MODINPUT_BUTTONS: renum = p->cmd.ucmd.buttons; break; - case MODINPUT_PITCH: renum = p->cmd.ucmd.pitch; break; - case MODINPUT_YAW: renum = p->cmd.ucmd.yaw; break; - case MODINPUT_ROLL: renum = p->cmd.ucmd.roll; break; - case MODINPUT_FORWARDMOVE: renum = p->cmd.ucmd.forwardmove; break; - case MODINPUT_SIDEMOVE: renum = p->cmd.ucmd.sidemove; break; - case MODINPUT_UPMOVE: renum = p->cmd.ucmd.upmove; break; - - default: renum = 0; break; - } - ret->SetInt(renum); + ret->SetInt(P_Thing_CheckInputNum(mobj->player, inputnum)); } return 1; } From 613fa4c9e4f597ec8fd82aea7fdbedb85ae0f53a Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 20 Jun 2016 16:39:33 -0500 Subject: [PATCH 12/14] Fixed: GetDistance was missing the original Z check disabling introduced in commit bd16ccb. --- src/thingdef/thingdef_codeptr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index b0979885a..7a9ac1ce0 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -312,6 +312,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) DVector3 diff = self->Vec3To(target); if (checkz) diff.Z += (target->Height - self->Height) / 2; + else + diff.Z = 0.; ret->SetFloat(diff.Length()); } From ce0c2863b071c48118738257c8e6a8ed2e08c846 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 21 Jun 2016 10:31:25 +0200 Subject: [PATCH 13/14] - set 'maskedmidtex' compatibility option for Caverns of Darkness MAP07. --- wadsrc/static/compatibility.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 61d13b6df..a2c3794ae 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -425,6 +425,11 @@ D0139194F7817BF06F3988DFC47DB38D // Whispers of Satan map29 multiexit } +C98F79709BD7E0E4C19026AB9575EC6F // cc-cod.zip:codlev.wad map07 +{ + maskedmidtex +} + D7F6E9F08C39A17026349A04F8C0B0BE // Return to Hadron, e1m9 19D03FFC875589E21EDBB7AB74EF4AEF // Return to Hadron, e1m9, 2016.01.03 update { From 4899c405c37f58010972caaa531646e7724d16b3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 21 Jun 2016 10:45:17 +0200 Subject: [PATCH 14/14] - fixed: all non-ZDoom compatibility profiles need compat_maskedmidtex set. This was neither fixed in Boom nor MBF. --- src/d_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 4c0d2537d..d6d53dd77 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -556,7 +556,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) case 1: // Doom2.exe compatible with a few relaxed settings v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT| COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_DEHHEALTH|COMPATF_CROSSDROPOFF| - COMPATF_LIGHT; + COMPATF_LIGHT|COMPATF_MASKEDMIDTEX; w= COMPATF2_FLOORMOVE; break; @@ -569,7 +569,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) break; case 3: // Boom compat mode - v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP; + v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_MASKEDMIDTEX; break; case 4: // Old ZDoom compat mode @@ -579,12 +579,12 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) case 5: // MBF compat mode v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_MUSHROOM| - COMPATF_MBFMONSTERMOVE|COMPATF_NOBLOCKFRIENDS; + COMPATF_MBFMONSTERMOVE|COMPATF_NOBLOCKFRIENDS|COMPATF_MASKEDMIDTEX; break; case 6: // Boom with some added settings to reenable some 'broken' behavior v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_NO_PASSMOBJ| - COMPATF_INVISIBILITY|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|COMPATF_WALLRUN|COMPATF_NOTOSSDROPS; + COMPATF_INVISIBILITY|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_MASKEDMIDTEX; w = COMPATF2_POINTONLINE; break;