From 4e148f00e62dc84bc50dd5f57d4bc116198c4fb4 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 19 Jun 2016 11:47:30 +0200 Subject: [PATCH 01/18] - Fixed wrong Skulltag ConsoleCommand pcode name. Also report this pcode as not supported by the program. --- src/p_acs.cpp | 6 +++++- src/p_acs.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 29c9fe8fe4..5df4da472e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -9574,8 +9574,12 @@ scriptwait: break; case PCD_CONSOLECOMMAND: + case PCD_CONSOLECOMMANDDIRECT: Printf (TEXTCOLOR_RED GAMENAME " doesn't support execution of console commands from scripts\n"); - sp -= 3; + if (pcd == PCD_CONSOLECOMMAND) + sp -= 3; + else + pc += 3; break; } } diff --git a/src/p_acs.h b/src/p_acs.h index e3c502f7c4..9cd4eedd73 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -519,7 +519,7 @@ public: /*130*/ PCD_LSPEC6DIRECT, // be given names like PCD_DUMMY. PCD_PRINTNAME, PCD_MUSICCHANGE, - PCD_TEAM2FRAGPOINTS, + PCD_CONSOLECOMMANDDIRECT, PCD_CONSOLECOMMAND, PCD_SINGLEPLAYER, // [RH] End of Skull Tag p-codes PCD_FIXEDMUL, From da05dfa72e2c7014fbffca2b44364a0a5284d9e3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Jun 2016 12:32:45 +0200 Subject: [PATCH 02/18] fixed: Polyobject-based line portals may not cache their angle as it may change at any time. --- src/portal.cpp | 34 +++++++++++++++++++++++++++------- src/portal.h | 1 + 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/portal.cpp b/src/portal.cpp index 41f2e755e1..ec3d5d90ff 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -272,14 +272,31 @@ static line_t *FindDestination(line_t *src, int tag) static void SetRotation(FLinePortal *port) { - if (port != NULL && port->mDestination != NULL) + if (port != nullptr && port->mDestination != nullptr) { - line_t *dst = port->mDestination; - line_t *line = port->mOrigin; - DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + 180.; - port->mSinRot = sindeg(angle.Degrees); // Here precision matters so use the slower but more precise versions. - port->mCosRot = cosdeg(angle.Degrees); - port->mAngleDiff = angle; + if (port->mType != PORTT_LINKED) + { + line_t *dst = port->mDestination; + line_t *line = port->mOrigin; + DAngle angle = dst->Delta().Angle() - line->Delta().Angle() + 180.; + port->mSinRot = sindeg(angle.Degrees); // Here precision matters so use the slower but more precise versions. + port->mCosRot = cosdeg(angle.Degrees); + port->mAngleDiff = angle; + if ((line->sidedef[0]->Flags & WALLF_POLYOBJ) || (dst->sidedef[0]->Flags & WALLF_POLYOBJ)) + { + port->mFlags |= PORTF_POLYOBJ; + } + else + { + port->mFlags &= PORTF_POLYOBJ; + } + } + else + { + // Linked portals have no angular difference. + port->mSinRot = port->mCosRot = 0.; + port->mAngleDiff = 0.; + } } } @@ -593,6 +610,7 @@ void P_TranslatePortalXY(line_t* src, double& x, double& y) if (!src) return; FLinePortal *port = src->getPortal(); if (!port) return; + if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals. // offsets from line double nposx = x - src->v1->fX(); @@ -620,6 +638,7 @@ void P_TranslatePortalVXVY(line_t* src, double &velx, double &vely) if (!src) return; FLinePortal *port = src->getPortal(); if (!port) return; + if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals. double orig_velx = velx; double orig_vely = vely; @@ -638,6 +657,7 @@ void P_TranslatePortalAngle(line_t* src, DAngle& angle) if (!src) return; FLinePortal *port = src->getPortal(); if (!port) return; + if (port->mFlags & PORTF_POLYOBJ) SetRotation(port); // update the angle for polyportals. angle = (angle + port->mAngleDiff).Normalized360(); } diff --git a/src/portal.h b/src/portal.h index a87ae207f7..44d636e4bd 100644 --- a/src/portal.h +++ b/src/portal.h @@ -145,6 +145,7 @@ enum PORTF_PASSABLE = 2, PORTF_SOUNDTRAVERSE = 4, PORTF_INTERACTIVE = 8, + PORTF_POLYOBJ = 16, PORTF_TYPETELEPORT = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE, PORTF_TYPEINTERACTIVE = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE | PORTF_INTERACTIVE, From 8cf150e68a2b96ca1e381c7a0a608afa602cad39 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Jun 2016 12:40:38 +0200 Subject: [PATCH 03/18] - set up portal rotations in the finalizing step, not during initialization. Anything earlier may miss some information required to do this correctly. --- src/portal.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/portal.cpp b/src/portal.cpp index ec3d5d90ff..f180a4fbfa 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -342,11 +342,6 @@ void P_SpawnLinePortal(line_t* line) { port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE; } - - // Get the angle between the two linedefs, for rotating - // orientation and velocity. Rotate 180 degrees, and flip - // the position across the exit linedef, if reversed. - SetRotation(port); } else if (line->args[2] == PORTT_LINKEDEE && line->args[0] == 0) { @@ -367,7 +362,6 @@ void P_SpawnLinePortal(line_t* line) port->mType = PORTT_LINKED; port->mAlign = PORG_ABSOLUTE; port->mDefFlags = PORTF_TYPEINTERACTIVE; - SetRotation(port); // we need to create the backlink here, too. lines[i].portalindex = linePortals.Reserve(1); @@ -379,8 +373,6 @@ void P_SpawnLinePortal(line_t* line) port->mType = PORTT_LINKED; port->mAlign = PORG_ABSOLUTE; port->mDefFlags = PORTF_TYPEINTERACTIVE; - - SetRotation(port); } } } @@ -430,6 +422,9 @@ void P_UpdatePortal(FLinePortal *port) } } } + + // Cache the angle between the two linedefs, for rotating. + SetRotation(port); } //============================================================================ From de55d693f90c4a0ff836fa80221f8d0c2da8dd3a Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 19 Jun 2016 12:34:34 +0200 Subject: [PATCH 04/18] - Fixed ACS Singleplayer for non-net multiplayer. --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5df4da472e..b71fa1702b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8130,7 +8130,7 @@ scriptwait: break; case PCD_SINGLEPLAYER: - PushToStack (!netgame); + PushToStack (!multiplayer); break; // [BC] End ST PCD's From 2f6c98ead3029a5290455f2c7d6b25d994bad828 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 19 Jun 2016 22:56:35 +0200 Subject: [PATCH 05/18] - 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 b71fa1702b..7829ca0653 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 06/18] 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 3b57dd2830..2216ebf3a1 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 8e6f0f3388..ea22edbf4c 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 07/18] 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 2216ebf3a1..bab47ea2bd 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 08/18] 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 bab47ea2bd..4fc5bdeced 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 09/18] 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 4fc5bdeced..a1d7157e13 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 10/18] 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 a1d7157e13..ebfc14da33 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 11/18] 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 ea22edbf4c..01fa8a2a29 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 12/18] - 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 7829ca0653..9fc887daee 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 9cd4eedd73..13dad46515 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 13/18] 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 9fc887daee..1dfb1145a0 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 0acbdc35f2..0d30356231 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 610b6b17ee..d4baefe271 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 01fa8a2a29..07ca5debb1 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 160646ff05..7b75b481d1 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 14/18] 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 d4baefe271..4919442530 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 07ca5debb1..a531838d03 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 15/18] 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 1dfb1145a0..7cbfd69b48 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 0d30356231..ac6b264d92 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 98826268c5..e193235420 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 4919442530..b0979885a1 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 16/18] 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 b0979885a1..7a9ac1ce0a 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 17/18] - 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 61d13b6df2..a2c3794ae4 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 18/18] - 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 4c0d2537dc..d6d53dd77a 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;