shithub: pokecrystal

Download patch

ref: d4a6a1b2bcf94915020f2a6c96b8004479185325
parent: 81f0cacefb85fae2a32e1f8546d4c9100063f32c
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Oct 15 18:15:00 EDT 2021

Add table assertions to slot machine data

--- a/engine/games/slot_machine.asm
+++ b/engine/games/slot_machine.asm
@@ -1,12 +1,16 @@
-SLOTS_NO_BIAS  EQU -1
+; wSlotMatched values
+	const_def 0, 4
+	const SLOTS_SEVEN    ; $00
+	const SLOTS_POKEBALL ; $04
+	const SLOTS_CHERRY   ; $08
+	const SLOTS_PIKACHU  ; $0c
+	const SLOTS_SQUIRTLE ; $10
+	const SLOTS_STARYU   ; $14
+NUM_SLOT_REELS EQU const_value / 4 ; 6
 SLOTS_NO_MATCH EQU -1
 
-SLOTS_SEVEN    EQU $00
-SLOTS_POKEBALL EQU $04
-SLOTS_CHERRY   EQU $08
-SLOTS_PIKACHU  EQU $0c
-SLOTS_SQUIRTLE EQU $10
-SLOTS_STARYU   EQU $14
+; wSlotBias values
+SLOTS_NO_BIAS  EQU -1
 
 REEL_SIZE EQU 15
 
@@ -860,6 +864,7 @@
 	ret
 
 .data:
+	table_width 1, GetUnknownSlotReelData.data
 	db 0 ; SLOTS_SEVEN
 	db 1 ; SLOTS_POKEBALL
 	db 2 ; SLOTS_CHERRY
@@ -866,6 +871,7 @@
 	db 3 ; SLOTS_PIKACHU
 	db 4 ; SLOTS_SQUIRTLE
 	db 5 ; SLOTS_STARYU
+	assert_table_length NUM_SLOT_REELS
 
 ReelActionJumptable:
 	ld hl, REEL_ACTION
@@ -1834,12 +1840,14 @@
 	ret
 
 .PayoutTable:
-	dw 300
-	dw  50
-	dw   6
-	dw   8
-	dw  10
-	dw  15
+	table_width 2, Slots_GetPayout.PayoutTable
+	dw 300 ; SLOTS_SEVEN
+	dw  50 ; SLOTS_POKEBALL
+	dw   6 ; SLOTS_CHERRY
+	dw   8 ; SLOTS_PIKACHU
+	dw  10 ; SLOTS_SQUIRTLE
+	dw  15 ; SLOTS_STARYU
+	assert_table_length NUM_SLOT_REELS
 
 .no_win
 	ld hl, wPayout
@@ -1882,12 +1890,14 @@
 	ret
 
 .PayoutStrings:
-	dbw "300@", .LinedUpSevens
-	dbw "50@@", .LinedUpPokeballs
-	dbw "6@@@", .LinedUpMonOrCherry
-	dbw "8@@@", .LinedUpMonOrCherry
-	dbw "10@@", .LinedUpMonOrCherry
-	dbw "15@@", .LinedUpMonOrCherry
+	table_width 6, Slots_PayoutText.PayoutStrings
+	dbw "300@", .LinedUpSevens      ; SLOTS_SEVEN
+	dbw "50@@", .LinedUpPokeballs   ; SLOTS_POKEBALL
+	dbw "6@@@", .LinedUpMonOrCherry ; SLOTS_CHERRY
+	dbw "8@@@", .LinedUpMonOrCherry ; SLOTS_PIKACHU
+	dbw "10@@", .LinedUpMonOrCherry ; SLOTS_SQUIRTLE
+	dbw "15@@", .LinedUpMonOrCherry ; SLOTS_STARYU
+	assert_table_length NUM_SLOT_REELS
 
 .Text_PrintPayout:
 	text_asm