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; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 29c9fe8fe..7cbfd69b4 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) { @@ -4241,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 @@ -8094,6 +8048,17 @@ 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() ); + else + PushToStack( 0 ); + break; + case PCD_PLAYERHEALTH: if (activator) PushToStack (activator->health); @@ -8130,7 +8095,7 @@ scriptwait: break; case PCD_SINGLEPLAYER: - PushToStack (!netgame); + PushToStack (!multiplayer); break; // [BC] End ST PCD's @@ -9574,8 +9539,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 e3c502f7c..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, @@ -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, diff --git a/src/p_local.h b/src/p_local.h index 0acbdc35f..ac6b264d9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -159,9 +159,35 @@ 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); +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/p_pspr.cpp b/src/p_pspr.cpp index 3b57dd283..ebfc14da3 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1135,16 +1135,64 @@ 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; + if (player == nullptr || (dontoverride && (player->FindPSprite(layer) != nullptr))) + { + ACTION_RETURN_BOOL(false); + } DPSprite *pspr; 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 (!self->player) + ACTION_RETURN_INT(0); + + player_t *player = self->player; + if (!start && !stop) + { + start = INT_MIN; + stop = safety ? PSP_TARGETCENTER - 1 : INT_MAX; + } + + int count = 0; + DPSprite *pspr = player->psprites; + while (pspr != nullptr) + { + int id = pspr->GetID(); + + //Do not wipe out layer 0. Ever. + if (!id || id < start) + continue; + if (id > stop) + break; + + if (safety) + { + if (id >= PSP_TARGETCENTER) + break; + else if ((id >= PSP_STRIFEHANDS && id <= PSP_WEAPON) || (id == PSP_FLASH)) + continue; + } + + // [MC]Don't affect non-hardcoded layers unless it's really desired. + pspr->SetState(nullptr); + count++; + pspr = pspr->GetNext(); + } + ACTION_RETURN_INT(count); } // 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/portal.cpp b/src/portal.cpp index 41f2e755e..f180a4fbf 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.; + } } } @@ -325,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) { @@ -350,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); @@ -362,8 +373,6 @@ void P_SpawnLinePortal(line_t* line) port->mType = PORTT_LINKED; port->mAlign = PORG_ABSOLUTE; port->mDefFlags = PORTF_TYPEINTERACTIVE; - - SetRotation(port); } } } @@ -413,6 +422,9 @@ void P_UpdatePortal(FLinePortal *port) } } } + + // Cache the angle between the two linedefs, for rotating. + SetRotation(port); } //============================================================================ @@ -593,6 +605,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 +633,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 +652,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 a87ae207f..44d636e4b 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, diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 610b6b17e..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()); } @@ -543,6 +545,39 @@ 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_DEFAULT; } + + AActor *mobj = COPY_AAPTR(self, ptr); + + //Need a player. + if (!mobj || !mobj->player) + { + ret->SetInt(0); + } + else + { + ret->SetInt(P_Thing_CheckInputNum(mobj->player, inputnum)); + } + return 1; + } + return 0; +} + //=========================================================================== // // __decorate_internal_state__ diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 8e6f0f338..a531838d0 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_DEFAULT); // Action functions // Meh, MBF redundant functions. Only for DeHackEd support. @@ -329,12 +330,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 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); 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); 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, +}; diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index d5f831d50..7a16b9ae0 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 {