From 7d5a1c2e9e525e0dd7913dc5eb643369be25a7d9 Mon Sep 17 00:00:00 2001 From: noooooo4499 <32027706+noooooo4499@users.noreply.github.com> Date: Wed, 11 Feb 2026 22:39:44 -0500 Subject: [PATCH] Remove useless lua gameclock variables, add lua externalized function to heal boxers - These gameclock variables were not updated properly so it created a discrepancy between it and the proper gameclock variables, and it was causing issues with the lua hourly update script - Function that heals boxers after they finish resting --- Strategic/Game Clock.cpp | 4 ---- Strategic/LuaInitNPCs.cpp | 26 +++++++++++++++++++++++--- Strategic/LuaInitNPCs.h | 3 --- Strategic/Luaglobal.cpp | 9 --------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Strategic/Game Clock.cpp b/Strategic/Game Clock.cpp index b1c3871d..e3462ca6 100644 --- a/Strategic/Game Clock.cpp +++ b/Strategic/Game Clock.cpp @@ -249,10 +249,6 @@ void AdvanceClock( UINT8 ubWarpCode ) guiDay = ( guiGameClock / NUM_SEC_IN_DAY ); guiHour = ( guiGameClock - ( guiDay * NUM_SEC_IN_DAY ) ) / NUM_SEC_IN_HOUR; guiMin = ( guiGameClock - ( ( guiDay * NUM_SEC_IN_DAY ) + ( guiHour * NUM_SEC_IN_HOUR ) ) ) / NUM_SEC_IN_MIN; - - uiHourLua = guiHour; - uiDayLua = guiDay; - uiMinLua = guiMin; swprintf( WORLDTIMESTR, L"%s %d, %02d:%02d", gpGameClockString[ STR_GAMECLOCK_DAY_NAME ], guiDay, guiHour, guiMin ); diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 49b110f9..a4904e5e 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -859,6 +859,7 @@ static int l_PlayerTeamFull(lua_State* L); static int l_ProfilesStrategicInsertionData(lua_State* L); +static int l_HealBoxers(lua_State* L); static int l_ResetBoxers(lua_State* L); static int l_AddVolunteers(lua_State* L); @@ -912,9 +913,6 @@ static int l_SetIntelAndQuestMapDataForSector(lua_State* L); using namespace std; UINT16 idProfil; -UINT32 uiHourLua; -UINT32 uiDayLua; -UINT32 uiMinLua; UINT16 PROFILLUA_sSectorX; UINT16 PROFILLUA_sSectorY; @@ -1189,6 +1187,7 @@ static void IniFunction(lua_State* L, BOOLEAN bQuests) lua_register(L, "TacticalCharacterDialogueWithSpecialEvent", l_TacticalCharacterDialogueWithSpecialEvent); lua_register(L, "SetSalary", l_MercSalary); lua_register(L, "SetProfileStrategicInsertionData", l_ProfilesStrategicInsertionData); + lua_register(L, "HealBoxers", l_HealBoxers); //Get merc lua_register(L, "GetDirection", l_GetDirection); //new @@ -9315,6 +9314,27 @@ static int l_ResetBoxers(lua_State* L) return 0; } +// heal boxers back to max health in case the player stays in sector while the boxers are resting +static int l_HealBoxers(lua_State* L) +{ + for (UINT8 i = 0; i < NUM_BOXERS; ++i) + { + // Get breath back + gubBoxerID[i]->bBreath = gubBoxerID[i]->bBreathMax; + gubBoxerID[i]->sBreathRed = 0; + // Get life back + gubBoxerID[i]->stats.bLife = gubBoxerID[i]->stats.bLifeMax; + gubBoxerID[i]->bBleeding = 0; + // erase insta-healable injury + gubBoxerID[i]->iHealableInjury = 0; + + DebugQuestInfo(String("Lua: healed gubBoxerID[%d] %d back to full health", i, gubBoxerID[i])); + } + + return 0; +} + + //Set character to sector Y static int l_SetCharacterSectorY(lua_State* L) { diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index 41f25eab..6a228338 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -26,9 +26,6 @@ typedef struct extern ACTION_ITEM_VALUES ActionItemsValues[500]; -extern UINT32 uiHourLua; -extern UINT32 uiDayLua; -extern UINT32 uiMinLua; extern UINT16 PROFILLUA_sSectorX; extern UINT16 PROFILLUA_sSectorY; extern UINT8 PROFILLUA_bSectorZ; diff --git a/Strategic/Luaglobal.cpp b/Strategic/Luaglobal.cpp index 3c13deea..2efe2cf1 100644 --- a/Strategic/Luaglobal.cpp +++ b/Strategic/Luaglobal.cpp @@ -510,15 +510,6 @@ void IniGlobalGameSetting(lua_State *L) lua_pushinteger(L, gubBoxingMatchesWon); lua_setglobal(L, "gubBoxingMatchesWon"); - lua_pushinteger(L, uiHourLua); - lua_setglobal(L, "cHour"); - - lua_pushinteger(L, uiDayLua); - lua_setglobal(L, "cDay"); - - lua_pushinteger(L, uiMinLua); - lua_setglobal(L, "cMin"); - lua_pushinteger(L, gbPlayerNum); lua_setglobal(L, "gbPlayerNum");