Improved the clearing of floating text messages after map change

(ref. fallout2-ce/fallout2-ce#115)
This commit is contained in:
NovaRain
2025-05-13 22:00:54 +08:00
parent 17afecf5ca
commit da47ee5134
+12 -4
View File
@@ -407,7 +407,7 @@ palColor:
} }
} }
static void __fastcall RemoveAllFloatTextObjects() { static void __stdcall RemoveAllFloatTextObjects() {
long textCount = fo::var::text_object_index; long textCount = fo::var::text_object_index;
if (textCount > 0) { if (textCount > 0) {
for (long i = 0; i < textCount; i++) { for (long i = 0; i < textCount; i++) {
@@ -429,7 +429,7 @@ static __declspec(naked) void obj_move_to_tile_hook() {
} }
} }
static __declspec(naked) void map_check_state_hook() { static __declspec(naked) void map_check_state_hook0() {
__asm { __asm {
push eax; push eax;
call RemoveAllFloatTextObjects; call RemoveAllFloatTextObjects;
@@ -438,6 +438,13 @@ static __declspec(naked) void map_check_state_hook() {
} }
} }
static __declspec(naked) void map_check_state_hook1() {
__asm {
call fo::funcoffs::anim_stop_;
jmp RemoveAllFloatTextObjects;
}
}
// Frees up space in the array to create a text object // Frees up space in the array to create a text object
static void __fastcall RemoveFloatTextObject(fo::GameObject* source) { static void __fastcall RemoveFloatTextObject(fo::GameObject* source) {
size_t index = 0; size_t index = 0;
@@ -994,8 +1001,9 @@ void MiscPatches::init() {
MakeCall(0x48EE00, obj_render_outline_hack); MakeCall(0x48EE00, obj_render_outline_hack);
// Remove floating text messages after moving to another map or elevation // Remove floating text messages after moving to another map or elevation
HookCall(0x48A94B, obj_move_to_tile_hook); HookCall(0x48A94B, obj_move_to_tile_hook); // to another elevation
HookCall(0x4836BB, map_check_state_hook); HookCall(0x4836BB, map_check_state_hook0); // to another map
HookCalls(map_check_state_hook1, {0x483631, 0x483663}); // to the world map
// Remove an old floating message when creating a new one if the maximum number of floating messages has been reached // Remove an old floating message when creating a new one if the maximum number of floating messages has been reached
HookCall(0x4B03A1, text_object_create_hack); // jge hack HookCall(0x4B03A1, text_object_create_hack); // jge hack