mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Minor code edits: replace some push/pop in ASM with pushadc/popadc pair
This commit is contained in:
@@ -568,14 +568,10 @@ static void __fastcall CombatAttackHook(fo::GameObject* source, fo::GameObject*
|
||||
|
||||
static __declspec(naked) void combat_attack_hook() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
push edx;
|
||||
pushadc;
|
||||
mov ecx, eax; // source
|
||||
call CombatAttackHook; // edx - target
|
||||
pop edx;
|
||||
pop ecx;
|
||||
pop eax;
|
||||
popadc;
|
||||
jmp fo::funcoffs::combat_attack_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,9 +300,7 @@ static void __stdcall SetHeroArt(bool newArtFlag) {
|
||||
// return hero art val to normal before saving
|
||||
static __declspec(naked) void SavCritNumFix() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push edx;
|
||||
push eax;
|
||||
pushadc;
|
||||
push 0; // set hero FrmID LST index to normal range before saving
|
||||
call SetHeroArt;
|
||||
pop eax;
|
||||
@@ -310,9 +308,7 @@ static __declspec(naked) void SavCritNumFix() {
|
||||
push eax;
|
||||
push 1; // return hero FrmID LST index back to hero art range after saving hero state structure
|
||||
call SetHeroArt;
|
||||
pop eax;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
popadc;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,15 +442,11 @@ static __declspec(naked) void gmovie_play_hack() {
|
||||
__asm {
|
||||
cmp eax, MaxMovies;
|
||||
jge failPlayAvi;
|
||||
push ecx;
|
||||
push edx;
|
||||
push eax;
|
||||
pushadc;
|
||||
mov ecx, eax;
|
||||
call PrepareLoadMovie;
|
||||
test eax,eax;
|
||||
pop eax;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
popadc;
|
||||
jz failPlayAvi;
|
||||
push offset return; // return to here "return" label
|
||||
failPlayAvi:
|
||||
|
||||
@@ -136,13 +136,9 @@ static __declspec(naked) void pipboy_hack_press1() {
|
||||
mov calledflag, 0;
|
||||
test pageFlag, 0xFF;
|
||||
jz skip;
|
||||
push eax;
|
||||
push edx;
|
||||
push ecx;
|
||||
pushadc;
|
||||
call ResetPageValues;
|
||||
pop ecx;
|
||||
pop edx;
|
||||
pop eax;
|
||||
popadc;
|
||||
skip:
|
||||
// engine
|
||||
sub ebx, 0x1F4;
|
||||
@@ -157,13 +153,9 @@ static __declspec(naked) void pipboy_hack_back() {
|
||||
mov calledflag, 0;
|
||||
test pageFlag, 0xFF;
|
||||
jz skip;
|
||||
push eax;
|
||||
push edx;
|
||||
push ecx;
|
||||
pushadc;
|
||||
call ResetPageValues;
|
||||
pop ecx;
|
||||
pop edx;
|
||||
pop eax;
|
||||
popadc;
|
||||
skip:
|
||||
// engine
|
||||
mov eax, 0x401;
|
||||
|
||||
@@ -703,7 +703,7 @@ static __declspec(naked) void gdialogFreeSpeech_hack() {
|
||||
jz skip;
|
||||
push ecx;
|
||||
push edx;
|
||||
mov ecx,speechSound;
|
||||
mov ecx, speechSound;
|
||||
call ReleaseSound;
|
||||
mov speechSound, 0;
|
||||
mov lipsPlaying, 0;
|
||||
|
||||
Reference in New Issue
Block a user