From 2a0216cf6f5c9c5eb7146bfeff02f66e5d9268d9 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 14 Jun 2006 03:57:58 +0000 Subject: [PATCH] - Fixed: In the past, ZDoom worked like Doom and used integral values for monster speeds. Now it uses fixed point so that an actor's speed property can always be considered is always fixed point. So DoSetActorProperty() should scale very slow speeds, just like dehacked's PatchThing() has done for some time now. SVN r187 (trunk) --- docs/rh-log.txt | 7 ++++ src/d_dehacked.cpp | 2 +- src/p_acs.cpp | 82 +++++++++++++++++++++++++++++++++++++--------- 3 files changed, 75 insertions(+), 16 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c2c7dc4d2..b5207d419 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +June 13, 2006 +- Fixed: In the past, ZDoom worked like Doom and used integral values for + monster speeds. Now it uses fixed point so that an actor's speed property + can always be considered is always fixed point. So DoSetActorProperty() + should scale very slow speeds, just like dehacked's PatchThing() has done + for some time now. + June 11, 2006 (Changes by Graf Zahl) - Changed UpgradeStamina to use AInventory's Amount and MaxAmount to control the amount of upgrade and the maximum that can be reached. diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 723a5a813..db8de37b2 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1045,7 +1045,7 @@ static int PatchThing (int thingy) } // If this thing's speed is really low (i.e. meant to be a monster), // bump it up, because all speeds are fixed point now. - if (info->Speed < 256) + if (abs(info->Speed) < 256) { info->Speed <<= FRACBITS; } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 055ceda06..9c108d546 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1988,21 +1988,73 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) actor->player->health = value; } break; - case APROP_Speed: actor->Speed = value; break; - case APROP_Damage: actor->damage = value; break; - case APROP_Alpha: actor->alpha = value; break; - case APROP_RenderStyle: actor->RenderStyle = value; break; - case APROP_Ambush: if (value) actor->flags |= MF_AMBUSH; else actor->flags &= ~MF_AMBUSH; break; - case APROP_Invulnerable:if (value) actor->flags2 |= MF2_INVULNERABLE; else actor->flags2 &= ~MF2_INVULNERABLE; break; - case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) - static_cast(actor)->JumpZ = value; break; // [GRB] - case APROP_ChaseGoal: if (value) actor->flags5 |= MF5_CHASEGOAL; else actor->flags5 &= ~MF5_CHASEGOAL; break; - case APROP_Frightened: if (value) actor->flags4 |= MF4_FRIGHTENED; else actor->flags4 &= ~MF4_FRIGHTENED; break; - case APROP_SeeSound: actor->SeeSound = S_FindSound (FBehavior::StaticLookupString (value)); break; - case APROP_AttackSound: actor->AttackSound = S_FindSound (FBehavior::StaticLookupString (value)); break; - case APROP_PainSound: actor->PainSound = S_FindSound (FBehavior::StaticLookupString (value)); break; - case APROP_DeathSound: actor->DeathSound = S_FindSound (FBehavior::StaticLookupString (value)); break; - case APROP_ActiveSound: actor->ActiveSound = S_FindSound (FBehavior::StaticLookupString (value)); break; + + case APROP_Speed: + if (abs(value) < 128) + { // Backwards compatibility: Older ZDooms didn't use fixed point in A_Chase. + value <<= FRACBITS; + } + actor->Speed = value; + break; + + case APROP_Damage: + actor->damage = value; + break; + + case APROP_Alpha: + actor->alpha = value; + break; + + case APROP_RenderStyle: + actor->RenderStyle = value; + break; + + case APROP_Ambush: + if (value) actor->flags |= MF_AMBUSH; else actor->flags &= ~MF_AMBUSH; + break; + + case APROP_Invulnerable: + if (value) actor->flags2 |= MF2_INVULNERABLE; else actor->flags2 &= ~MF2_INVULNERABLE; + break; + + case APROP_JumpZ: + if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + static_cast(actor)->JumpZ = value; + break; // [GRB] + + case APROP_ChaseGoal: + if (value) + actor->flags5 |= MF5_CHASEGOAL; + else + actor->flags5 &= ~MF5_CHASEGOAL; + break; + + case APROP_Frightened: + if (value) + actor->flags4 |= MF4_FRIGHTENED; + else + actor->flags4 &= ~MF4_FRIGHTENED; + break; + + case APROP_SeeSound: + actor->SeeSound = S_FindSound (FBehavior::StaticLookupString (value)); + break; + + case APROP_AttackSound: + actor->AttackSound = S_FindSound (FBehavior::StaticLookupString (value)); + break; + + case APROP_PainSound: + actor->PainSound = S_FindSound (FBehavior::StaticLookupString (value)); + break; + + case APROP_DeathSound: + actor->DeathSound = S_FindSound (FBehavior::StaticLookupString (value)); + break; + + case APROP_ActiveSound: + actor->ActiveSound = S_FindSound (FBehavior::StaticLookupString (value)); + break; } }