chore: fix bugs
Some checks failed
CI / build (push) Failing after 1m18s

This commit is contained in:
Giulia Sanguineti
2025-10-01 10:11:42 +02:00
parent d138ed1bd4
commit 4c8d3e962f
44 changed files with 236 additions and 235 deletions

View File

@@ -1240,12 +1240,13 @@ Script_memcall:
; fallthrough
ScriptCall:
; BUG: ScriptCall can overflow wScriptStack and crash (see docs/bugs_and_glitches.md)
push de
ld hl, wScriptStackSize
ld e, [hl]
ld a, [hl]
cp 5
ret nc
push de
inc [hl]
ld e, a
ld d, 0
ld hl, wScriptStack
add hl, de
@@ -1267,9 +1268,6 @@ ScriptCall:
ret
CallCallback::
ld a, [wScriptBank]
or $80
ld [wScriptBank], a
jp ScriptCall
Script_sjump:
@@ -2289,7 +2287,6 @@ ExitScriptSubroutine:
add hl, de
ld a, [hli]
ld b, a
and $7f
ld [wScriptBank], a
ld a, [hli]
ld e, a