aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-20 20:51:06 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit493c8ed4bcdfc02b5327ad0e2e083cd4e8158736 (patch)
treef8c1d41c8a084d61fc0487f40ad2a2ff9f86478e
parentef2411f7afe060ce60b6b2d6d607dc3d8d339021 (diff)
downloadscummvm-rg350-493c8ed4bcdfc02b5327ad0e2e083cd4e8158736.tar.gz
scummvm-rg350-493c8ed4bcdfc02b5327ad0e2e083cd4e8158736.tar.bz2
scummvm-rg350-493c8ed4bcdfc02b5327ad0e2e083cd4e8158736.zip
DM: Add F0306_CHAMPION_GetStaminaAdjustedValue
-rw-r--r--engines/dm/champion.cpp11
-rw-r--r--engines/dm/champion.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index b30d3390c5..f38552ac32 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -336,4 +336,15 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) {
warning("MISSING CODE: F0078_MOUSE_ShowPointer");
}
+
+int16 ChampionMan::getStaminaAdjustedValue(Champion *champ, int16 val) {
+ int16 currStamina = champ->_currStamina;
+ int16 halfMaxStamina = champ->_maxStamina / 2;
+ if (currStamina < halfMaxStamina) {
+ val /= 2;
+ return val + ((uint32)val * (uint32)currStamina) / halfMaxStamina;
+ }
+ return val;
+}
+
} \ No newline at end of file
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index b92462d61c..6271c94fc6 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -405,6 +405,7 @@ public:
void resetDataToStartGame(); // @ F0278_CHAMPION_ResetDataToStartGame
void addCandidateChampionToParty(uint16 championPortraitIndex); // @ F0280_CHAMPION_AddCandidateChampionToParty
void drawChampionBarGraphs(ChampionIndex champIndex); // @ F0287_CHAMPION_DrawBarGraphs
+ int16 getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue
};