diff --git a/sfall/Modules/Objects.cpp b/sfall/Modules/Objects.cpp index bdbf1e30..dcb78144 100644 --- a/sfall/Modules/Objects.cpp +++ b/sfall/Modules/Objects.cpp @@ -109,8 +109,9 @@ pickNewID: // skip PM range (18000 - 16795215) } // Reassigns object IDs to all critters upon first loading a map and updates their HP stats +// also fixes their combat_data.who_hit_me values (same as map_fix_critter_combat_data_) // TODO: for items? -static void map_fix_critter_id() { +static void __stdcall map_fix_critter_id_combat_data() { long npcStartID = 4096; // 0x1000 fo::GameObject* obj = fo::func::obj_find_first(); while (obj) { @@ -119,19 +120,15 @@ static void map_fix_critter_id() { obj->id = npcStartID++; Objects::SetScriptObjectID(obj); } + if (obj->critter.whoHitMe == (fo::GameObject*)-1) { + obj->critter.whoHitMe = nullptr; + } Stats::UpdateHPStat(obj); } obj = fo::func::obj_find_next(); } } -static __declspec(naked) void map_load_file_hook() { - __asm { - call map_fix_critter_id; - jmp fo::funcoffs::map_fix_critter_combat_data_; - } -} - static __declspec(naked) void queue_add_hack() { using namespace fo; using namespace Fields; @@ -270,7 +267,7 @@ void Objects::init() { MakeCall(0x477A0E, item_identical_hack); // don't put item with unique ID to items stack // Fix mapper bug by reassigning object IDs to critters (for unvisited maps) - HookCall(0x482DE2, map_load_file_hook); + HookCall(0x482DE2, map_fix_critter_id_combat_data); // replace map_fix_critter_combat_data_ // Additionally fix object IDs for queued events MakeCall(0x4A25BA, queue_add_hack); diff --git a/sfall/WinProc.cpp b/sfall/WinProc.cpp index a28f8c49..b168c4d1 100644 --- a/sfall/WinProc.cpp +++ b/sfall/WinProc.cpp @@ -223,15 +223,16 @@ void WinProc::SetStyle(long windowStyle) { void WinProc::SetTitle(long wWidth, long wHeight, long gMode) { char windowTitle[128]; - char mode[4] = "DD7"; + char mode[8] = "DD7"; if (gMode >= 4) std::strcpy(mode, "DX9"); + else if (extWrapper) std::strcpy(mode, "wrapper"); if (HRP::Setting::ScreenWidth() != wWidth || HRP::Setting::ScreenHeight() != wHeight) { std::sprintf(windowTitle, "%s @sfall " VERSION_STRING " : %ix%i >> %ix%i [%s]", - (const char*)0x50AF08, HRP::Setting::ScreenWidth(), HRP::Setting::ScreenHeight(), wWidth, wHeight, mode); + (const char*)0x50AF08, HRP::Setting::ScreenWidth(), HRP::Setting::ScreenHeight(), wWidth, wHeight, mode); } else { std::sprintf(windowTitle, "%s @sfall " VERSION_STRING " : %ix%i [%s]", - (const char*)0x50AF08, HRP::Setting::ScreenWidth(), HRP::Setting::ScreenHeight(), mode); + (const char*)0x50AF08, HRP::Setting::ScreenWidth(), HRP::Setting::ScreenHeight(), mode); } SetWindowTextA(window, windowTitle); } diff --git a/sfall/version.h b/sfall/version.h index 8d5eecc3..60f3876c 100644 --- a/sfall/version.h +++ b/sfall/version.h @@ -25,6 +25,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 5 #define VERSION_BUILD 0 -#define VERSION_REV 0 +#define VERSION_REV 1 -#define VERSION_STRING "4.5" +#define VERSION_STRING "4.5.0.1"