From 5f6aad30f5b358973af21f1d105e7e6b5df27caa Mon Sep 17 00:00:00 2001 From: gez Date: Sat, 23 Feb 2013 00:53:43 +0000 Subject: [PATCH] * Updated to ZDoom 4161: - Fixed: RandomSpawner could hang on lists with monsters when nomonsters is enabled or with 'None' items. - Fixed: A TITLEMAP defined with SpawnWithWeaponRaised set caused a crash. - Fixed: r4067 completely disabled weapon switching via A_ReFire. - Fixed: r3860 inadvertently inverted the damage check for thrusting in P_RadiusAttack(). - Cleared GCC warnings. - Fixed: strcpy on map arrays didn't properly translate the array number. - Fixed: the ExplosiveBarrel's height was wrong. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1531 b0f79afe-0144-0410-b225-9a4edf0717df --- src/d_player.h | 1 + src/g_shared/a_artifacts.cpp | 1 - src/g_shared/a_randomspawner.cpp | 24 +++++++++++++----------- src/p_acs.cpp | 11 ++++++++--- src/p_map.cpp | 4 ++-- src/p_pspr.cpp | 26 ++++++++++++++++++++------ src/p_pspr.h | 2 +- src/p_user.cpp | 2 +- src/svnrevision.h | 4 ++-- wadsrc/static/actors/doom/doommisc.txt | 2 +- 10 files changed, 49 insertions(+), 28 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 76c70819..48c38744 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -215,6 +215,7 @@ enum WF_DISABLESWITCH = 1 << 4, // Disable weapon switching completely WF_WEAPONRELOADOK = 1 << 5, // [XA] Okay to reload this weapon. WF_WEAPONZOOMOK = 1 << 6, // [XA] Okay to use weapon zoom function. + WF_REFIRESWITCHOK = 1 << 7, // Mirror WF_WEAPONSWITCHOK for A_ReFire }; #define WPIECE1 1 diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index ac9ccde8..adad4e2c 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1107,7 +1107,6 @@ void APowerWeaponLevel2::EndEffect () Super::EndEffect(); if (player != NULL) { - if (player->ReadyWeapon != NULL && player->ReadyWeapon->WeaponFlags & WIF_POWERED_UP) { diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 549c957a..fc7ca8cf 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -59,22 +59,24 @@ class ARandomSpawner : public AActor // Take a random number... n = pr_randomspawn(n); // And iterate in the array up to the random number chosen. - while (n > -1) + while (n > -1 && di != NULL) { - if (di->Name != NAME_None) + if (di->Name != NAME_None && + (!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER))) { - if (!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER)) - { - n -= di->amount; - if ((di->Next != NULL) && (n > -1)) - di = di->Next; - else - n = -1; - } + n -= di->amount; + if ((di->Next != NULL) && (n > -1)) + di = di->Next; + else + n = -1; + } + else + { + di = di->Next; } } // So now we can spawn the dropped item. - if (bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions + if (di == NULL || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions { Spawn("Unknown", x, y, z, NO_REPLACE); // Show that there's a problem. Destroy(); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 1527ba84..7bfc87f3 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -7327,7 +7327,12 @@ scriptwait: { case PCD_STRCPYTOMAPCHRANGE: { - Stack[sp-6] = activeBehavior->CopyStringToArray(STACK(5), index, capacity, lookup); + int a = STACK(5); + if (a < NUM_MAPVARS && a > 0 && + activeBehavior->MapVars[a]) + { + Stack[sp-6] = activeBehavior->CopyStringToArray(*(activeBehavior->MapVars[a]), index, capacity, lookup); + } } break; case PCD_STRCPYTOWORLDCHRANGE: @@ -7856,7 +7861,7 @@ static void ShowProfileData(TArray &profiles, long ilimit, } // Module name - mysnprintf(modname, sizeof(modname), prof->Module->GetModuleName()); + mysnprintf(modname, sizeof(modname), "%s", prof->Module->GetModuleName()); // Script/function name if (functions) @@ -7932,7 +7937,7 @@ CCMD(acsprofile) // If it's a name, set the sort method. We accept partial matches for // options that are shorter than the sort name. size_t optlen = strlen(argv[i]); - int j; + unsigned int j; for (j = 0; j < countof(sort_names); ++j) { if (optlen < sort_match_len[j] || optlen > strlen(sort_names[j])) diff --git a/src/p_map.cpp b/src/p_map.cpp index ad678b52..233d4528 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -908,7 +908,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm) if (!(tm.thing->flags & MF_MISSILE) || !(tm.thing->flags2 & MF2_RIP) || (thing->flags5 & MF5_DONTRIP) || - (tm.thing->flags6 & MF6_NOBOSSRIP) && (thing->flags2 & MF2_BOSS)) + ((tm.thing->flags6 & MF6_NOBOSSRIP) && (thing->flags2 & MF2_BOSS))) { if (tm.thing->flags3 & thing->flags3 & MF3_DONTOVERLAP) { // Some things prefer not to overlap each other, if possible @@ -4581,7 +4581,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b if (!(flags & RADF_NODAMAGE) && !(bombspot->flags3 & MF3_BLOODLESSIMPACT)) P_TraceBleed (newdam > 0 ? newdam : damage, thing, bombspot); - if (!(flags & RADF_NODAMAGE) || !(bombspot->flags2 & MF2_NODMGTHRUST)) + if ((flags & RADF_NODAMAGE) || !(bombspot->flags2 & MF2_NODMGTHRUST)) { if (bombsource == NULL || !(bombsource->flags2 & MF2_NODMGTHRUST)) { diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index d91b2a88..85830ac5 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -170,8 +170,11 @@ void P_BringUpWeapon (player_t *player) if (player->PendingWeapon == WP_NOCHANGE) { - player->psprites[ps_weapon].sy = WEAPONTOP; - P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetReadyState()); + if (player->ReadyWeapon != NULL) + { + player->psprites[ps_weapon].sy = WEAPONTOP; + P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetReadyState()); + } return; } @@ -477,12 +480,22 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y) // //============================================================================ -void DoReadyWeaponToSwitch (AActor *self) +void DoReadyWeaponToSwitch (AActor *self, bool switchable) { // Prepare for switching action. player_t *player; if (self && (player = self->player)) - player->WeaponState |= WF_WEAPONSWITCHOK; + { + if (switchable) + { + player->WeaponState |= WF_WEAPONSWITCHOK | WF_REFIRESWITCHOK; + } + else + { + // WF_WEAPONSWITCHOK is automatically cleared every tic by P_SetPsprite(). + player->WeaponState &= ~WF_REFIRESWITCHOK; + } + } } void DoReadyWeaponDisableSwitch (AActor *self, INTBOOL disable) @@ -494,6 +507,7 @@ void DoReadyWeaponDisableSwitch (AActor *self, INTBOOL disable) if (disable) { player->WeaponState |= WF_DISABLESWITCH; + player->WeaponState &= ~WF_REFIRESWITCHOK; } else { @@ -589,7 +603,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady) ACTION_PARAM_START(1); ACTION_PARAM_INT(paramflags, 0); - if (!(paramflags & WRF_NoSwitch)) DoReadyWeaponToSwitch(self); + DoReadyWeaponToSwitch(self, !(paramflags & WRF_NoSwitch)); if ((paramflags & WRF_NoFire) != WRF_NoFire) DoReadyWeaponToFire(self, !(paramflags & WRF_NoPrimary), !(paramflags & WRF_NoSecondary)); if (!(paramflags & WRF_NoBob)) DoReadyWeaponToBob(self); if ((paramflags & WRF_AllowReload)) DoReadyWeaponToReload(self); @@ -739,7 +753,7 @@ void A_ReFire(AActor *self, FState *state) { return; } - pending = player->PendingWeapon == WP_NOCHANGE && (player->WeaponState & WF_WEAPONSWITCHOK); + pending = player->PendingWeapon != WP_NOCHANGE && (player->WeaponState & WF_REFIRESWITCHOK); if ((player->cmd.ucmd.buttons & BT_ATTACK) && !player->ReadyWeapon->bAltFire && !pending && player->health > 0) { diff --git a/src/p_pspr.h b/src/p_pspr.h index 83cce732..ca9b45ee 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -94,7 +94,7 @@ void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch void DoReadyWeapon(AActor * self); void DoReadyWeaponToBob(AActor * self); void DoReadyWeaponToFire(AActor * self, bool primary = true, bool secondary = true); -void DoReadyWeaponToSwitch(AActor * self); +void DoReadyWeaponToSwitch(AActor * self, bool switchable = true); DECLARE_ACTION(A_Raise) void A_ReFire(AActor *self, FState *state = NULL); diff --git a/src/p_user.cpp b/src/p_user.cpp index 76aecdc3..a3e848fe 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -244,10 +244,10 @@ player_t::player_t() lastkilltime(0), multicount(0), spreecount(0), + WeaponState(0), ReadyWeapon(0), PendingWeapon(0), cheats(0), - WeaponState(0), timefreezer(0), refire(0), inconsistant(0), diff --git a/src/svnrevision.h b/src/svnrevision.h index 8c7dce3f..c270fa31 100644 --- a/src/svnrevision.h +++ b/src/svnrevision.h @@ -3,5 +3,5 @@ // This file was automatically generated by the // updaterevision tool. Do not edit by hand. -#define ZD_SVN_REVISION_STRING "4154" -#define ZD_SVN_REVISION_NUMBER 4154 +#define ZD_SVN_REVISION_STRING "4161" +#define ZD_SVN_REVISION_NUMBER 4161 diff --git a/wadsrc/static/actors/doom/doommisc.txt b/wadsrc/static/actors/doom/doommisc.txt index 0b481427..131bb273 100644 --- a/wadsrc/static/actors/doom/doommisc.txt +++ b/wadsrc/static/actors/doom/doommisc.txt @@ -6,7 +6,7 @@ ACTOR ExplosiveBarrel 2035 SpawnID 125 Health 20 Radius 10 - Height 34 + Height 42 +SOLID +SHOOTABLE +NOBLOOD