summaryrefslogtreecommitdiff
path: root/engine/slot_machine.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/slot_machine.asm')
-rwxr-xr-xengine/slot_machine.asm117
1 files changed, 58 insertions, 59 deletions
diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm
index aea08f16a..cfec11091 100755
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -1,11 +1,13 @@
-SLOTS_NOBIAS EQU -1
-SLOTS_NOMATCH EQU -1
-SLOTS_SEVEN EQU $00
+SLOTS_NO_BIAS EQU -1
+SLOTS_NO_MATCH EQU -1
+
+SLOTS_SEVEN EQU $00
SLOTS_POKEBALL EQU $04
-SLOTS_CHERRY EQU $08
-SLOTS_PIKACHU EQU $0c
+SLOTS_CHERRY EQU $08
+SLOTS_PIKACHU EQU $0c
SLOTS_SQUIRTLE EQU $10
-SLOTS_STARYU EQU $14
+SLOTS_STARYU EQU $14
+
REEL_SIZE EQU 15
; Constants for slot_reel offsets (see macros/wram.asm)
@@ -85,7 +87,7 @@ _SlotMachine:
call PlaySFX
call WaitSFX
call ClearBGPalettes
- farcall TrainerRankings_EndSlotsWinStreak
+ farcall StubbedTrainerRankings_EndSlotsWinStreak
ld hl, Options
res NO_TEXT_SCROLL, [hl]
ld hl, rLCDC
@@ -148,7 +150,7 @@ _SlotMachine:
ld [hl], $40
xor a ; SLOTS_INIT
ld [wJumptableIndex], a
- ld a, SLOTS_NOBIAS
+ ld a, SLOTS_NO_BIAS
ld [wSlotBias], a
ld de, MUSIC_GAME_CORNER
call PlayMusic
@@ -183,7 +185,7 @@ SlotsLoop: ; 927af (24:67af)
ld [wCurrSpriteOAMAddr], a
callfar DoNextFrameForFirst16Sprites
call .PrintCoinsAndPayout
- call .DummyFunc
+ call .Stubbed_Function927d3
call DelayFrame
and a
ret
@@ -192,7 +194,7 @@ SlotsLoop: ; 927af (24:67af)
scf
ret
-.DummyFunc: ; 927d3 (24:67d3)
+.Stubbed_Function927d3: ; 927d3 (24:67d3)
; dummied out
ret
ld a, [wReel1ReelAction]
@@ -232,8 +234,8 @@ SlotsLoop: ; 927af (24:67af)
; 92811 (24:6811)
-Function92811: ; 92811
-; unreferenced - debug function?
+Unreferenced_Function92811: ; 92811
+; debug function?
ld a, [wSlotBias]
add 0
daa
@@ -252,23 +254,22 @@ Function92811: ; 92811
; 9282c
-Function9282c: ; 9282c
-; unreferenced
+Unreferenced_Function9282c: ; 9282c
; animate OAM tiles?
ld hl, wcf66
ld a, [hl]
inc [hl]
and $7
ret nz
- ld hl, Sprites + 16 * 4 + 2
- ld c, 40 - 16
+ ld hl, Sprite17TileID
+ ld c, NUM_SPRITE_OAM_STRUCTS - 16
.loop
ld a, [hl]
- xor $20
- ld [hli], a
- inc hl
- inc hl
+ xor %00100000
+ ld [hli], a ; tile id
+rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
+endr
dec c
jr nz, .loop
ret
@@ -309,7 +310,7 @@ SlotsAction_Init: ; 9287e (24:687e)
xor a
ld [wFirstTwoReelsMatching], a
ld [wFirstTwoReelsMatchingSevens], a
- ld a, SLOTS_NOMATCH
+ ld a, SLOTS_NO_MATCH
ld [wSlotMatched], a
ret
@@ -417,7 +418,7 @@ SlotsAction_WaitStopReel3: ; 9293a (24:693a)
SlotsAction_FlashIfWin: ; 92955 (24:6955)
ld a, [wSlotMatched]
- cp SLOTS_NOMATCH
+ cp SLOTS_NO_MATCH
jr nz, .GotIt
call SlotsAction_Next
call SlotsAction_Next
@@ -587,7 +588,7 @@ Slots_StopReel2: ; 92a2e (24:6a2e)
ld a, [wSlotBias]
and a
jr z, .skip
- cp SLOTS_NOBIAS
+ cp SLOTS_NO_BIAS
jr nz, .dont_jump
.skip
call .CheckReel1ForASeven
@@ -670,7 +671,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel1
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, Sprites + 16 * 4
+ ld de, Sprite17
ld [hl], e
inc hl
ld [hl], d
@@ -688,7 +689,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel2
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, Sprites + 24 * 4
+ ld de, Sprite25
ld [hl], e
inc hl
ld [hl], d
@@ -706,7 +707,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel3
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, Sprites + 32 * 4
+ ld de, Sprite33
ld [hl], e
inc hl
ld [hl], d
@@ -821,41 +822,40 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53)
ld l, a
.loop
ld a, [wCurrReelYCoord]
- ld [hli], a
+ ld [hli], a ; y
ld a, [wCurrReelXCoord]
- ld [hli], a
+ ld [hli], a ; x
ld a, [de]
- ld [hli], a
+ ld [hli], a ; tile id
srl a
srl a
- set 7, a
- ld [hli], a
+ set OAM_PRIORITY, a
+ ld [hli], a ; attributes
ld a, [wCurrReelYCoord]
- ld [hli], a
+ ld [hli], a ; y
ld a, [wCurrReelXCoord]
- add 1 * 8
- ld [hli], a
+ add 1 * TILE_WIDTH
+ ld [hli], a ; x
ld a, [de]
inc a
inc a
- ld [hli], a
+ ld [hli], a ; tile id
srl a
srl a
- set 7, a
- ld [hli], a
+ set OAM_PRIORITY, a
+ ld [hli], a ; attributes
inc de
ld a, [wCurrReelYCoord]
- sub 2 * 8
+ sub 2 * TILE_WIDTH
ld [wCurrReelYCoord], a
- cp 2 * 8
+ cp 2 * TILE_WIDTH
jr nz, .loop
ret
; 92bbe (24:6bbe)
-; unreferenced
-Function92bbe: ; 92bbe
+Unreferenced_Function92bbe: ; 92bbe
push hl
srl a
srl a
@@ -997,7 +997,7 @@ ReelAction_StopReel1: ; 92c5e
; even if the current bet won't allow lining it up.
ld a, [wSlotBias]
- cp SLOTS_NOBIAS
+ cp SLOTS_NO_BIAS
jr z, .NoBias
ld hl, REEL_MANIP_COUNTER
add hl, bc
@@ -1043,7 +1043,7 @@ ReelAction_StopReel2: ; 92c86
jr z, .NoBias
.nope
ld a, [wSlotBias]
- cp SLOTS_NOBIAS
+ cp SLOTS_NO_BIAS
jr z, .NoBias
ld hl, REEL_MANIP_COUNTER
add hl, bc
@@ -1079,7 +1079,7 @@ ReelAction_StopReel3: ; 92ca9
.NoMatch:
ld a, [wSlotBias]
- cp SLOTS_NOBIAS
+ cp SLOTS_NO_BIAS
jr z, .NoBias
ld hl, REEL_MANIP_COUNTER
add hl, bc
@@ -1532,7 +1532,7 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94
; 92f1d
Slots_CheckMatchedAllThreeReels: ; 92f1d
- ld a, SLOTS_NOMATCH
+ ld a, SLOTS_NO_MATCH
ld [wSlotMatched], a
call Slots_GetCurrentReelState
call Slots_CopyReelState
@@ -1552,7 +1552,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d
.return
ld a, [wSlotMatched]
- cp SLOTS_NOMATCH
+ cp SLOTS_NO_MATCH
jr nz, .matched_nontrivial
and a
ret
@@ -1753,7 +1753,7 @@ Slots_InitBias: ; 93002 (24:7002)
db $14, SLOTS_SQUIRTLE ; 5/128
db $28, SLOTS_PIKACHU ; 5/64
db $30, SLOTS_CHERRY ; 1/32
- db $ff, SLOTS_NOBIAS ; everything else
+ db $ff, SLOTS_NO_BIAS ; everything else
; 93031
.Lucky: ; 93031
@@ -1763,7 +1763,7 @@ Slots_InitBias: ; 93002 (24:7002)
db $10, SLOTS_SQUIRTLE ; 1/32
db $1e, SLOTS_PIKACHU ; 7/128
db $50, SLOTS_CHERRY ; 25/128
- db $ff, SLOTS_NOBIAS ; everything else
+ db $ff, SLOTS_NO_BIAS ; everything else
; 9303f
Slots_IlluminateBetLights: ; 9303f (24:703f)
@@ -1868,15 +1868,14 @@ Slots_AskBet: ; 9307c (24:707c)
; 0x930d6
.MenuDataHeader: ; 0x930d6
- db $40 ; flags
- db 10, 14 ; start coords
- db 17, 19 ; end coords
+ db MENU_BACKUP_TILES ; flags
+ menu_coords 14, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw .MenuData2
db 1 ; default option
; 0x930de
.MenuData2: ; 0x930de
- db $80 ; flags
+ db STATICMENU_CURSOR ; flags
db 3 ; items
db " 3@"
db " 2@"
@@ -1924,7 +1923,7 @@ Slots_AskPlayAgain: ; 930e9 (24:70e9)
Slots_GetPayout: ; 93124 (24:7124)
ld a, [wSlotMatched]
- cp SLOTS_NOMATCH
+ cp SLOTS_NO_MATCH
jr z, .no_win
srl a
ld e, a
@@ -1937,7 +1936,7 @@ Slots_GetPayout: ; 93124 (24:7124)
ld a, [hl]
ld [wPayout], a
ld d, a
- farcall TrainerRankings_AddToSlotsPayouts
+ farcall StubbedTrainerRankings_AddToSlotsPayouts
ret
.PayoutTable:
@@ -1957,11 +1956,11 @@ Slots_GetPayout: ; 93124 (24:7124)
Slots_PayoutText: ; 93158 (24:7158)
ld a, [wSlotMatched]
- cp SLOTS_NOMATCH
+ cp SLOTS_NO_MATCH
jr nz, .MatchedSomething
ld hl, .Text_Darn
call PrintText
- farcall TrainerRankings_EndSlotsWinStreak
+ farcall StubbedTrainerRankings_EndSlotsWinStreak
ret
.MatchedSomething:
@@ -1985,7 +1984,7 @@ Slots_PayoutText: ; 93158 (24:7158)
.return
ld hl, .Text_PrintPayout
call PrintText
- farcall TrainerRankings_AddToSlotsWinStreak
+ farcall StubbedTrainerRankings_AddToSlotsWinStreak
ret
; 93195 (24:7195)
@@ -2047,7 +2046,7 @@ endr
call Random
and %0010100
ret z ; 25% chance to stick with seven symbol bias
- ld a, SLOTS_NOBIAS
+ ld a, SLOTS_NO_BIAS
ld [wSlotBias], a
ret
@@ -2055,7 +2054,7 @@ endr
call Random
and %0011100
ret z ; 12.5% chance to stick with seven symbol bias
- ld a, SLOTS_NOBIAS
+ ld a, SLOTS_NO_BIAS
ld [wSlotBias], a
ret