mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added a tweak to allow printing new floating messages when their limit is exceeded (#388)
Fixed incorrect value of the limit number of floating messages.
This commit is contained in:
+5
-1
@@ -2,6 +2,10 @@
|
|||||||
;v3.8.33
|
;v3.8.33
|
||||||
|
|
||||||
[Main]
|
[Main]
|
||||||
|
;Change to 1 if you want to use command line args to tell sfall to use another ini file
|
||||||
|
;This option is always enabled in 4.3.3/3.8.33 or later. The information is left for reference only
|
||||||
|
UseCommandLine=0
|
||||||
|
|
||||||
;Uncomment and point to a file to get alternate translations for some sfall messages
|
;Uncomment and point to a file to get alternate translations for some sfall messages
|
||||||
;This file can be placed in text\<language>\ for sfall to get the translations depending on the game language
|
;This file can be placed in text\<language>\ for sfall to get the translations depending on the game language
|
||||||
;TranslationsINI=sfall\Translations.ini
|
;TranslationsINI=sfall\Translations.ini
|
||||||
@@ -270,7 +274,7 @@ UseFileSystemOverride=0
|
|||||||
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
|
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
|
||||||
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
|
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
|
||||||
;This option is always enabled in 4.3/3.8.30 or later. The information is left for reference only
|
;This option is always enabled in 4.3/3.8.30 or later. The information is left for reference only
|
||||||
;DataLoadOrderPatch=1
|
DataLoadOrderPatch=1
|
||||||
|
|
||||||
;Set to 1 to load alternative dialog msg files from text\<language>\dialog_female\ for female PC
|
;Set to 1 to load alternative dialog msg files from text\<language>\dialog_female\ for female PC
|
||||||
;Set to 2 to also load subtitle files from text\<language>\cuts_female\ for female PC
|
;Set to 2 to also load subtitle files from text\<language>\cuts_female\ for female PC
|
||||||
|
|||||||
@@ -1018,17 +1018,14 @@ struct DrugInfoList {
|
|||||||
|
|
||||||
struct FloatText {
|
struct FloatText {
|
||||||
long flags;
|
long flags;
|
||||||
void* unknown0;
|
GameObject* owner;
|
||||||
long unknown1;
|
long time;
|
||||||
long unknown2;
|
long lines;
|
||||||
long unknown3;
|
long x_off;
|
||||||
long unknown4;
|
long y_off;
|
||||||
long unknown5;
|
long tile_num;
|
||||||
long unknown6;
|
sfall::Rectangle rect;
|
||||||
long unknown7;
|
BYTE* buffer;
|
||||||
long unknown8;
|
|
||||||
long unknown9;
|
|
||||||
void* unknown10;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SubTitleList {
|
struct SubTitleList {
|
||||||
|
|||||||
@@ -3987,6 +3987,9 @@ void BugFixes::init()
|
|||||||
|
|
||||||
// Fix to prevent the main menu music from stopping when entering the load game screen
|
// Fix to prevent the main menu music from stopping when entering the load game screen
|
||||||
BlockCall(0x480B25);
|
BlockCall(0x480B25);
|
||||||
|
|
||||||
|
// Fix incorrect value of the limit number of floating messages
|
||||||
|
SafeWrite8(0x4B039F, 20); // text_object_create_ (was 19)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ static void __fastcall RemoveAllFloatTextObjects() {
|
|||||||
long textCount = *fo::ptr::text_object_index;
|
long textCount = *fo::ptr::text_object_index;
|
||||||
if (textCount > 0) {
|
if (textCount > 0) {
|
||||||
for (long i = 0; i < textCount; i++) {
|
for (long i = 0; i < textCount; i++) {
|
||||||
fo::func::mem_free(fo::ptr::text_object_list[i]->unknown10);
|
fo::func::mem_free(fo::ptr::text_object_list[i]->buffer);
|
||||||
fo::func::mem_free(fo::ptr::text_object_list[i]);
|
fo::func::mem_free(fo::ptr::text_object_list[i]);
|
||||||
}
|
}
|
||||||
*fo::ptr::text_object_index = 0;
|
*fo::ptr::text_object_index = 0;
|
||||||
@@ -397,6 +397,52 @@ static void __declspec(naked) map_check_state_hook() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Frees up space in the array to create a text object
|
||||||
|
static void __fastcall RemoveFloatTextObject(fo::GameObject* source) {
|
||||||
|
size_t index = 0;
|
||||||
|
size_t textCount = *fo::ptr::text_object_index;
|
||||||
|
long minTime = fo::ptr::text_object_list[0]->time;
|
||||||
|
|
||||||
|
for (size_t i = 1; i < textCount; i++) {
|
||||||
|
if (fo::ptr::text_object_list[i]->owner == source) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (fo::ptr::text_object_list[i]->time < minTime) {
|
||||||
|
minTime = fo::ptr::text_object_list[i]->time;
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fo::FloatText* tObj = fo::ptr::text_object_list[index];
|
||||||
|
|
||||||
|
fo::func::tile_coord(tObj->tile_num, &tObj->rect.x, &tObj->rect.y);
|
||||||
|
tObj->rect.y += tObj->y_off;
|
||||||
|
tObj->rect.x += tObj->x_off;
|
||||||
|
|
||||||
|
fo::BoundRect rect;
|
||||||
|
rect.x = tObj->rect.x;
|
||||||
|
rect.y = tObj->rect.y;
|
||||||
|
rect.offx = tObj->rect.width + tObj->rect.x - 1;
|
||||||
|
rect.offy = tObj->rect.height + tObj->rect.y - 1;
|
||||||
|
|
||||||
|
fo::func::mem_free(tObj->buffer);
|
||||||
|
fo::func::mem_free(tObj);
|
||||||
|
|
||||||
|
// copy the last element of the array to the place of the removed one
|
||||||
|
if (--textCount > index) fo::ptr::text_object_list[index] = fo::ptr::text_object_list[textCount];
|
||||||
|
(*fo::ptr::text_object_index)--;
|
||||||
|
|
||||||
|
fo::func::tile_refresh_rect(&rect, *fo::ptr::map_elevation);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) text_object_create_hack() {
|
||||||
|
__asm {
|
||||||
|
mov ecx, eax;
|
||||||
|
push 0x4B03A6; // ret addr
|
||||||
|
jmp RemoveFloatTextObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void __declspec(naked) obj_move_to_tile_hook_redraw() {
|
static void __declspec(naked) obj_move_to_tile_hook_redraw() {
|
||||||
__asm {
|
__asm {
|
||||||
mov MainLoopHook::displayWinUpdateState, 1;
|
mov MainLoopHook::displayWinUpdateState, 1;
|
||||||
@@ -970,6 +1016,9 @@ void MiscPatches::init() {
|
|||||||
HookCall(0x48A94B, obj_move_to_tile_hook);
|
HookCall(0x48A94B, obj_move_to_tile_hook);
|
||||||
HookCall(0x4836BB, map_check_state_hook);
|
HookCall(0x4836BB, map_check_state_hook);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
// Redraw the screen to update black edges of the map (HRP bug)
|
// Redraw the screen to update black edges of the map (HRP bug)
|
||||||
// https://github.com/phobos2077/sfall/issues/282
|
// https://github.com/phobos2077/sfall/issues/282
|
||||||
HookCall(0x48A954, obj_move_to_tile_hook_redraw);
|
HookCall(0x48A954, obj_move_to_tile_hook_redraw);
|
||||||
|
|||||||
Reference in New Issue
Block a user