shithub: pokecrystal

Download patch

ref: 23708441effabc167439724ee3d81a6f5ca84a76
parent: 04d0490c4c55366220310b9b8e1c4a181e07d842
author: mid-kid <esteve.varela@gmail.com>
date: Sun Jul 15 07:58:10 EDT 2018

Make proper cmdqueue constants

--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -119,8 +119,14 @@
 CMDQUEUE_ENTRY_SIZE EQU 6
 CMDQUEUE_CAPACITY EQU 4
 
-; command queue types
-CMDQUEUE_STONETABLE EQU 2
+; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm)
+	const_def
+	const CMDQUEUE_NULL
+	const CMDQUEUE_NULL2
+	const CMDQUEUE_STONETABLE
+	const CMDQUEUE_TYPE3
+	const CMDQUEUE_TYPE4
+NUM_CMDQUEUE_TYPES EQU const_value
 
 ; elevfloor macro values
 ; ElevatorFloorNames indexes (see data/events/elevator_floors.asm)
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -1336,8 +1336,8 @@
 
 ClearCmdQueue::
 	ld hl, wCmdQueue
-	ld de, 6
-	ld c, 4
+	ld de, CMDQUEUE_ENTRY_SIZE
+	ld c, CMDQUEUE_CAPACITY
 	xor a
 .loop
 	ld [hl], a
@@ -1443,7 +1443,7 @@
 	ld hl, CMDQUEUE_TYPE
 	add hl, bc
 	ld a, [hl]
-	cp 5
+	cp NUM_CMDQUEUE_TYPES
 	jr c, .okay
 	xor a