summaryrefslogtreecommitdiffstats
path: root/src/re3.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-01 19:18:19 +0200
committeraap <aap@papnet.eu>2019-06-01 19:18:19 +0200
commitc40c7acb96a926378df7d7b43920966ab31ff95e (patch)
treea524403990b5c17a1c0b97275c773a26a8c98fb2 /src/re3.cpp
parentmore RW lights (diff)
downloadre3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar.gz
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar.bz2
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar.lz
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar.xz
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.tar.zst
re3-c40c7acb96a926378df7d7b43920966ab31ff95e.zip
Diffstat (limited to '')
-rw-r--r--src/re3.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/re3.cpp b/src/re3.cpp
index 572f4c05..e99384e1 100644
--- a/src/re3.cpp
+++ b/src/re3.cpp
@@ -111,6 +111,29 @@ delayedPatches10(int a, int b)
return RsEventHandler_orig(a, b);
}
+void __declspec(naked) HeadlightsFix()
+{
+ static const float fMinusOne = -1.0f;
+ _asm
+ {
+ fld [esp+708h-690h]
+ fcomp fMinusOne
+ fnstsw ax
+ and ah, 5
+ cmp ah, 1
+ jnz HeadlightsFix_DontLimit
+ fld fMinusOne
+ fstp [esp+708h-690h]
+
+HeadlightsFix_DontLimit:
+ fld [esp+708h-690h]
+ fabs
+ fld st
+ push 0x5382F2
+ retn
+ }
+}
+
void
patch()
@@ -120,6 +143,10 @@ patch()
Patch<float>(0x46BC61+6, 1.0f); // car distance
InjectHook(0x59E460, printf, PATCH_JUMP);
+ // stolen from silentpatch (sorry)
+ Patch<WORD>(0x5382BF, 0x0EEB);
+ InjectHook(0x5382EC, HeadlightsFix, PATCH_JUMP);
+
InterceptCall(&open_script_orig, open_script, 0x438869);
InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);