diff --git a/artifacts/scripting/headers/define_extra.h b/artifacts/scripting/headers/define_extra.h index 8831c1bf..80db7216 100644 --- a/artifacts/scripting/headers/define_extra.h +++ b/artifacts/scripting/headers/define_extra.h @@ -31,7 +31,7 @@ #define WEAPON_BIGGUN 256 // 0x00000100 - Big Gun #define WEAPON_2HAND 512 // 0x00000200 - 2Hnd (weapon is two-handed) -#define WEAPON_ENERGYWEAPON 1024 // 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill) +#define WEAPON_ENERGY 1024 // 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill) #define ATKMODE_PRI_NONE 0 #define ATKMODE_PRI_PUNCH 1 // 0001 diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h index beefc5dc..2f6e1927 100644 --- a/artifacts/scripting/headers/sfall.h +++ b/artifacts/scripting/headers/sfall.h @@ -19,6 +19,7 @@ #define BARTER (0x20000) #define HEROWIN (0x40000) #define DIALOGVIEW (0x80000) +#define COUNTERWIN (0x100000) // counter window for moving multiple items or setting a timer //Valid arguments to register_hook #define HOOK_TOHIT (0) diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index 0da5a1df..6bb2e18b 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -613,6 +613,7 @@ optional arguments: > int sfall_func2("add_extra_msg_file", string fileName, int fileNumber) - loads the custom message file, and returns the file ID number assigned to it in range from 0x3000 to 0x3FFF for the message_str_game function to get messages from the file - fileName: the name of the custom message file (including the .msg extension) in "text\\game\" directory +- NOTE: if the msg file does not exist in the current language directory, the function will try to load it from "text\English\game\" directory optional argument: - fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini) use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way diff --git a/sfall/FalloutEngine/Enums.h b/sfall/FalloutEngine/Enums.h index 9af46a21..5eb62138 100644 --- a/sfall/FalloutEngine/Enums.h +++ b/sfall/FalloutEngine/Enums.h @@ -274,7 +274,10 @@ enum ProtoId : long PID_JESSE_CONTAINER = 467, PID_Player = 16777216, - PID_DRIVABLE_CAR = 33555441 + PID_DRIVABLE_CAR = 33555441, + + // misc type + PID_CORPSE_BLOOD = 0x05000004, }; //XXXXXXXXXXXXXXXXXXXXX diff --git a/sfall/Modules/LoadGameHook.cpp b/sfall/Modules/LoadGameHook.cpp index b9099f46..bdb88b42 100644 --- a/sfall/Modules/LoadGameHook.cpp +++ b/sfall/Modules/LoadGameHook.cpp @@ -417,7 +417,7 @@ static void __declspec(naked) game_close_hook() { static void __declspec(naked) WorldMapHook() { __asm { _InLoop(1, WORLDMAP); - xor eax, eax; + xor eax, eax; // unused call fo::funcoffs::wmWorldMapFunc_; _InLoop(0, WORLDMAP); retn; @@ -617,6 +617,22 @@ static void __declspec(naked) DialogReviewExitHook() { } } +static void __declspec(naked) setup_move_timer_win_Hook() { + __asm { + _InLoop2(1, COUNTERWIN); + jmp fo::funcoffs::text_curr_; + } +} + +static void __declspec(naked) exit_move_timer_win_Hook() { + __asm { + push eax; + _InLoop2(0, COUNTERWIN); + pop eax; + jmp fo::funcoffs::win_delete_; + } +} + void LoadGameHook::init() { saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1); if (saveInCombatFix > 2) saveInCombatFix = 0; @@ -650,7 +666,7 @@ void LoadGameHook::init() { 0x480CA7, // gnw_main_ //0x480D45 // main_exit_system_ (never called) }); - + // game modes HookCalls(WorldMapHook, {0x483668, 0x4A4073}); HookCalls(WorldMapHook2, {0x4C4855}); HookCalls(CombatHook, {0x426A29, 0x4432BE, 0x45F6D2, 0x4A4020, 0x4A403D}); @@ -673,6 +689,8 @@ void LoadGameHook::init() { HookCalls(AutomapHook, {0x44396D, 0x479519}); HookCall(0x445CA7, DialogReviewInitHook); HookCall(0x445D30, DialogReviewExitHook); + HookCall(0x476AC6, setup_move_timer_win_Hook); // before init win + HookCall(0x477067, exit_move_timer_win_Hook); } Delegate<>& LoadGameHook::OnGameInit() { diff --git a/sfall/Modules/LoadGameHook.h b/sfall/Modules/LoadGameHook.h index 17dfacd6..9aaa0402 100644 --- a/sfall/Modules/LoadGameHook.h +++ b/sfall/Modules/LoadGameHook.h @@ -89,6 +89,7 @@ enum LoopFlag : unsigned long { BARTER = 1 << 17, // 0x20000 HEROWIN = 1 << 18, // 0x40000 Hero Appearance mod DIALOGVIEW = 1 << 19, // 0x80000 + COUNTERWIN = 1 << 20, // 0x100000 Counter window for moving multiple items or setting a timer // RESERVED = 1 << 31 }; diff --git a/sfall/Modules/Message.cpp b/sfall/Modules/Message.cpp index 638a99b5..dd79f94c 100644 --- a/sfall/Modules/Message.cpp +++ b/sfall/Modules/Message.cpp @@ -105,7 +105,7 @@ static void ReadExtraGameMsgFiles() { } path += ".msg"; fo::MessageList* list = new fo::MessageList(); - if (fo::func::message_load(list, (char*)path.data()) == 1) { + if (fo::func::message_load(list, path.c_str()) == 1) { gExtraGameMsgLists.insert(std::make_pair(0x2000 + number, list)); } else { delete list; @@ -125,13 +125,16 @@ long Message::AddExtraMsgFile(const char* msgName, long msgNumber) { std::string path("game\\"); path += msgName; fo::MessageList* list = new fo::MessageList(); - if (fo::func::message_load(list, path.c_str())) { - if (msgNumber == 0) msgNumber = msgNumCounter++; - gExtraGameMsgLists.emplace(msgNumber, list); - } else { - delete list; - msgNumber = -2; + if (!fo::func::message_load(list, path.c_str())) { + // change current language folder + path.insert(0, "..\\english\\"); + if (!fo::func::message_load(list, path.c_str())) { + delete list; + return -2; + } } + if (msgNumber == 0) msgNumber = msgNumCounter++; + gExtraGameMsgLists.emplace(msgNumber, list); return msgNumber; } diff --git a/sfall/Modules/Objects.cpp b/sfall/Modules/Objects.cpp index d20aa9ae..7bfe3f68 100644 --- a/sfall/Modules/Objects.cpp +++ b/sfall/Modules/Objects.cpp @@ -199,7 +199,8 @@ void Objects::LoadProtoAutoMaxLimit() { } static void __declspec(naked) obj_insert_hack() { - using namespace fo::Fields; + using namespace fo; + using namespace Fields; __asm { mov edi, [ebx]; mov [esp + 0x38 - 0x1C + 4], esi; // 0 @@ -208,7 +209,7 @@ static void __declspec(naked) obj_insert_hack() { retn; insert: mov esi, [ecx]; // esi - inserted object - cmp dword ptr [esi + protoId], 0x5000004; // corpse blood pid + cmp dword ptr [esi + protoId], PID_CORPSE_BLOOD; jnz skip; xor edi, edi; skip: