diff --git a/artifacts/scripting/functions.yml b/artifacts/scripting/functions.yml index af7216bf..bd1252be 100644 --- a/artifacts/scripting/functions.yml +++ b/artifacts/scripting/functions.yml @@ -1425,15 +1425,17 @@ macro: sfall.h - name: set_rest_heal_time detail: void set_rest_heal_time(int time) - doc: 'Sets the time interval in minutes for healing during resting. The default is 180. Note: The interval will be reset each time the player reloads the game.' + doc: | + Sets the time interval in minutes for healing during resting. The default is 180 + - the time interval will be reset each time the player reloads the game macro: sfall.h - name: set_worldmap_heal_time detail: void set_worldmap_heal_time(int time) doc: | - Sets the time interval in minutes for healing during worldmap travel. - - passing 0 will revert to 1 second per real time (vanilla behavior) + Sets the time interval in minutes for healing during world map travel + - passing 0 will revert to 1 second in real time (vanilla engine behavior) - passing -1 will disable healing during travel - - the interval will be reset each time the player reloads the game + - the time interval will be reset each time the player reloads the game macro: sfall.h - name: set_rest_mode detail: void set_rest_mode(int flags) diff --git a/artifacts/scripting/hooks.yml b/artifacts/scripting/hooks.yml index 8c5046a5..233e3557 100644 --- a/artifacts/scripting/hooks.yml +++ b/artifacts/scripting/hooks.yml @@ -528,7 +528,7 @@ - name: CarTravel id: HOOK_CARTRAVEL doc: | - Runs continuously during worldmap travel on car. + Runs continuously during world map travel by car. ``` int arg0 - vanilla car speed (between 3 and 8 "steps") diff --git a/artifacts/scripting/hookscripts.md b/artifacts/scripting/hookscripts.md index 0c682bfc..5c691110 100644 --- a/artifacts/scripting/hookscripts.md +++ b/artifacts/scripting/hookscripts.md @@ -606,7 +606,7 @@ int ret0 - pass 1 at the start of turn to skip the turn, pass -1 at the end #### `HOOK_CARTRAVEL (hs_cartravel.int)` -Runs continuously during worldmap travel on car. +Runs continuously during world map travel by car. ``` int arg0 - vanilla car speed (between 3 and 8 "steps") diff --git a/artifacts/scripting/sfall function notes.md b/artifacts/scripting/sfall function notes.md index 56c67732..cc4d4afa 100644 --- a/artifacts/scripting/sfall function notes.md +++ b/artifacts/scripting/sfall function notes.md @@ -1149,6 +1149,14 @@ sfall_funcX metarule functions - `frame`: frame number, the first frame starts from zero - `rotation`: rotation to get the frame for, useful when reading FRM files by path +---- +#### set_worldmap_heal_time +`void sfall_func1("set_worldmap_heal_time", int minutes)` +- Sets the time interval in minutes for healing during world map travel +- Passing 0 will revert to 1 second in real time (vanilla engine behavior) +- Passing -1 will disable healing during travel +- The time interval will be reset each time the player reloads the game + **** _See other documentation files (arrays.md, hookscripts.md) for related functions reference._ diff --git a/sfall/Modules/Worldmap.cpp b/sfall/Modules/Worldmap.cpp index 860814ff..54c16807 100644 --- a/sfall/Modules/Worldmap.cpp +++ b/sfall/Modules/Worldmap.cpp @@ -464,7 +464,7 @@ static void WorldmapFpsPatch() { // So we hijack it and return number bigger than 1000 to force the event, or 0 to skip it. static DWORD __fastcall wmWorldMap_HealingTimeElapsed(DWORD elapsedTocks) { if (worldMapHealingInterval == 0) return elapsedTocks; - if (worldMapHealingInterval > 0 && ((long)(fo::var::fallout_game_time - worldMapLastHealTime) > worldMapHealingInterval)) { + if (worldMapHealingInterval > 0 && (fo::var::fallout_game_time - worldMapLastHealTime > (DWORD)worldMapHealingInterval)) { worldMapLastHealTime = fo::var::fallout_game_time; return 10000; // force healing } @@ -475,9 +475,9 @@ static void __declspec(naked) wmWorldMap_elapsed_tocks_hook() { __asm { push ecx; call fo::funcoffs::elapsed_tocks_; - mov ecx, eax; + mov ecx, eax; call wmWorldMap_HealingTimeElapsed; - pop ecx; + pop ecx; retn; } } @@ -617,7 +617,7 @@ void Worldmap::SetCarInterfaceArt(DWORD artIndex) { SafeWrite32(0x4C2D9B, artIndex); } -void Worldmap::SetRestHealTime(DWORD minutes) { +void Worldmap::SetRestHealTime(long minutes) { if (minutes > 0) { SafeWrite32(0x499FDE, minutes); restTime = (minutes != 180); @@ -625,9 +625,9 @@ void Worldmap::SetRestHealTime(DWORD minutes) { } void Worldmap::SetWorldMapHealTime(long minutes) { - worldMapHealingInterval = minutes >= 0 - ? minutes * 60 * 10 - : -1; + worldMapHealingInterval = (minutes >= 0) + ? minutes * 60 * 10 + : -1; worldMapLastHealTime = fo::var::fallout_game_time; } diff --git a/sfall/Modules/Worldmap.h b/sfall/Modules/Worldmap.h index 6e76df09..12c2f4df 100644 --- a/sfall/Modules/Worldmap.h +++ b/sfall/Modules/Worldmap.h @@ -35,7 +35,7 @@ public: static bool LoadData(HANDLE); static void SetCarInterfaceArt(DWORD artIndex); - static void SetRestHealTime(DWORD minutes); + static void SetRestHealTime(long minutes); static void SetWorldMapHealTime(long minutes); static void SetRestMode(DWORD mode); static void SetRestMapLevel(int mapId, long elev, bool canRest);