mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added functional to the option FemaleDialogMsgs for possibility using the 'cuts_female' directory for female phrases.
This commit is contained in:
@@ -25,13 +25,35 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
static const char* msgFemaleFolder = "dialog_female\\%s.msg";
|
||||
static long femaleMsgs;
|
||||
|
||||
static const char* cutsEndGameFemale = "text\\%s\\cuts_female\\";
|
||||
static const char* cutsSubFemale = "text\\%s\\cuts_female\\%s";
|
||||
static const char* cutsDeathFemale = "text\\%s\\cuts_female\\%s%s";
|
||||
static const char* msgFemaleFolder = "dialog_female\\%s.msg";
|
||||
|
||||
static bool isFemale = false;
|
||||
static bool femaleCheck = false; // flag for check female dialog file
|
||||
static DWORD format;
|
||||
static bool cutsPatch = false;
|
||||
|
||||
static void CheckPlayerGender() {
|
||||
isFemale = fo::HeroIsFemale();
|
||||
|
||||
if (femaleMsgs > 1) {
|
||||
if (isFemale) {
|
||||
if (cutsPatch) return;
|
||||
cutsPatch = true;
|
||||
SafeWrite32(0x43FA9F, (DWORD)cutsEndGameFemale);
|
||||
SafeWrite32(0x44EB5B, (DWORD)cutsSubFemale);
|
||||
SafeWrite32(0x48152E, (DWORD)cutsDeathFemale);
|
||||
} else if (cutsPatch) {
|
||||
SafeWrite32(0x43FA9F, FO_VAR_aTextSCuts);
|
||||
SafeWrite32(0x44EB5B, FO_VAR_aTextSCutsS);
|
||||
SafeWrite32(0x48152E, FO_VAR_aTextSCutsSS);
|
||||
cutsPatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD scr_get_dialog_msg_file_Back = 0x4A6BD2;
|
||||
@@ -67,6 +89,16 @@ exist:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) gnw_main_hack() {
|
||||
__asm {
|
||||
push eax;
|
||||
call CheckPlayerGender;
|
||||
pop eax;
|
||||
mov edx, 4; // overwritten engine code
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) removeDatabase() {
|
||||
__asm {
|
||||
cmp eax, -1
|
||||
@@ -144,12 +176,24 @@ void LoadOrder::init() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
if (GetConfigInt("Misc", "FemaleDialogMsgs", 0)) {
|
||||
femaleMsgs = GetConfigInt("Misc", "FemaleDialogMsgs", 0);
|
||||
if (femaleMsgs) {
|
||||
dlog("Applying alternative female dialog files patch.", DL_INIT);
|
||||
MakeJump(0x4A6BCD, scr_get_dialog_msg_file_hack1);
|
||||
MakeJump(0x4A6BF5, scr_get_dialog_msg_file_hack2);
|
||||
dlogr(" Done", DL_INIT);
|
||||
LoadGameHook::OnAfterGameStarted() += CheckPlayerGender;
|
||||
if (femaleMsgs > 1) {
|
||||
MakeCall(0x480A95, gnw_main_hack); // before new game start from main menu. TODO: need moved to address 0x480A9A (it busy in movies.cpp)
|
||||
LoadGameHook::OnGameExit() += []() {
|
||||
if (cutsPatch) { // restore
|
||||
SafeWrite32(0x43FA9F, FO_VAR_aTextSCuts);
|
||||
SafeWrite32(0x44EB5B, FO_VAR_aTextSCutsS);
|
||||
SafeWrite32(0x48152E, FO_VAR_aTextSCutsSS);
|
||||
cutsPatch = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user