Fixed JetWithdrawal in Drugs.ini conflict with fix in commit dfd810c

Simplified the code in the previous commit.
This commit is contained in:
NovaRain
2021-10-10 07:19:46 +08:00
parent 583105a76a
commit 2e97fe38ff
4 changed files with 11 additions and 7 deletions
+3 -4
View File
@@ -497,10 +497,9 @@ static void __declspec(naked) obj_use_container_hook() {
static const DWORD obj_use_container_ExitRet = 0x49D069;
using namespace fo::Fields;
__asm {
mov ebx, [ecx + currFrame]; // obj.cur_frm
cmp ebx, 1; // grave type containers in the open state?
je skip; // skip animation
jmp fo::funcoffs::register_begin_; // vanilla behavior
cmp dword ptr [ecx + currFrame], 1; // grave type containers in the open state?
je skip; // skip animation
jmp fo::funcoffs::register_begin_; // vanilla behavior
skip:
add esp, 4;
cmp edi, ds:[FO_VAR_obj_dude];
+3
View File
@@ -266,8 +266,11 @@ skip:
static void __declspec(naked) item_wd_process_hack() {
__asm {
cmp Drugs::JetWithdrawal, 1;
je skip;
cmp esi, PERK_add_jet; // esi - queue_addict.perk
je jetAddict;
skip:
retn;
jetAddict:
push ecx;
+4 -3
View File
@@ -30,6 +30,7 @@ static int drugsCount = 0;
static bool drugsReset = false; // true - need reset
long Drugs::addictionGvarCount = 0;
bool Drugs::JetWithdrawal = false;
sDrugs *drugs = nullptr;
@@ -287,7 +288,7 @@ void Drugs::init() {
dlog("Applying drugs patch...", DL_INIT);
const char* iniDrugs = drugsFile.insert(0, ".\\").c_str();
if (IniReader::GetInt("main", "JetWithdrawal", 0, iniDrugs) == 1) SafeWrite8(0x47A3A8, 0);
JetWithdrawal = (IniReader::GetInt("main", "JetWithdrawal", 0, iniDrugs) == 1); // SafeWrite8(0x47A3A8, 0); item_wd_process_
int count = IniReader::GetInt("main", "Count", 0, iniDrugs);
if (count > 0) {
@@ -334,8 +335,8 @@ void Drugs::init() {
MakeCall(0x43C15C, list_karma_hack, 2);
MakeCall(0x47A5B8, pid_to_gvar_hack, 1);
MakeCall(0x47A50C, perform_withdrawal_start_hack);
SafeWrite32(0x47A523, 0x9090EBD1); // shr ebx, 1 (fix for trait drug addict)
SafeWrite8(0x47A527, CodeType::Nop);
SafeWrite32(0x47A523, 0x9090EBD1); // shr ebx, 1 (fix for trait drug addict perform_withdrawal_start_)
SafeWrite8(0x47A527, CodeType::Nop); // perform_withdrawal_start_
if (addictionGvarCount) {
LoadGameHook::OnAfterGameInit() += CheckValidGvarNumber;
+1
View File
@@ -30,6 +30,7 @@ public:
void exit() override;
static long addictionGvarCount;
static bool JetWithdrawal;
static long GetDrugCount();
static long GetDrugPid(long n);