From ebbe9c84f81bdc4ebc37f8f51a047510e4cb7cfd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 28 Jan 2008 09:39:46 +0000 Subject: [PATCH] - Added SnowKate709's APROP_MaxHealth submission. - Fixed: FTexture::GetScaledWidth/Height always rounded down which could result in imprecisions (e.g. when scaling from 128 to 96.) SVN r722 (trunk) --- docs/rh-log.txt | 3 +++ src/p_acs.cpp | 18 ++++++++++++++++++ src/r_defs.h | 8 ++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 6ebf08155..041bab805 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ January 27, 2008 (Changes by Graf Zahl) +- Added SnowKate709's APROP_MaxHealth submission. +- Fixed: FTexture::GetScaledWidth/Height always rounded down which could result in + imprecisions (e.g. when scaling from 128 to 96.) - added a mastervolume CVAR for Timidity because for me its output is considerably louder than everything else. - reverted removal of AddPatch call in crosshair initialization. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 597251e28..99450f7b0 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2146,6 +2146,7 @@ void DLevelScript::DoSetFont (int fontnum) #define APROP_Frightened 14 #define APROP_Gravity 15 #define APROP_Friendly 16 +#define APROP_SpawnHealth 17 #define APROP_SeeSound 5 // Sounds can only be set, not gotten #define APROP_AttackSound 6 #define APROP_PainSound 7 @@ -2259,6 +2260,14 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) actor->flags &= ~MF_FRIENDLY; break; + + case APROP_SpawnHealth: + if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + { + static_cast(actor)->MaxHealth = value; + } + break; + case APROP_Gravity: actor->gravity = value; break; @@ -2327,6 +2336,15 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_ChaseGoal: return !!(actor->flags5 & MF5_CHASEGOAL); case APROP_Frightened: return !!(actor->flags4 & MF4_FRIGHTENED); case APROP_Friendly: return !!(actor->flags & MF_FRIENDLY); + case APROP_SpawnHealth: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + { + return static_cast(actor)->MaxHealth; + } + else + { + return actor->GetDefault()->health; + } + case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) { return static_cast(actor)->JumpZ; // [GRB] diff --git a/src/r_defs.h b/src/r_defs.h index 311018409..a2f09710f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -688,11 +688,11 @@ public: int GetWidth () { return Width; } int GetHeight () { return Height; } - int GetScaledWidth () { return DivScale16(Width, xScale); } - int GetScaledHeight () { return DivScale16(Height, yScale); } + int GetScaledWidth () { return ((Width<<16) + (xScale>>1)) / xScale; } + int GetScaledHeight () { return ((Height<<16) + (yScale>>1)) / yScale; } - int GetScaledLeftOffset () { return DivScale16(LeftOffset, xScale); } - int GetScaledTopOffset () { return DivScale16(TopOffset, yScale); } + int GetScaledLeftOffset () { return ((LeftOffset<<16) + (xScale>>1)) / xScale; } + int GetScaledTopOffset () { return ((TopOffset<<16) + (yScale>>1)) / yScale; } virtual void SetFrontSkyLayer();