2018-01-11 03:53:42 +00:00
|
|
|
SLOTS_NO_BIAS EQU -1
|
|
|
|
SLOTS_NO_MATCH EQU -1
|
|
|
|
|
|
|
|
SLOTS_SEVEN EQU $00
|
2015-12-11 03:26:31 +00:00
|
|
|
SLOTS_POKEBALL EQU $04
|
2018-01-11 03:53:42 +00:00
|
|
|
SLOTS_CHERRY EQU $08
|
|
|
|
SLOTS_PIKACHU EQU $0c
|
2015-12-11 03:26:31 +00:00
|
|
|
SLOTS_SQUIRTLE EQU $10
|
2018-01-11 03:53:42 +00:00
|
|
|
SLOTS_STARYU EQU $14
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
REEL_SIZE EQU 15
|
|
|
|
|
2017-12-29 15:48:47 +00:00
|
|
|
; Constants for slot_reel offsets (see macros/wram.asm)
|
|
|
|
REEL_ACTION EQUS "(wReel1ReelAction - wReel1)"
|
|
|
|
REEL_TILEMAP_ADDR EQUS "(wReel1TilemapAddr - wReel1)"
|
|
|
|
REEL_POSITION EQUS "(wReel1Position - wReel1)"
|
|
|
|
REEL_SPIN_DISTANCE EQUS "(wReel1SpinDistance - wReel1)"
|
|
|
|
REEL_SPIN_RATE EQUS "(wReel1SpinRate - wReel1)"
|
|
|
|
REEL_OAM_ADDR EQUS "(wReel1OAMAddr - wReel1)"
|
|
|
|
REEL_X_COORD EQUS "(wReel1XCoord - wReel1)"
|
|
|
|
REEL_MANIP_COUNTER EQUS "(wReel1ManipCounter - wReel1)"
|
|
|
|
REEL_MANIP_DELAY EQUS "(wReel1ManipDelay - wReel1)"
|
|
|
|
REEL_FIELD_0B EQUS "(wReel1Field0b - wReel1)"
|
|
|
|
REEL_STOP_DELAY EQUS "(wReel1StopDelay - wReel1)"
|
|
|
|
|
2017-12-28 18:38:15 +00:00
|
|
|
; SlotsJumptable constants
|
|
|
|
const_def
|
|
|
|
const SLOTS_INIT
|
|
|
|
const SLOTS_BET_AND_START
|
|
|
|
const SLOTS_WAIT_START
|
|
|
|
const SLOTS_WAIT_REEL1
|
|
|
|
const SLOTS_WAIT_STOP_REEL1
|
|
|
|
const SLOTS_WAIT_REEL2
|
|
|
|
const SLOTS_WAIT_STOP_REEL2
|
|
|
|
const SLOTS_WAIT_REEL3
|
|
|
|
const SLOTS_WAIT_STOP_REEL3
|
2017-12-28 19:27:44 +00:00
|
|
|
const SLOTS_NEXT_09
|
2017-12-29 12:52:42 +00:00
|
|
|
const SLOTS_NEXT_0A
|
|
|
|
const SLOTS_NEXT_0B
|
2017-12-28 18:38:15 +00:00
|
|
|
const SLOTS_FLASH_IF_WIN
|
|
|
|
const SLOTS_FLASH_SCREEN
|
|
|
|
const SLOTS_GIVE_EARNED_COINS
|
|
|
|
const SLOTS_PAYOUT_TEXT_AND_ANIM
|
|
|
|
const SLOTS_PAYOUT_ANIM
|
|
|
|
const SLOTS_RESTART_OF_QUIT
|
|
|
|
const SLOTS_QUIT
|
|
|
|
SLOTS_END_LOOP_F EQU 7
|
|
|
|
|
|
|
|
; ReelActionJumptable constants
|
|
|
|
const_def
|
|
|
|
const REEL_ACTION_DO_NOTHING
|
|
|
|
const REEL_ACTION_STOP_REEL_IGNORE_JOYPAD
|
|
|
|
const REEL_ACTION_QUADRUPLE_RATE
|
|
|
|
const REEL_ACTION_DOUBLE_RATE
|
|
|
|
const REEL_ACTION_NORMAL_RATE
|
|
|
|
const REEL_ACTION_HALF_RATE
|
|
|
|
const REEL_ACTION_QUARTER_RATE
|
|
|
|
const REEL_ACTION_STOP_REEL1
|
|
|
|
const REEL_ACTION_STOP_REEL2
|
|
|
|
const REEL_ACTION_STOP_REEL3
|
|
|
|
const REEL_ACTION_SET_UP_REEL2_SKIP_TO_7
|
|
|
|
const REEL_ACTION_WAIT_REEL2_SKIP_TO_7
|
|
|
|
const REEL_ACTION_FAST_SPIN_REEL2_UNTIL_LINED_UP_7S
|
|
|
|
const REEL_ACTION_UNUSED
|
|
|
|
const REEL_ACTION_CHECK_DROP_REEL
|
|
|
|
const REEL_ACTION_WAIT_DROP_REEL
|
|
|
|
const REEL_ACTION_START_SLOW_ADVANCE_REEL3
|
|
|
|
const REEL_ACTION_WAIT_SLOW_ADVANCE_REEL3
|
|
|
|
const REEL_ACTION_INIT_GOLEM
|
|
|
|
const REEL_ACTION_WAIT_GOLEM
|
|
|
|
const REEL_ACTION_END_GOLEM
|
|
|
|
const REEL_ACTION_INIT_CHANSEY
|
|
|
|
const REEL_ACTION_WAIT_CHANSEY
|
|
|
|
const REEL_ACTION_WAIT_EGG
|
|
|
|
const REEL_ACTION_DROP_REEL
|
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
_SlotMachine:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2016-01-04 13:43:55 +00:00
|
|
|
set NO_TEXT_SCROLL, [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call .InitGFX
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
|
|
|
call SlotsLoop
|
|
|
|
jr nc, .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_QUIT_SLOTS
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
call ClearBGPalettes
|
2018-01-02 19:00:14 +00:00
|
|
|
farcall StubbedTrainerRankings_EndSlotsWinStreak
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2016-01-04 13:43:55 +00:00
|
|
|
res NO_TEXT_SCROLL, [hl]
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, rLCDC
|
2017-12-29 17:53:21 +00:00
|
|
|
res rLCDC_SPRITE_SIZE, [hl] ; 8x8
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitGFX:
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearTileMap
|
|
|
|
call ClearSprites
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
call DisableLCD
|
2015-11-20 16:47:52 +00:00
|
|
|
hlbgcoord 0, 0
|
2017-12-28 12:32:33 +00:00
|
|
|
ld bc, vBGMap1 - vBGMap0
|
2015-11-20 20:15:32 +00:00
|
|
|
ld a, " "
|
2015-11-12 04:38:57 +00:00
|
|
|
call ByteFill
|
2015-12-28 15:57:04 +00:00
|
|
|
ld b, SCGB_SLOT_MACHINE
|
2015-11-12 04:38:57 +00:00
|
|
|
call GetSGBLayout
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar ClearSpriteAnims
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wSlots
|
|
|
|
ld bc, wSlotsDataEnd - wSlots
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, Slots2LZ
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles0 tile $00
|
2015-11-12 04:38:57 +00:00
|
|
|
call Decompress
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, Slots3LZ
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles0 tile $40
|
2015-11-12 04:38:57 +00:00
|
|
|
call Decompress
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, Slots1LZ
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2 tile $00
|
2015-11-12 04:38:57 +00:00
|
|
|
call Decompress
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, Slots2LZ
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2 tile $25
|
2015-11-12 04:38:57 +00:00
|
|
|
call Decompress
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, SlotsTilemap
|
|
|
|
decoord 0, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld bc, SCREEN_WIDTH * 12
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, rLCDC
|
2017-12-29 17:53:21 +00:00
|
|
|
set rLCDC_SPRITE_SIZE, [hl] ; 8x16
|
2015-11-12 04:38:57 +00:00
|
|
|
call EnableLCD
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, wSlots
|
|
|
|
ld bc, wSlotsEnd - wSlots
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_InitReelTiles
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_GetPals
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $7
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wSpriteAnimDict
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], $40
|
2017-12-28 18:38:15 +00:00
|
|
|
xor a ; SLOTS_INIT
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wJumptableIndex], a
|
2018-01-11 03:53:42 +00:00
|
|
|
ld a, SLOTS_NO_BIAS
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBias], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, MUSIC_GAME_CORNER
|
|
|
|
call PlayMusic
|
|
|
|
xor a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wKeepSevenBiasChance], a ; 87.5% chance
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
2015-12-11 03:26:31 +00:00
|
|
|
and %00101010
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nz
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 1
|
|
|
|
ld [wKeepSevenBiasChance], a ; 12.5% chance
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_GetPals:
|
2015-12-19 19:48:30 +00:00
|
|
|
ld a, %11100100
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbBGPals
|
2015-12-19 19:48:30 +00:00
|
|
|
lb de, %11100100, %11100100
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hCGB]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .cgb
|
2015-12-19 19:48:30 +00:00
|
|
|
lb de, %11000000, %11100100
|
2015-12-11 03:26:31 +00:00
|
|
|
.cgb
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbObjPals
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsLoop:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2017-12-28 18:38:15 +00:00
|
|
|
bit SLOTS_END_LOOP_F, a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .stop
|
|
|
|
call SlotsJumptable
|
|
|
|
call Slots_SpinReels
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar DoNextFrameForFirst16Sprites
|
2015-12-11 03:26:31 +00:00
|
|
|
call .PrintCoinsAndPayout
|
2018-01-02 18:38:56 +00:00
|
|
|
call .Stubbed_Function927d3
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.stop
|
2015-11-12 04:38:57 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Stubbed_Function927d3:
|
2015-12-11 03:26:31 +00:00
|
|
|
; dummied out
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1ReelAction]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel2ReelAction]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wFirstTwoReelsMatchingSevens]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .matching_sevens
|
2015-12-19 19:48:30 +00:00
|
|
|
ld a, %11100100
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbBGPals
|
|
|
|
ret
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.matching_sevens
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTextDelayFrames]
|
2015-11-12 04:38:57 +00:00
|
|
|
and $7
|
|
|
|
ret nz
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rBGP]
|
2015-12-19 19:48:30 +00:00
|
|
|
xor %00001100
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbBGPals
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PrintCoinsAndPayout:
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 5, 1
|
2018-01-23 21:45:34 +00:00
|
|
|
ld de, wCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 4
|
|
|
|
call PrintNum
|
|
|
|
hlcoord 11, 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, wPayout
|
2015-11-12 04:38:57 +00:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 4
|
|
|
|
call PrintNum
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Unreferenced_Function92811:
|
2018-01-02 15:04:21 +00:00
|
|
|
; debug function?
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
add 0
|
|
|
|
daa
|
|
|
|
ld e, a
|
|
|
|
and $f
|
|
|
|
add "0"
|
|
|
|
hlcoord 1, 0
|
|
|
|
ld [hl], a
|
|
|
|
ld a, e
|
|
|
|
swap a
|
|
|
|
and $f
|
|
|
|
add "0"
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Unreferenced_Function9282c:
|
2015-12-11 03:26:31 +00:00
|
|
|
; animate OAM tiles?
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wcf66
|
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
|
|
|
and $7
|
|
|
|
ret nz
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite16TileID
|
2018-01-10 18:47:57 +00:00
|
|
|
ld c, NUM_SPRITE_OAM_STRUCTS - 16
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2018-01-10 18:47:57 +00:00
|
|
|
xor %00100000
|
|
|
|
ld [hli], a ; tile id
|
2018-02-03 03:55:38 +00:00
|
|
|
rept SPRITEOAMSTRUCT_LENGTH + -1
|
2016-05-10 16:31:49 +00:00
|
|
|
inc hl
|
2018-01-10 18:47:57 +00:00
|
|
|
endr
|
2015-11-12 04:38:57 +00:00
|
|
|
dec c
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsJumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
jumptable .Jumptable, wJumptableIndex
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Jumptable:
|
2017-12-28 19:23:17 +00:00
|
|
|
dw SlotsAction_Init ; 00
|
|
|
|
dw SlotsAction_BetAndStart ; 01
|
|
|
|
dw SlotsAction_WaitStart ; 02
|
|
|
|
dw SlotsAction_WaitReel1 ; 03
|
|
|
|
dw SlotsAction_WaitStopReel1 ; 04
|
|
|
|
dw SlotsAction_WaitReel2 ; 05
|
|
|
|
dw SlotsAction_WaitStopReel2 ; 06
|
|
|
|
dw SlotsAction_WaitReel3 ; 07
|
|
|
|
dw SlotsAction_WaitStopReel3 ; 08
|
|
|
|
dw SlotsAction_Next ; 09
|
|
|
|
dw SlotsAction_Next ; 0a
|
|
|
|
dw SlotsAction_Next ; 0b
|
|
|
|
dw SlotsAction_FlashIfWin ; 0c
|
|
|
|
dw SlotsAction_FlashScreen ; 0d
|
|
|
|
dw SlotsAction_GiveEarnedCoins ; 0e
|
|
|
|
dw SlotsAction_PayoutTextAndAnim ; 0f
|
|
|
|
dw SlotsAction_PayoutAnim ; 10
|
|
|
|
dw SlotsAction_RestartOrQuit ; 11
|
|
|
|
dw SlotsAction_Quit ; 12
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_Next:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_Init:
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wFirstTwoReelsMatching], a
|
|
|
|
ld [wFirstTwoReelsMatchingSevens], a
|
2018-01-11 03:53:42 +00:00
|
|
|
ld a, SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotMatched], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_BetAndStart:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_AskBet
|
|
|
|
jr nc, .proceed
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, SLOTS_QUIT
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.proceed
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_IlluminateBetLights
|
|
|
|
call Slots_InitBias
|
|
|
|
ld a, 32
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
|
|
|
ld a, REEL_ACTION_NORMAL_RATE
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wReel1ReelAction], a
|
|
|
|
ld [wReel2ReelAction], a
|
|
|
|
ld [wReel3ReelAction], a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 4
|
|
|
|
ld [wReel1ManipCounter], a
|
|
|
|
ld [wReel2ManipCounter], a
|
|
|
|
ld [wReel3ManipCounter], a
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ld a, SFX_SLOT_MACHINE_START
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitStart:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, wSlotsDelay
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .proceed
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.proceed
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hJoypadSum], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitReel1:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, hJoypadSum
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
|
|
|
ret z
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel1
|
|
|
|
ld [wReel1ReelAction], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitStopReel1:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1ReelAction]
|
2017-12-28 18:38:15 +00:00
|
|
|
cp REEL_ACTION_DO_NOTHING
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nz
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
ld bc, wReel1
|
|
|
|
ld de, wReel1Stopped
|
|
|
|
call Slots_LoadReelState
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hJoypadSum], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitReel2:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, hJoypadSum
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
|
|
|
ret z
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel2
|
|
|
|
ld [wReel2ReelAction], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitStopReel2:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel2ReelAction]
|
2017-12-28 18:38:15 +00:00
|
|
|
cp REEL_ACTION_DO_NOTHING
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nz
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
ld bc, wReel2
|
|
|
|
ld de, wReel2Stopped
|
|
|
|
call Slots_LoadReelState
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hJoypadSum], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitReel3:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, hJoypadSum
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
|
|
|
ret z
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel3
|
|
|
|
ld [wReel3ReelAction], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_WaitStopReel3:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel3ReelAction]
|
2017-12-28 18:38:15 +00:00
|
|
|
cp REEL_ACTION_DO_NOTHING
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nz
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
ld bc, wReel3
|
|
|
|
ld de, wReel3Stopped
|
|
|
|
call Slots_LoadReelState
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hJoypadSum], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_FlashIfWin:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotMatched]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .GotIt
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.GotIt:
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, 16
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_FlashScreen:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, wSlotsDelay
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .done
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
srl a
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rOBP0]
|
2015-11-12 04:38:57 +00:00
|
|
|
xor $ff
|
|
|
|
ld e, a
|
|
|
|
ld d, a
|
|
|
|
call DmgToCgbObjPals
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.done
|
|
|
|
call Slots_GetPals
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_GiveEarnedCoins:
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wFirstTwoReelsMatching], a
|
|
|
|
ld [wFirstTwoReelsMatchingSevens], a
|
2015-12-19 19:48:30 +00:00
|
|
|
ld a, %11100100
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbBGPals
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_GetPayout
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_PayoutTextAndAnim:
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_PayoutText
|
|
|
|
call SlotsAction_Next
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_PayoutAnim:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, wSlotsDelay
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
|
|
|
and $1
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wPayout
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
or [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .done
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, [hl]
|
|
|
|
dec de
|
|
|
|
ld [hl], e
|
|
|
|
dec hl
|
|
|
|
ld [hl], d
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, [hl]
|
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_CheckCoinCaseFull
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .okay
|
2015-11-12 04:38:57 +00:00
|
|
|
inc de
|
2015-12-11 03:26:31 +00:00
|
|
|
.okay
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
dec hl
|
|
|
|
ld [hl], d
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, [wSlotsDelay]
|
2015-11-12 04:38:57 +00:00
|
|
|
and $7
|
2015-12-11 03:26:31 +00:00
|
|
|
ret z ; ret nz would be more appropriate
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_GET_COIN_FROM_SLOTS
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.done
|
2017-12-28 19:23:17 +00:00
|
|
|
call SlotsAction_Next
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_RestartOrQuit:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_DeilluminateBetLights
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitPressAorB_BlinkCursor
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_AskPlayAgain
|
|
|
|
jr c, .exit_slots
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, SLOTS_INIT
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.exit_slots
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, SLOTS_QUIT
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsAction_Quit:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
2017-12-28 18:38:15 +00:00
|
|
|
set SLOTS_END_LOOP_F, [hl]
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_LoadReelState:
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_GetCurrentReelState
|
2015-11-12 04:38:57 +00:00
|
|
|
pop de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_CheckCoinCaseFull:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, d
|
2017-12-25 18:40:10 +00:00
|
|
|
cp HIGH(MAX_COINS)
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .not_full
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
2017-12-25 18:40:10 +00:00
|
|
|
cp LOW(MAX_COINS)
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .not_full
|
2015-11-12 04:38:57 +00:00
|
|
|
scf
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.not_full
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_GetCurrentReelState:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .okay
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $f
|
2015-12-11 03:26:31 +00:00
|
|
|
.okay
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
and $f
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_TILEMAP_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_StopReel1:
|
2017-12-28 18:38:15 +00:00
|
|
|
; Always set the REEL_ACTION_STOP_REEL1 action.
|
|
|
|
ld a, REEL_ACTION_STOP_REEL1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_StopReel2:
|
2017-12-28 18:38:15 +00:00
|
|
|
; As long as, the following three meet, there's a 31.25% chance
|
|
|
|
; to set action REEL_ACTION_SET_UP_REEL2_SKIP_TO_7:
|
|
|
|
; - Bet is >= 2 coins
|
|
|
|
; - There's a 7 symbol visible in reel #1
|
|
|
|
; - Current spin isn't biased or is biased towards SEVEN
|
|
|
|
; In any other case, REEL_ACTION_STOP_REEL2 is set.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBet]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $2
|
2015-12-19 19:48:30 +00:00
|
|
|
jr c, .dont_jump
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .skip
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_BIAS
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nz, .dont_jump
|
2015-12-11 03:26:31 +00:00
|
|
|
.skip
|
|
|
|
call .CheckReel1ForASeven
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nz, .dont_jump
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
2015-12-11 03:26:31 +00:00
|
|
|
cp $50 ; 32%
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .dont_jump
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_SET_UP_REEL2_SKIP_TO_7
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.dont_jump
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_STOP_REEL2
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckReel1ForASeven:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 1]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 2]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_StopReel3:
|
2017-12-28 18:38:15 +00:00
|
|
|
; If no matching SEVEN symbols in reels #1 and #2:
|
|
|
|
; - REEL_ACTION_STOP_REEL3, 100%
|
|
|
|
|
|
|
|
; If matching SEVEN symbols and NO bias to SEVEN:
|
|
|
|
; - REEL_ACTION_STOP_REEL3, 37.5%
|
|
|
|
; - REEL_ACTION_START_SLOW_ADVANCE_REEL3, 31.3%
|
|
|
|
; - REEL_ACTION_INIT_GOLEM, 31.3%
|
|
|
|
; - REEL_ACTION_INIT_CHANSEY, 0%
|
|
|
|
|
|
|
|
; If matching SEVEN symbols and bias to SEVEN:
|
|
|
|
; - REEL_ACTION_STOP_REEL3, 29.7%
|
|
|
|
; - REEL_ACTION_START_SLOW_ADVANCE_REEL3, 23.4%
|
|
|
|
; - REEL_ACTION_INIT_GOLEM, 23.4%
|
|
|
|
; - REEL_ACTION_INIT_CHANSEY, 23.4%
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wFirstTwoReelsMatching]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .stop
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wFirstTwoReelsMatchingSevens]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .stop
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .biased
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
|
|
|
cp 180
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .stop
|
2015-11-12 04:38:57 +00:00
|
|
|
cp 120
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .slow_advance
|
2015-11-12 04:38:57 +00:00
|
|
|
cp 60
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .golem
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_INIT_CHANSEY
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.biased
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
2015-12-11 03:26:31 +00:00
|
|
|
cp 160
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .stop
|
2015-12-11 03:26:31 +00:00
|
|
|
cp 80
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .slow_advance
|
|
|
|
.golem
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_INIT_GOLEM
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.slow_advance
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_START_SLOW_ADVANCE_REEL3
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.stop
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_STOP_REEL3
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_InitReelTiles:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld bc, wReel1
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_OAM_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2018-01-30 19:52:46 +00:00
|
|
|
ld de, wVirtualOAMSprite16
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_TILEMAP_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, Reel1Tilemap
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_X_COORD
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [hl], 6 * 8
|
|
|
|
call .OAM
|
|
|
|
|
|
|
|
ld bc, wReel2
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_OAM_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2018-01-30 19:52:46 +00:00
|
|
|
ld de, wVirtualOAMSprite24
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_TILEMAP_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, Reel2Tilemap
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_X_COORD
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [hl], 10 * 8
|
|
|
|
call .OAM
|
|
|
|
|
|
|
|
ld bc, wReel3
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_OAM_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2018-01-30 19:52:46 +00:00
|
|
|
ld de, wVirtualOAMSprite32
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_TILEMAP_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, Reel3Tilemap
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_X_COORD
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [hl], 14 * 8
|
|
|
|
call .OAM
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.OAM:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], REEL_ACTION_DO_NOTHING
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [hl], REEL_SIZE - 1
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_DISTANCE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], REEL_ACTION_DO_NOTHING
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_UpdateReelPositionAndOAM
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_SpinReels:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld bc, wReel1
|
|
|
|
call .SpinReel
|
|
|
|
ld bc, wReel2
|
|
|
|
call .SpinReel
|
|
|
|
ld bc, wReel3
|
|
|
|
call .SpinReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.SpinReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_DISTANCE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and $f
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .skip
|
2017-12-28 18:38:15 +00:00
|
|
|
call ReelActionJumptable
|
2015-12-11 03:26:31 +00:00
|
|
|
.skip
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld d, a
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_DISTANCE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
|
|
|
and $f
|
2017-12-28 19:23:17 +00:00
|
|
|
jr z, Slots_UpdateReelPositionAndOAM
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_OAM_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld e, $8
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
add d
|
|
|
|
ld [hli], a
|
|
|
|
inc hl
|
2016-05-10 16:31:49 +00:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-11-12 04:38:57 +00:00
|
|
|
dec e
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_UpdateReelPositionAndOAM:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_X_COORD
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurReelXCoord], a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, 10 * 8
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurReelYCoord], a
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld d, 0
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_TILEMAP_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
2015-12-11 03:26:31 +00:00
|
|
|
call .LoadOAM
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
and $f
|
2015-12-11 03:26:31 +00:00
|
|
|
cp REEL_SIZE
|
|
|
|
jr nz, .load
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-11 03:26:31 +00:00
|
|
|
.load
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LoadOAM:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_OAM_ADDR
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurReelYCoord]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; y
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurReelXCoord]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; x
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [de]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; tile id
|
2015-11-12 04:38:57 +00:00
|
|
|
srl a
|
|
|
|
srl a
|
2018-01-10 18:47:57 +00:00
|
|
|
set OAM_PRIORITY, a
|
|
|
|
ld [hli], a ; attributes
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurReelYCoord]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; y
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurReelXCoord]
|
2018-01-10 18:47:57 +00:00
|
|
|
add 1 * TILE_WIDTH
|
|
|
|
ld [hli], a ; x
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [de]
|
|
|
|
inc a
|
2015-12-11 03:26:31 +00:00
|
|
|
inc a
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; tile id
|
2015-11-12 04:38:57 +00:00
|
|
|
srl a
|
|
|
|
srl a
|
2018-01-10 18:47:57 +00:00
|
|
|
set OAM_PRIORITY, a
|
|
|
|
ld [hli], a ; attributes
|
2015-11-12 04:38:57 +00:00
|
|
|
inc de
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurReelYCoord]
|
2018-01-10 18:47:57 +00:00
|
|
|
sub 2 * TILE_WIDTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurReelYCoord], a
|
2018-01-10 18:47:57 +00:00
|
|
|
cp 2 * TILE_WIDTH
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Unreferenced_Function92bbe:
|
2015-11-12 04:38:57 +00:00
|
|
|
push hl
|
|
|
|
srl a
|
|
|
|
srl a
|
2017-12-25 18:40:10 +00:00
|
|
|
add LOW(.Unknown_92bce)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld l, a
|
|
|
|
ld a, 0
|
2017-12-25 18:40:10 +00:00
|
|
|
adc HIGH(.Unknown_92bce)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Unknown_92bce:
|
2015-11-12 04:38:57 +00:00
|
|
|
db 0, 1, 2, 3, 4, 5
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelActionJumptable:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
2017-12-28 18:38:15 +00:00
|
|
|
ld hl, .Jumptable
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw ReelAction_DoNothing ; 00
|
2017-12-28 18:38:15 +00:00
|
|
|
dw ReelAction_StopReelIgnoreJoypad ; 01
|
2015-12-27 02:59:03 +00:00
|
|
|
dw ReelAction_QuadrupleRate ; 02
|
|
|
|
dw ReelAction_DoubleRate ; 03
|
|
|
|
dw ReelAction_NormalRate ; 04
|
|
|
|
dw ReelAction_HalfRate ; 05
|
|
|
|
dw ReelAction_QuarterRate ; 06
|
|
|
|
dw ReelAction_StopReel1 ; 07
|
|
|
|
dw ReelAction_StopReel2 ; 08
|
|
|
|
dw ReelAction_StopReel3 ; 09
|
|
|
|
dw ReelAction_SetUpReel2SkipTo7 ; 0a
|
|
|
|
dw ReelAction_WaitReel2SkipTo7 ; 0b
|
|
|
|
dw ReelAction_FastSpinReel2UntilLinedUp7s ; 0c
|
2017-12-28 18:38:15 +00:00
|
|
|
dw ReelAction_Unused ; 0d
|
2015-12-27 02:59:03 +00:00
|
|
|
dw ReelAction_CheckDropReel ; 0e
|
|
|
|
dw ReelAction_WaitDropReel ; 0f
|
|
|
|
dw ReelAction_StartSlowAdvanceReel3 ; 10
|
|
|
|
dw ReelAction_WaitSlowAdvanceReel3 ; 11
|
|
|
|
dw ReelAction_InitGolem ; 12
|
|
|
|
dw ReelAction_WaitGolem ; 13
|
|
|
|
dw ReelAction_EndGolem ; 14
|
2017-12-28 18:38:15 +00:00
|
|
|
dw ReelAction_InitChansey ; 15
|
2015-12-27 02:59:03 +00:00
|
|
|
dw ReelAction_WaitChansey ; 16
|
|
|
|
dw ReelAction_WaitEgg ; 17
|
|
|
|
dw ReelAction_DropReel ; 18
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_DoNothing:
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_QuadrupleRate:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 16
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_DoubleRate:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 8
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_NormalRate:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 4
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_HalfRate:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 2
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_QuarterRate:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_StopReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], REEL_ACTION_STOP_REEL_IGNORE_JOYPAD
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_STOP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 3
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_StopReelIgnoreJoypad:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_STOP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .EndReel
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.EndReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, REEL_ACTION_DO_NOTHING
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_StopReel1:
|
2017-12-28 18:38:15 +00:00
|
|
|
; If no bias: don't manipulate reel.
|
2017-12-29 15:48:47 +00:00
|
|
|
; If bias: manipulate reel up to wReel1ManipCounter (i.e. 4) slots,
|
2017-12-28 18:38:15 +00:00
|
|
|
; stoping early if the biased symbol shows up anywhere in reel #1,
|
|
|
|
; even if the current bet won't allow lining it up.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_BIAS
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .NoBias
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_COUNTER
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .NoBias
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckForBias
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nz
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoBias:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckForBias:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_GetCurrentReelState
|
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
cp e
|
|
|
|
ret z
|
|
|
|
ld a, [hli]
|
|
|
|
cp e
|
|
|
|
ret z
|
|
|
|
ld a, [hl]
|
|
|
|
cp e
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_StopReel2:
|
2017-12-28 18:38:15 +00:00
|
|
|
; If no bias: don't manipulate reel.
|
2017-12-29 15:48:47 +00:00
|
|
|
; If bias: manipulate reel up to wReel2ManipCounter (i.e. 4) slots,
|
2017-12-28 18:38:15 +00:00
|
|
|
; stoping early if the biased symbol is lined up in the first two
|
|
|
|
; reels, according to the lines that the current bet allows.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedFirstTwoReels
|
|
|
|
jr nc, .nope
|
|
|
|
ld a, [wSlotBuildingMatch]
|
|
|
|
ld hl, wSlotBias
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2015-12-11 03:26:31 +00:00
|
|
|
.nope
|
|
|
|
ld a, [wSlotBias]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_BIAS
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_COUNTER
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoBias:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_StopReel3:
|
2017-12-29 15:48:47 +00:00
|
|
|
; Manipulate the reel up to wReel3ManipCounter (i.e. 4) slots,
|
2017-12-28 18:38:15 +00:00
|
|
|
; stopping early if the bias symbol is lined up for a win.
|
|
|
|
; If not biased to any symbols, stop as soon as nothing is lined up.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
|
|
|
jr nc, .NoMatch
|
|
|
|
ld hl, wSlotBias
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_COUNTER
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoMatch:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_BIAS
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_COUNTER
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .NoBias
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoBias:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_SetUpReel2SkipTo7:
|
2017-12-28 18:38:15 +00:00
|
|
|
; Unique reel 2 action (see Slots_StopReel2)
|
|
|
|
; Ensures that 7 symbols become lined up in the first two reels,
|
|
|
|
; but more often than not, this is only a way to get our hopes up, as
|
|
|
|
; it makes exciting reel #3 modes with no success hope more common.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedFirstTwoReels
|
|
|
|
jr nc, .no_match
|
|
|
|
ld a, [wFirstTwoReelsMatchingSevens]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .no_match
|
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.no_match
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_REEL2_SKIP_TO_7
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 32
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitReel2SkipTo7:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_92d02
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_92d02
|
|
|
|
ld a, SFX_THROW_BALL
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_FAST_SPIN_REEL2_UNTIL_LINED_UP_7S
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 8
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_FastSpinReel2UntilLinedUp7s:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedFirstTwoReels
|
2015-11-12 04:38:57 +00:00
|
|
|
ret nc
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wFirstTwoReelsMatchingSevens]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_InitGolem:
|
2017-12-28 18:38:15 +00:00
|
|
|
; Ensures SEVENs are lined up if there's bias to SEVEN.
|
|
|
|
; Ensures nothing is lined up if there's no bias symbols.
|
|
|
|
; No other bias symbols are compatible with this mode.
|
|
|
|
|
|
|
|
; This is achieved by throwing Golem until the desired result
|
|
|
|
; is produced. The amount of Golem thrown can be anywhere from
|
|
|
|
; 1 to 14 for SEVEN bias, and 4-8 for no bias.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
ret c
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
call Slots_WaitSFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_GOLEM
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_GetNumberOfGolems
|
2015-11-12 04:38:57 +00:00
|
|
|
push bc
|
|
|
|
push af
|
2015-11-18 18:01:55 +00:00
|
|
|
depixel 12, 13
|
2017-12-09 05:50:59 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_SLOTS_GOLEM
|
2015-11-13 15:48:49 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
|
|
|
pop bc
|
|
|
|
xor a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitGolem:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, [wSlotsDelay]
|
2015-12-19 19:48:30 +00:00
|
|
|
cp 2
|
|
|
|
jr z, .two
|
|
|
|
cp 1
|
|
|
|
jr z, .one
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.two
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.one
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_END_GOLEM
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 8
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_EndGolem:
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
dec [hl] ; REEL_ACTION_WAIT_GOLEM
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_InitChansey:
|
2017-12-28 18:38:15 +00:00
|
|
|
; Ensures the lining up of SEVEN symbols, but this mode is only possible
|
|
|
|
; when there is bias to SEVEN symbols (and even then, it's still rare).
|
2017-12-28 19:27:44 +00:00
|
|
|
; Chansey releases and egg and reel #3 is made to advance 17 slots very
|
2017-12-28 18:38:15 +00:00
|
|
|
; quickly as many times as necessary for the match to SEVENs to show up.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
ret c
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
call Slots_WaitSFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_CHANSEY
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2015-11-12 04:38:57 +00:00
|
|
|
push bc
|
2015-11-18 18:01:55 +00:00
|
|
|
depixel 12, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_SLOTS_CHANSEY
|
2015-11-13 15:48:49 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-11-12 04:38:57 +00:00
|
|
|
pop bc
|
|
|
|
xor a
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [wSlotsDelay], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitChansey:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, [wSlotsDelay]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_EGG
|
|
|
|
ld a, 2
|
|
|
|
ld [wSlotsDelay], a
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitEgg:
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, [wSlotsDelay]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $4
|
|
|
|
ret c
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_DROP_REEL
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 16
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 17
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_DropReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .check_match
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.check_match
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .EggAgain
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nz, .EggAgain
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 5
|
|
|
|
ld [wSlotsDelay], a
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.EggAgain:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
dec [hl]
|
2017-12-28 18:38:15 +00:00
|
|
|
dec [hl] ; REEL_ACTION_WAIT_CHANSEY
|
|
|
|
ld a, 1
|
|
|
|
ld [wSlotsDelay], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_Unused:
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
ret c
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
call Slots_WaitSFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_CHECK_DROP_REEL
|
2017-12-28 19:23:17 +00:00
|
|
|
call Slots_GetNumberOfGolems
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_CheckDropReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .spin
|
|
|
|
call Slots_CheckMatchedAllThreeReels
|
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.spin
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_DROP_REEL
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_FIELD_0B
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 32
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 0
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitDropReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_FIELD_0B
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .DropReel
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.DropReel:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
dec [hl]
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 8
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_StartSlowAdvanceReel3:
|
2017-12-28 18:38:15 +00:00
|
|
|
; Ensures SEVENs are lined up if there's bias to SEVEN.
|
|
|
|
; Ensures nothing is lined up if there's no bias symbols.
|
|
|
|
; No other bias symbols are compatible with this mode.
|
|
|
|
|
|
|
|
; This is achieved by slowly advancing the reel a full round,
|
|
|
|
; plus any necessary slot until the desired result is produced.
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
ret c
|
|
|
|
ld a, SFX_STOP_SLOT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
|
|
|
call Slots_WaitSFX
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_SPIN_RATE
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 1
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_ACTION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
inc [hl] ; REEL_ACTION_WAIT_SLOW_ADVANCE_REEL3
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2017-12-28 18:38:15 +00:00
|
|
|
ld [hl], 16
|
2018-06-24 14:09:41 +00:00
|
|
|
ReelAction_WaitSlowAdvanceReel3:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_MANIP_DELAY
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr z, .check1
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-19 19:48:30 +00:00
|
|
|
.play_sfx
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_GOT_SAFARI_BALLS
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.check1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nz, .check2
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nc, .play_sfx
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-19 19:48:30 +00:00
|
|
|
jr nz, .play_sfx
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ret
|
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
.check2
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-12-19 19:48:30 +00:00
|
|
|
jr c, .play_sfx
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_StopReel
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_CheckMatchedFirstTwoReels:
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wFirstTwoReelsMatching], a
|
|
|
|
ld [wFirstTwoReelsMatchingSevens], a
|
|
|
|
call Slots_GetCurrentReelState
|
|
|
|
call Slots_CopyReelState
|
|
|
|
ld a, [wSlotBet]
|
2015-11-12 04:38:57 +00:00
|
|
|
and 3
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Jumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, .return
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.return
|
|
|
|
ld a, [wFirstTwoReelsMatching]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
scf
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .zero
|
|
|
|
dw .one
|
|
|
|
dw .two
|
|
|
|
dw .three
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.three
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckUpwardsDiag
|
|
|
|
call .CheckDownwardsDiag
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.two
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckBottomRow
|
|
|
|
call .CheckTopRow
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.one
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckMiddleRow
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.zero
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckBottomRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckUpwardsDiag:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckMiddleRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 1]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckDownwardsDiag:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 2]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckTopRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 2
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 2]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.StoreResult:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBuildingMatch], a
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .matching_sevens
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wFirstTwoReelsMatchingSevens], a
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.matching_sevens
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wFirstTwoReelsMatching], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_CheckMatchedAllThreeReels:
|
2018-01-11 03:53:42 +00:00
|
|
|
ld a, SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotMatched], a
|
|
|
|
call Slots_GetCurrentReelState
|
|
|
|
call Slots_CopyReelState
|
|
|
|
ld a, [wSlotBet]
|
2015-11-12 04:38:57 +00:00
|
|
|
and 3
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Jumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, .return
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.return
|
|
|
|
ld a, [wSlotMatched]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .matched_nontrivial
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.matched_nontrivial
|
2015-11-12 04:38:57 +00:00
|
|
|
scf
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .zero
|
|
|
|
dw .one
|
|
|
|
dw .two
|
|
|
|
dw .three
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.three
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckUpwardsDiag
|
|
|
|
call .CheckDownwardsDiag
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.two
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckBottomRow
|
|
|
|
call .CheckTopRow
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.one
|
2015-12-11 03:26:31 +00:00
|
|
|
call .CheckMiddleRow
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.zero
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckBottomRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wReel2Stopped
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckUpwardsDiag:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 2
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wReel2Stopped + 1
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckMiddleRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 1
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 1]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wReel2Stopped + 1
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckDownwardsDiag:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 2]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wReel2Stopped + 1
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckTopRow:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld hl, wCurReelStopped + 2
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wReel1Stopped + 2]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, wReel2Stopped + 2
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
call z, .StoreResult
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.StoreResult:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotMatched], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_CopyReelState:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld de, wCurReelStopped
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_GetNumberOfGolems:
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
push hl
|
2015-12-19 19:48:30 +00:00
|
|
|
call .Check7Bias
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
|
|
|
ld a, e
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Check7Bias:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .not_biased_to_seven
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, $0
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop1
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
inc e
|
|
|
|
push de
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
pop de
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nc, .loop1
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .loop1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.not_biased_to_seven
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
|
|
|
and $7
|
2015-12-19 19:48:30 +00:00
|
|
|
cp $4 ; ((50 percent) & 7) + 1
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .not_biased_to_seven
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop2
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
inc e
|
2017-12-29 15:48:47 +00:00
|
|
|
ld hl, REEL_POSITION
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
|
|
|
push de
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_CheckMatchedAllThreeReels
|
2015-11-12 04:38:57 +00:00
|
|
|
pop de
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .loop2
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_InitBias:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotBias]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Normal
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .okay
|
|
|
|
ld hl, .Lucky
|
|
|
|
.okay
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
|
|
|
ld c, a
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
cp c
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nc, .done
|
2015-11-12 04:38:57 +00:00
|
|
|
inc hl
|
2015-12-11 03:26:31 +00:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBias], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Normal:
|
2015-12-11 03:26:31 +00:00
|
|
|
db $01, SLOTS_SEVEN ; 1/256
|
|
|
|
db $03, SLOTS_POKEBALL ; 1/128
|
|
|
|
db $0a, SLOTS_STARYU ; 7/256
|
|
|
|
db $14, SLOTS_SQUIRTLE ; 5/128
|
|
|
|
db $28, SLOTS_PIKACHU ; 5/64
|
|
|
|
db $30, SLOTS_CHERRY ; 1/32
|
2018-01-11 03:53:42 +00:00
|
|
|
db $ff, SLOTS_NO_BIAS ; everything else
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Lucky:
|
2015-12-11 03:26:31 +00:00
|
|
|
db $02, SLOTS_SEVEN ; 1/128
|
|
|
|
db $03, SLOTS_POKEBALL ; 1/256
|
|
|
|
db $08, SLOTS_STARYU ; 5/256
|
|
|
|
db $10, SLOTS_SQUIRTLE ; 1/32
|
|
|
|
db $1e, SLOTS_PIKACHU ; 7/128
|
|
|
|
db $50, SLOTS_CHERRY ; 25/128
|
2018-01-11 03:53:42 +00:00
|
|
|
db $ff, SLOTS_NO_BIAS ; everything else
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_IlluminateBetLights:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld b, $14 ; turned on
|
|
|
|
ld a, [wSlotBet]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, Slots_Lights1OnOff
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, Slots_Lights2OnOff
|
|
|
|
jr Slots_Lights3OnOff
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_DeilluminateBetLights:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld b, $23 ; turned off
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_Lights3OnOff:
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 3, 2
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_TurnLightsOnOrOff
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 3, 10
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_TurnLightsOnOrOff
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_Lights2OnOff:
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 3, 4
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_TurnLightsOnOrOff
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 3, 8
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_TurnLightsOnOrOff
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_Lights1OnOff:
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 3, 6
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_TurnLightsOnOrOff:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, b
|
|
|
|
ld [hl], a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, SCREEN_WIDTH / 2 + 3
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, SCREEN_WIDTH / 2 - 3
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
inc a
|
|
|
|
ld [hl], a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, SCREEN_WIDTH / 2 + 3
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_AskBet:
|
2015-12-11 03:26:31 +00:00
|
|
|
.loop
|
|
|
|
ld hl, .Text_BetHowManyCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call LoadMenuHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
2015-11-12 04:38:57 +00:00
|
|
|
ret c
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld b, a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, 4
|
2015-11-12 04:38:57 +00:00
|
|
|
sub b
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBet], a
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
ld c, a
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .Start
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
cp c
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nc, .Start
|
|
|
|
ld hl, .Text_NotEnoughCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
2015-12-11 03:26:31 +00:00
|
|
|
jr .loop
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Start:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wCoins + 1
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
sub c
|
|
|
|
ld [hld], a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nc, .ok
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
.ok
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_PAY_DAY
|
|
|
|
call PlaySFX
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Text_Start
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
|
|
|
and a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_BetHowManyCoins:
|
2015-11-12 04:38:57 +00:00
|
|
|
; Bet how many coins?
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c5049
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_Start:
|
2015-11-12 04:38:57 +00:00
|
|
|
; Start!
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c505e
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_NotEnoughCoins:
|
2015-11-12 04:38:57 +00:00
|
|
|
; Not enough coins.
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c5066
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 14, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-11-12 04:38:57 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR ; flags
|
2015-11-12 04:38:57 +00:00
|
|
|
db 3 ; items
|
|
|
|
db " 3@"
|
|
|
|
db " 2@"
|
|
|
|
db " 1@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_AskPlayAgain:
|
2018-01-23 21:45:34 +00:00
|
|
|
ld hl, wCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .you_have_coins
|
|
|
|
ld hl, .Text_OutOfCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
|
|
|
ld c, 60
|
|
|
|
call DelayFrames
|
2015-12-11 03:26:31 +00:00
|
|
|
jr .exit_slots
|
|
|
|
|
|
|
|
.you_have_coins
|
|
|
|
ld hl, .Text_PlayAgain
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
|
|
|
call LoadMenuTextBox
|
|
|
|
lb bc, 14, 12
|
|
|
|
call PlaceYesNoBox
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .exit_slots
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.exit_slots
|
2015-11-12 04:38:57 +00:00
|
|
|
scf
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Text_OutOfCoins:
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c5079
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Text_PlayAgain:
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c5092
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_GetPayout:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotMatched]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .no_win
|
2015-11-12 04:38:57 +00:00
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .PayoutTable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wPayout + 1], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
ld a, [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wPayout], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, a
|
2018-01-02 19:00:14 +00:00
|
|
|
farcall StubbedTrainerRankings_AddToSlotsPayouts
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.PayoutTable:
|
2015-12-11 03:26:31 +00:00
|
|
|
dw 300
|
|
|
|
dw 50
|
|
|
|
dw 6
|
|
|
|
dw 8
|
|
|
|
dw 10
|
|
|
|
dw 15
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-11 03:26:31 +00:00
|
|
|
.no_win
|
|
|
|
ld hl, wPayout
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_PayoutText:
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotMatched]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp SLOTS_NO_MATCH
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .MatchedSomething
|
|
|
|
ld hl, .Text_Darn
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
2018-01-02 19:00:14 +00:00
|
|
|
farcall StubbedTrainerRankings_EndSlotsWinStreak
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.MatchedSomething:
|
2015-11-12 04:38:57 +00:00
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .PayoutStrings
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer2
|
2015-12-11 03:26:31 +00:00
|
|
|
ld bc, 4
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld de, .return
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.return
|
|
|
|
ld hl, .Text_PrintPayout
|
2015-11-12 04:38:57 +00:00
|
|
|
call PrintText
|
2018-01-02 19:00:14 +00:00
|
|
|
farcall StubbedTrainerRankings_AddToSlotsWinStreak
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PayoutStrings:
|
2015-12-11 03:26:31 +00:00
|
|
|
dbw "300@", .LinedUpSevens
|
|
|
|
dbw "50@@", .LinedUpPokeballs
|
|
|
|
dbw "6@@@", .LinedUpMonOrCherry
|
|
|
|
dbw "8@@@", .LinedUpMonOrCherry
|
|
|
|
dbw "10@@", .LinedUpMonOrCherry
|
|
|
|
dbw "15@@", .LinedUpMonOrCherry
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_PrintPayout:
|
2018-11-17 18:33:03 +00:00
|
|
|
text_asm
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, [wSlotMatched]
|
2015-11-12 04:38:57 +00:00
|
|
|
add $25
|
|
|
|
ldcoord_a 2, 13
|
|
|
|
inc a
|
|
|
|
ldcoord_a 2, 14
|
|
|
|
inc a
|
|
|
|
ldcoord_a 3, 13
|
|
|
|
inc a
|
|
|
|
ldcoord_a 3, 14
|
|
|
|
hlcoord 18, 17
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [hl], "▼"
|
|
|
|
ld hl, .Text_LinedUpWonCoins
|
2015-11-12 04:38:57 +00:00
|
|
|
rept 4
|
|
|
|
inc bc
|
|
|
|
endr
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_LinedUpWonCoins:
|
2015-11-12 04:38:57 +00:00
|
|
|
; lined up! Won @ coins!
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c509f
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_Darn:
|
2015-11-12 04:38:57 +00:00
|
|
|
; Darn!
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c50bb
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LinedUpSevens:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_2ND_PLACE
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
2017-12-28 18:38:15 +00:00
|
|
|
|
|
|
|
; Oddly, the rarest mode (wKeepSevenBiasChance = 1) is the one with
|
|
|
|
; the worse odds to favor seven symbol streaks (12.5% vs 25%).
|
|
|
|
; it's possible that either the wKeepSevenBiasChance initialization
|
|
|
|
; or this code was intended to lead to flipped percentages.
|
|
|
|
ld a, [wKeepSevenBiasChance]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2017-12-29 12:52:42 +00:00
|
|
|
jr nz, .lower_seven_streak_odds
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
2017-12-28 18:38:15 +00:00
|
|
|
and %0010100
|
|
|
|
ret z ; 25% chance to stick with seven symbol bias
|
2018-01-11 03:53:42 +00:00
|
|
|
ld a, SLOTS_NO_BIAS
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBias], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-29 12:52:42 +00:00
|
|
|
.lower_seven_streak_odds
|
2015-11-12 04:38:57 +00:00
|
|
|
call Random
|
2017-12-28 18:38:15 +00:00
|
|
|
and %0011100
|
|
|
|
ret z ; 12.5% chance to stick with seven symbol bias
|
2018-01-11 03:53:42 +00:00
|
|
|
ld a, SLOTS_NO_BIAS
|
2015-12-11 03:26:31 +00:00
|
|
|
ld [wSlotBias], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LinedUpPokeballs:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_3RD_PLACE
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LinedUpMonOrCherry:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_PRESENT
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitSFX
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_AnimateGolem:
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Jumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .init
|
|
|
|
dw .fall
|
|
|
|
dw .roll
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.init
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr nz, .retain
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 2
|
|
|
|
ld [wSlotsDelay], a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.retain
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $30
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.fall
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $20
|
2015-12-11 03:26:31 +00:00
|
|
|
jr c, .play_sound
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ld e, a
|
2015-12-11 03:26:31 +00:00
|
|
|
ld d, 14 * 8
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall BattleAnim_Sine_e
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.play_sound
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $2
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 1
|
|
|
|
ld [wSlotsDelay], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, SFX_PLACE_PUZZLE_PIECE_DOWN
|
2015-12-11 03:26:31 +00:00
|
|
|
call Slots_PlaySFX
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.roll
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
2015-12-27 02:59:03 +00:00
|
|
|
inc [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
cp 9 * 8
|
|
|
|
jr nc, .restart
|
2015-11-12 04:38:57 +00:00
|
|
|
and $3
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
xor $ff
|
|
|
|
inc a
|
|
|
|
ld [hl], a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hSCY], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.restart
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hSCY], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_AnimateChansey:
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, .Jumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .walk
|
|
|
|
dw .one
|
|
|
|
dw .two
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.walk
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XCOORD
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
cp 13 * 8
|
|
|
|
jr z, .limit
|
2015-11-12 04:38:57 +00:00
|
|
|
and $f
|
|
|
|
ret nz
|
|
|
|
ld de, SFX_JUMP_OVER_LEDGE
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.limit
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, 1
|
|
|
|
ld [wSlotsDelay], a
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.one
|
2017-12-28 18:38:15 +00:00
|
|
|
ld a, [wSlotsDelay]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $2
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .retain
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $5
|
|
|
|
ret nz
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.retain
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $8
|
2018-06-24 14:09:41 +00:00
|
|
|
.two
|
2015-12-11 03:26:31 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 03:26:31 +00:00
|
|
|
jr z, .spawn_egg
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
.spawn_egg
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
|
|
|
dec [hl]
|
|
|
|
push bc
|
2015-11-18 18:01:55 +00:00
|
|
|
depixel 12, 13, 0, 4
|
2015-12-11 03:26:31 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_SLOTS_EGG
|
2015-11-13 15:48:49 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-11-12 04:38:57 +00:00
|
|
|
pop bc
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_WaitSFX:
|
2015-11-12 04:38:57 +00:00
|
|
|
push bc
|
|
|
|
ld c, 16
|
|
|
|
call DelayFrames
|
|
|
|
pop bc
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots_PlaySFX:
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
call PlaySFX
|
|
|
|
pop de
|
|
|
|
ret
|
2015-12-11 03:26:31 +00:00
|
|
|
|
|
|
|
; The first three positions are repeated to
|
|
|
|
; avoid needing to check indices when copying.
|
2018-06-24 14:09:41 +00:00
|
|
|
Reel1Tilemap:
|
2015-12-11 03:26:31 +00:00
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_CHERRY ; 1
|
|
|
|
db SLOTS_STARYU ; 2
|
|
|
|
db SLOTS_PIKACHU ; 3
|
|
|
|
db SLOTS_SQUIRTLE ; 4
|
|
|
|
db SLOTS_SEVEN ; 5
|
|
|
|
db SLOTS_CHERRY ; 6
|
|
|
|
db SLOTS_STARYU ; 7
|
|
|
|
db SLOTS_PIKACHU ; 8
|
|
|
|
db SLOTS_SQUIRTLE ; 9
|
|
|
|
db SLOTS_POKEBALL ; 10
|
|
|
|
db SLOTS_CHERRY ; 11
|
|
|
|
db SLOTS_STARYU ; 12
|
|
|
|
db SLOTS_PIKACHU ; 13
|
|
|
|
db SLOTS_SQUIRTLE ; 14
|
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_CHERRY ; 1
|
|
|
|
db SLOTS_STARYU ; 2
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Reel2Tilemap:
|
2015-12-11 03:26:31 +00:00
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_PIKACHU ; 1
|
|
|
|
db SLOTS_CHERRY ; 2
|
|
|
|
db SLOTS_SQUIRTLE ; 3
|
|
|
|
db SLOTS_STARYU ; 4
|
|
|
|
db SLOTS_POKEBALL ; 5
|
|
|
|
db SLOTS_PIKACHU ; 6
|
|
|
|
db SLOTS_CHERRY ; 7
|
|
|
|
db SLOTS_SQUIRTLE ; 8
|
|
|
|
db SLOTS_STARYU ; 9
|
|
|
|
db SLOTS_POKEBALL ; 10
|
|
|
|
db SLOTS_PIKACHU ; 11
|
|
|
|
db SLOTS_CHERRY ; 12
|
|
|
|
db SLOTS_SQUIRTLE ; 13
|
|
|
|
db SLOTS_STARYU ; 14
|
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_PIKACHU ; 1
|
|
|
|
db SLOTS_CHERRY ; 2
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Reel3Tilemap:
|
2015-12-11 03:26:31 +00:00
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_PIKACHU ; 1
|
|
|
|
db SLOTS_CHERRY ; 2
|
|
|
|
db SLOTS_SQUIRTLE ; 3
|
|
|
|
db SLOTS_STARYU ; 4
|
|
|
|
db SLOTS_PIKACHU ; 5
|
|
|
|
db SLOTS_CHERRY ; 6
|
|
|
|
db SLOTS_SQUIRTLE ; 7
|
|
|
|
db SLOTS_STARYU ; 8
|
|
|
|
db SLOTS_PIKACHU ; 9
|
|
|
|
db SLOTS_POKEBALL ; 10
|
|
|
|
db SLOTS_CHERRY ; 11
|
|
|
|
db SLOTS_SQUIRTLE ; 12
|
|
|
|
db SLOTS_STARYU ; 13
|
|
|
|
db SLOTS_PIKACHU ; 14
|
|
|
|
db SLOTS_SEVEN ; 0
|
|
|
|
db SLOTS_PIKACHU ; 1
|
|
|
|
db SLOTS_CHERRY ; 2
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SlotsTilemap:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/slots/slots.tilemap"
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots1LZ:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/slots/slots_1.2bpp.lz"
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots2LZ:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/slots/slots_2.2bpp.lz"
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Slots3LZ:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/slots/slots_3.2bpp.lz"
|