2016-06-12 00:24:04 +00:00
|
|
|
|
PromptUserToPlaySlots:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SaveScreenTilesToBuffer2
|
|
|
|
|
ld a, BANK(DisplayTextIDInit)
|
2014-09-13 07:50:56 +00:00
|
|
|
|
ld [wAutoTextBoxDrawingControl], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld b, a
|
|
|
|
|
ld hl, DisplayTextIDInit
|
|
|
|
|
call Bankswitch
|
|
|
|
|
ld hl, PlaySlotMachineText
|
|
|
|
|
call PrintText
|
|
|
|
|
call YesNoChoice
|
|
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
|
and a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .done ; if player chose No
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec a
|
2014-09-13 07:50:56 +00:00
|
|
|
|
ld [wUpdateSpritesEnabled], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wSlotMachineRerollCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld [hli], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [hl], SMILE_BUBBLE
|
2014-06-16 20:57:26 +00:00
|
|
|
|
predef EmotionBubble
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call GBPalWhiteOutWithDelay3
|
|
|
|
|
call LoadSlotMachineTiles
|
|
|
|
|
call LoadFontTilePatterns
|
2015-08-12 09:16:56 +00:00
|
|
|
|
ld b, SET_PAL_SLOTS
|
|
|
|
|
call RunPaletteCommand
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call GBPalNormal
|
|
|
|
|
ld a, $e4
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [rOBP0], a
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld hl, wd730
|
2014-05-22 22:13:20 +00:00
|
|
|
|
set 6, [hl]
|
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineAllowMatchesCounter], a
|
|
|
|
|
ld hl, wStoppingWhichSlotMachineWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld bc, $0014
|
|
|
|
|
call FillMemory
|
|
|
|
|
call MainSlotMachineLoop
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld hl, wd730
|
2014-05-22 22:13:20 +00:00
|
|
|
|
res 6, [hl]
|
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineAllowMatchesCounter], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call GBPalWhiteOutWithDelay3
|
|
|
|
|
ld a, $1
|
2014-09-13 07:50:56 +00:00
|
|
|
|
ld [wUpdateSpritesEnabled], a
|
2015-08-12 09:16:56 +00:00
|
|
|
|
call RunDefaultPaletteCommand
|
2014-09-10 03:55:19 +00:00
|
|
|
|
call ReloadMapSpriteTilePatterns
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call ReloadTilesetTilePatterns
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.done
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call LoadScreenTilesFromBuffer2
|
|
|
|
|
call Delay3
|
|
|
|
|
call GBPalNormal
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineSavedROMBank]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
push af
|
|
|
|
|
jp CloseTextDisplay
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
PlaySlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _PlaySlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
MainSlotMachineLoop:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PrintCreditCoins
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wPayoutCoins
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PrintPayoutCoins
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, BetHowManySlotMachineText
|
|
|
|
|
call PrintText
|
|
|
|
|
call SaveScreenTilesToBuffer1
|
|
|
|
|
.loop
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, A_BUTTON | B_BUTTON
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [wMenuWatchedKeys], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, 2
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [wMaxMenuItem], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, 12
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [wTopMenuItemY], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, 15
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [wTopMenuItemX], a
|
|
|
|
|
xor a
|
|
|
|
|
ld [wCurrentMenuItem], a
|
|
|
|
|
ld [wLastMenuItem], a
|
2015-07-13 07:32:03 +00:00
|
|
|
|
ld [wMenuWatchMovingOutOfBounds], a
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 14, 11
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld b, 5
|
|
|
|
|
ld c, 4
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call TextBoxBorder
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 16, 12
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld de, CoinMultiplierSlotMachineText
|
|
|
|
|
call PlaceString
|
|
|
|
|
call HandleMenuInput
|
2015-07-13 20:35:35 +00:00
|
|
|
|
and B_BUTTON
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jp nz, LoadScreenTilesFromBuffer1
|
|
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
|
ld b, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, 3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
sub b
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineBet], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, wPlayerCoins
|
|
|
|
|
ld c, a
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
|
|
|
|
jr nz, .skip1
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
cp c
|
|
|
|
|
jr nc, .skip1
|
|
|
|
|
ld hl, NotEnoughCoinsSlotMachineText
|
|
|
|
|
call PrintText
|
|
|
|
|
jr .loop
|
|
|
|
|
.skip1
|
|
|
|
|
call LoadScreenTilesFromBuffer1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_SubtractBetFromPlayerCoins
|
|
|
|
|
call SlotMachine_LightBalls
|
|
|
|
|
call SlotMachine_SetFlags
|
|
|
|
|
ld a, 4
|
|
|
|
|
ld hl, wSlotMachineWheel1SlipCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], a
|
|
|
|
|
call WaitForSoundToFinish
|
2015-07-19 08:46:12 +00:00
|
|
|
|
ld a, SFX_SLOTS_NEW_SPIN
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call PlaySound
|
|
|
|
|
ld hl, StartSlotMachineText
|
|
|
|
|
call PrintText
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_SpinWheels
|
|
|
|
|
call SlotMachine_CheckForMatches
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, wPlayerCoins
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
or [hl]
|
|
|
|
|
jr nz, .skip2
|
|
|
|
|
ld hl, OutOfCoinsSlotMachineText
|
|
|
|
|
call PrintText
|
2015-07-03 19:37:53 +00:00
|
|
|
|
ld c, 60
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jp DelayFrames
|
|
|
|
|
.skip2
|
|
|
|
|
ld hl, OneMoreGoSlotMachineText
|
|
|
|
|
call PrintText
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 14, 12
|
2015-08-05 21:20:29 +00:00
|
|
|
|
lb bc, 13, 15
|
2015-02-07 10:43:08 +00:00
|
|
|
|
xor a ; YES_NO_MENU
|
|
|
|
|
ld [wTwoOptionMenuID], a
|
2015-02-07 20:27:36 +00:00
|
|
|
|
ld a, TWO_OPTION_MENU
|
2015-02-07 10:43:08 +00:00
|
|
|
|
ld [wTextBoxID], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DisplayTextBoxID
|
|
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
|
and a
|
|
|
|
|
ret nz
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PutOutLitBalls
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jp MainSlotMachineLoop
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
CoinMultiplierSlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
db "×3"
|
|
|
|
|
next "×2"
|
|
|
|
|
next "×1@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
OutOfCoinsSlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _OutOfCoinsSlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
BetHowManySlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _BetHowManySlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
StartSlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _StartSlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
NotEnoughCoinsSlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _NotEnoughCoinsSlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
OneMoreGoSlotMachineText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _OneMoreGoSlotMachineText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_SetFlags:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wSlotMachineFlags
|
2014-05-22 22:13:20 +00:00
|
|
|
|
bit 7, [hl]
|
|
|
|
|
ret nz
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineAllowMatchesCounter]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .allowMatches
|
2014-05-24 18:40:38 +00:00
|
|
|
|
call Random
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .setAllowMatchesCounter ; 1/256 (~0.4%) chance
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld b, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineSevenAndBarModeChance]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
cp b
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr c, .allowSevenAndBarMatches
|
|
|
|
|
ld a, 210
|
2014-05-22 22:13:20 +00:00
|
|
|
|
cp b
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr c, .allowMatches ; 55/256 (~21.5%) chance
|
|
|
|
|
ld [hl], 0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.allowMatches
|
2014-05-22 22:13:20 +00:00
|
|
|
|
set 6, [hl]
|
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.setAllowMatchesCounter
|
|
|
|
|
ld a, 60
|
|
|
|
|
ld [wSlotMachineAllowMatchesCounter], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.allowSevenAndBarMatches
|
2014-05-22 22:13:20 +00:00
|
|
|
|
set 7, [hl]
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_SpinWheels:
|
2015-07-03 19:37:53 +00:00
|
|
|
|
ld c, 20
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.loop1
|
|
|
|
|
push bc
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_AnimWheel1
|
|
|
|
|
call SlotMachine_AnimWheel2
|
|
|
|
|
call SlotMachine_AnimWheel3
|
2015-07-03 19:37:53 +00:00
|
|
|
|
ld c, 2
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DelayFrames
|
|
|
|
|
pop bc
|
|
|
|
|
dec c
|
|
|
|
|
jr nz, .loop1
|
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wStoppingWhichSlotMachineWheel], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.loop2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_HandleInputWhileWheelsSpin
|
|
|
|
|
call SlotMachine_StopOrAnimWheel1
|
|
|
|
|
call SlotMachine_StopOrAnimWheel2
|
|
|
|
|
call SlotMachine_StopOrAnimWheel3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret c
|
2014-09-13 07:50:56 +00:00
|
|
|
|
ld a, [wOnSGB]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor $1
|
|
|
|
|
inc a
|
|
|
|
|
ld c, a
|
|
|
|
|
call DelayFrames
|
|
|
|
|
jr .loop2
|
|
|
|
|
|
2015-07-13 20:35:35 +00:00
|
|
|
|
; Note that the wheels can only stop when a symbol is centred in the wheel
|
|
|
|
|
; and thus 3 full symbols rather than 2 full symbols and 2 half symbols are
|
|
|
|
|
; visible. The 3 functions below ensure this by checking if the wheel offset
|
|
|
|
|
; is even before stopping the wheel.
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_StopOrAnimWheel1:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wStoppingWhichSlotMachineWheel]
|
|
|
|
|
cp 1
|
|
|
|
|
jr c, .animWheel
|
|
|
|
|
ld de, wSlotMachineWheel1Offset
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
rra
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nc, .animWheel ; check that a symbol is centred in the wheel
|
|
|
|
|
ld hl, wSlotMachineWheel1SlipCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
dec [hl]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_StopWheel1Early
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret nz
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.animWheel
|
|
|
|
|
jp SlotMachine_AnimWheel1
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_StopOrAnimWheel2:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wStoppingWhichSlotMachineWheel]
|
|
|
|
|
cp 2
|
|
|
|
|
jr c, .animWheel
|
|
|
|
|
ld de, wSlotMachineWheel2Offset
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
rra
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nc, .animWheel ; check that a symbol is centred in the wheel
|
|
|
|
|
ld hl, wSlotMachineWheel2SlipCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
dec [hl]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_StopWheel2Early
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.animWheel
|
|
|
|
|
jp SlotMachine_AnimWheel2
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_StopOrAnimWheel3:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wStoppingWhichSlotMachineWheel]
|
|
|
|
|
cp 3
|
|
|
|
|
jr c, .animWheel
|
|
|
|
|
ld de, wSlotMachineWheel3Offset
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
rra
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nc, .animWheel ; check that a symbol is centred in the wheel
|
|
|
|
|
; wheel 3 stops as soon as possible
|
2014-05-22 22:13:20 +00:00
|
|
|
|
scf
|
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.animWheel
|
|
|
|
|
call SlotMachine_AnimWheel3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_StopWheel1Early:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_GetWheel1Tiles
|
|
|
|
|
ld hl, wSlotMachineWheel1BottomTile
|
|
|
|
|
ld a, [wSlotMachineFlags]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and $80
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .sevenAndBarMode
|
|
|
|
|
; Stop early if the middle symbol is not a cherry.
|
2014-05-22 22:13:20 +00:00
|
|
|
|
inc hl
|
|
|
|
|
ld a, [hl]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp SLOTSCHERRY >> 8
|
|
|
|
|
jr nz, .stopWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
; It looks like this was intended to make the wheel stop when a 7 symbol was
|
|
|
|
|
; visible, but it has a bug and so the wheel stops randomly.
|
|
|
|
|
.sevenAndBarMode
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld c, $3
|
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp SLOTS7 >> 8
|
|
|
|
|
jr c, .stopWheel ; condition never true
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec c
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.stopWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
inc a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wSlotMachineWheel1SlipCounter
|
|
|
|
|
ld [hl], 0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_StopWheel2Early:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_GetWheel2Tiles
|
|
|
|
|
ld a, [wSlotMachineFlags]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and $80
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .sevenAndBarMode
|
|
|
|
|
; Stop early if any symbols are lined up in the first two wheels.
|
|
|
|
|
call SlotMachine_FindWheel1Wheel2Matches
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret nz
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr .stopWheel
|
|
|
|
|
; Stop early if two 7 symbols or two bar symbols are lined up in the first two
|
|
|
|
|
; wheels OR if no symbols are lined up and the bottom symbol in wheel 2 is a
|
|
|
|
|
; 7 symbol or bar symbol. The second part could be a bug or a way to reduce the
|
|
|
|
|
; player's odds.
|
|
|
|
|
.sevenAndBarMode
|
|
|
|
|
call SlotMachine_FindWheel1Wheel2Matches
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp (SLOTSBAR >> 8) + 1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret nc
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.stopWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineWheel2SlipCounter], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_FindWheel1Wheel2Matches:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
; return whether wheel 1 and wheel 2's current positions allow a match (given
|
|
|
|
|
; that wheel 3 stops in a good position) in Z
|
|
|
|
|
ld hl, wSlotMachineWheel1BottomTile
|
|
|
|
|
ld de, wSlotMachineWheel2BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp [hl] ; wheel 1 bottom, wheel 2 bottom
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
|
|
|
|
inc de
|
|
|
|
|
ld a, [de]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp [hl] ; wheel 1 bottom, wheel 2 middle
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
|
|
|
|
inc hl
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp [hl] ; wheel 1 middle, wheel 2 middle
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
|
|
|
|
inc hl
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp [hl] ; wheel 1 top, wheel 2 middle
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
|
|
|
|
inc de
|
|
|
|
|
ld a, [de]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp [hl] ; wheel 1 top, wheel 2 top
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
|
|
|
|
dec de
|
|
|
|
|
dec de
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_CheckForMatches:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_GetWheel3Tiles
|
|
|
|
|
ld a, [wSlotMachineBet]
|
|
|
|
|
cp 2
|
|
|
|
|
jr z, .checkMatchesFor2CoinBet
|
|
|
|
|
cp 1
|
|
|
|
|
jr z, .checkMatchFor1CoinBet
|
|
|
|
|
; 3 coin bet allows diagonal matches (plus the matches for 1/2 coin bets)
|
|
|
|
|
ld hl, wSlotMachineWheel1BottomTile
|
|
|
|
|
ld de, wSlotMachineWheel2MiddleTile
|
|
|
|
|
ld bc, wSlotMachineWheel3TopTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SlotMachine_CheckForMatch
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jp z, .foundMatch
|
|
|
|
|
ld hl, wSlotMachineWheel1TopTile
|
|
|
|
|
ld de, wSlotMachineWheel2MiddleTile
|
|
|
|
|
ld bc, wSlotMachineWheel3BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SlotMachine_CheckForMatch
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .foundMatch
|
|
|
|
|
; 2 coin bet allows top/bottom horizontal matches (plus the match for a 1 coin bet)
|
|
|
|
|
.checkMatchesFor2CoinBet
|
|
|
|
|
ld hl, wSlotMachineWheel1TopTile
|
|
|
|
|
ld de, wSlotMachineWheel2TopTile
|
|
|
|
|
ld bc, wSlotMachineWheel3TopTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SlotMachine_CheckForMatch
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .foundMatch
|
|
|
|
|
ld hl, wSlotMachineWheel1BottomTile
|
|
|
|
|
ld de, wSlotMachineWheel2BottomTile
|
|
|
|
|
ld bc, wSlotMachineWheel3BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SlotMachine_CheckForMatch
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .foundMatch
|
|
|
|
|
; 1 coin bet only allows a middle horizontal match
|
|
|
|
|
.checkMatchFor1CoinBet
|
|
|
|
|
ld hl, wSlotMachineWheel1MiddleTile
|
|
|
|
|
ld de, wSlotMachineWheel2MiddleTile
|
|
|
|
|
ld bc, wSlotMachineWheel3MiddleTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call SlotMachine_CheckForMatch
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .foundMatch
|
|
|
|
|
ld a, [wSlotMachineFlags]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and $c0
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .noMatch
|
|
|
|
|
ld hl, wSlotMachineRerollCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec [hl]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .rollWheel3DownByOneSymbol
|
|
|
|
|
.noMatch
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, NotThisTimeText
|
|
|
|
|
call PrintText
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.done
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor a
|
2015-08-09 05:32:44 +00:00
|
|
|
|
ld [wMuteAudioAndPauseMusic], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.rollWheel3DownByOneSymbol
|
|
|
|
|
call SlotMachine_AnimWheel3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DelayFrame
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_AnimWheel3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DelayFrame
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jp SlotMachine_CheckForMatches
|
|
|
|
|
.foundMatch
|
|
|
|
|
ld a, [wSlotMachineFlags]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and $c0
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win
|
2014-05-22 22:13:20 +00:00
|
|
|
|
and $80
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .acceptMatch
|
|
|
|
|
; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
cp (SLOTSBAR >> 8) + 1
|
|
|
|
|
jr c, .rollWheel3DownByOneSymbol
|
|
|
|
|
.acceptMatch
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
sub $2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineWinningSymbol], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, SlotRewardPointers
|
|
|
|
|
ld c, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld b, 0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld e, a
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld d, a
|
|
|
|
|
push de
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld de, wcf4b
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld bc, 4
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call CopyData
|
|
|
|
|
pop hl
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, .flashScreenLoop
|
2014-05-22 22:13:20 +00:00
|
|
|
|
push de
|
|
|
|
|
jp [hl]
|
|
|
|
|
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.flashScreenLoop
|
|
|
|
|
ld a, [rBGP]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor $40
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [rBGP], a
|
2015-07-03 19:37:53 +00:00
|
|
|
|
ld c, 5
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DelayFrames
|
|
|
|
|
dec b
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .flashScreenLoop
|
|
|
|
|
ld hl, wPayoutCoins
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hl], d
|
|
|
|
|
inc hl
|
|
|
|
|
ld [hl], e
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PrintPayoutCoins
|
|
|
|
|
ld hl, SymbolLinedUpSlotMachineText
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call PrintText
|
|
|
|
|
call WaitForTextScrollButtonPress
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PayCoinsToPlayer
|
|
|
|
|
call SlotMachine_PrintPayoutCoins
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $e4
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [rOBP0], a
|
|
|
|
|
jp .done
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SymbolLinedUpSlotMachineText:
|
2015-07-03 19:58:50 +00:00
|
|
|
|
TX_ASM
|
2014-05-22 22:13:20 +00:00
|
|
|
|
push bc
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PrintWinningSymbol
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, LinedUpText
|
|
|
|
|
pop bc
|
|
|
|
|
inc bc
|
|
|
|
|
inc bc
|
|
|
|
|
inc bc
|
|
|
|
|
inc bc
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
LinedUpText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _LinedUpText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotRewardPointers:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dw SlotReward300Func
|
|
|
|
|
dw SlotReward300Text
|
|
|
|
|
dw SlotReward100Func
|
|
|
|
|
dw SlotReward100Text
|
|
|
|
|
dw SlotReward8Func
|
|
|
|
|
dw SlotReward8Text
|
|
|
|
|
dw SlotReward15Func
|
|
|
|
|
dw SlotReward15Text
|
|
|
|
|
dw SlotReward15Func
|
|
|
|
|
dw SlotReward15Text
|
|
|
|
|
dw SlotReward15Func
|
|
|
|
|
dw SlotReward15Text
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward300Text:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
db "300@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward100Text:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
db "100@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward8Text:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
db "8@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward15Text:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
db "15@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
NotThisTimeText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _NotThisTimeText
|
|
|
|
|
db "@"
|
|
|
|
|
|
|
|
|
|
; compares the slot machine tiles at bc, de, and hl
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_CheckForMatch:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
cp [hl]
|
|
|
|
|
ret nz
|
|
|
|
|
ld a, [bc]
|
|
|
|
|
cp [hl]
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_GetWheel3Tiles:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel3BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, SlotMachineWheel3
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineWheel3Offset]
|
|
|
|
|
call SlotMachine_GetWheelTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_GetWheel2Tiles:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel2BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, SlotMachineWheel2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineWheel2Offset]
|
|
|
|
|
call SlotMachine_GetWheelTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_GetWheel1Tiles:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel1BottomTile
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, SlotMachineWheel1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineWheel1Offset]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_GetWheelTiles:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld c, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld b, 0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, bc
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld c, 3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld [de], a
|
|
|
|
|
inc de
|
|
|
|
|
inc hl
|
|
|
|
|
dec c
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward8Func:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wSlotMachineAllowMatchesCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .skip
|
|
|
|
|
dec [hl]
|
|
|
|
|
.skip
|
|
|
|
|
ld b, $2
|
|
|
|
|
ld de, 8
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward15Func:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wSlotMachineAllowMatchesCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .skip
|
|
|
|
|
dec [hl]
|
|
|
|
|
.skip
|
|
|
|
|
ld b, $4
|
|
|
|
|
ld de, 15
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward100Func:
|
2015-07-19 08:46:12 +00:00
|
|
|
|
ld a, SFX_GET_KEY_ITEM
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call PlaySound
|
|
|
|
|
xor a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineFlags], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld b, $8
|
|
|
|
|
ld de, 100
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotReward300Func:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, YeahText
|
|
|
|
|
call PrintText
|
2015-07-19 08:46:12 +00:00
|
|
|
|
ld a, SFX_GET_ITEM_2
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call PlaySound
|
2014-05-24 18:40:38 +00:00
|
|
|
|
call Random
|
2014-05-22 22:13:20 +00:00
|
|
|
|
cp $80
|
|
|
|
|
ld a, $0
|
|
|
|
|
jr c, .skip
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineFlags], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.skip
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wSlotMachineAllowMatchesCounter], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld b, $14
|
|
|
|
|
ld de, 300
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
YeahText:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
TX_FAR _YeahText
|
|
|
|
|
db $0a, "@"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_PrintWinningSymbol:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
; prints winning symbol and down arrow in text box
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 2, 14
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineWinningSymbol]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add $25
|
|
|
|
|
ld [hli], a
|
|
|
|
|
inc a
|
|
|
|
|
ld [hld], a
|
|
|
|
|
inc a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, -SCREEN_WIDTH
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, de
|
|
|
|
|
ld [hli], a
|
|
|
|
|
inc a
|
|
|
|
|
ld [hl], a
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 18, 16
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [hl], $ee ; down arrow
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_SubtractBetFromPlayerCoins:
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wTempCoins2 + 1
|
|
|
|
|
ld a, [wSlotMachineBet]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hld], a
|
|
|
|
|
xor a
|
|
|
|
|
ld [hli], a
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld de, wPlayerCoins + 1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld c, $2
|
2014-06-16 20:57:26 +00:00
|
|
|
|
predef SubBCDPredef
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_PrintCreditCoins:
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 5, 1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld de, wPlayerCoins
|
|
|
|
|
ld c, $2
|
|
|
|
|
jp PrintBCDNumber
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_PrintPayoutCoins:
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 11, 1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wPayoutCoins
|
2015-07-28 01:48:44 +00:00
|
|
|
|
lb bc, LEADING_ZEROES | 2, 4 ; 2 bytes, 4 digits
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jp PrintNumber
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_PayCoinsToPlayer:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $1
|
2015-08-09 05:32:44 +00:00
|
|
|
|
ld [wMuteAudioAndPauseMusic], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call WaitForSoundToFinish
|
2015-07-13 20:35:35 +00:00
|
|
|
|
|
|
|
|
|
; Put 1 in the temp coins variable. This value is added to the player's coins
|
|
|
|
|
; repeatedly so the player can watch the value go up 1 coin at a time.
|
|
|
|
|
ld hl, wTempCoins1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
inc a
|
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
|
|
|
|
|
ld a, 5
|
|
|
|
|
ld [wAnimCounter], a
|
|
|
|
|
|
|
|
|
|
; Subtract 1 from the payout amount and add 1 to the player's coins each
|
|
|
|
|
; iteration until the payout amount reaches 0.
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.loop
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wPayoutCoins + 1]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld l, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wPayoutCoins]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld h, a
|
|
|
|
|
or l
|
|
|
|
|
ret z
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, -1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, de
|
|
|
|
|
ld a, l
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wPayoutCoins + 1], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, h
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wPayoutCoins], a
|
|
|
|
|
ld hl, wTempCoins1 + 1
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld de, wPlayerCoins + 1
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld c, $2
|
2014-06-16 20:57:26 +00:00
|
|
|
|
predef AddBCDPredef
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_PrintCreditCoins
|
|
|
|
|
call SlotMachine_PrintPayoutCoins
|
2015-07-19 08:46:12 +00:00
|
|
|
|
ld a, SFX_SLOTS_REWARD
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call PlaySound
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wAnimCounter]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec a
|
|
|
|
|
jr nz, .skip1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [rOBP0]
|
|
|
|
|
xor $40 ; make the slot wheel symbols flash
|
|
|
|
|
ld [rOBP0], a
|
|
|
|
|
ld a, 5
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.skip1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld [wAnimCounter], a
|
|
|
|
|
ld a, [wSlotMachineWinningSymbol]
|
|
|
|
|
cp (SLOTSBAR >> 8) + 1
|
2015-07-03 19:37:53 +00:00
|
|
|
|
ld c, 8
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jr nc, .skip2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
srl c ; c = 4 (make the the coins transfer faster if the symbol was 7 or bar)
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.skip2
|
|
|
|
|
call DelayFrames
|
|
|
|
|
jr .loop
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_PutOutLitBalls:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $23
|
2015-07-24 21:39:45 +00:00
|
|
|
|
ld [wNewSlotMachineBallTile], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr SlotMachine_UpdateThreeCoinBallTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_LightBalls:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $14
|
2015-07-24 21:39:45 +00:00
|
|
|
|
ld [wNewSlotMachineBallTile], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld a, [wSlotMachineBet]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, SlotMachine_UpdateOneCoinBallTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
dec a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr z, SlotMachine_UpdateTwoCoinBallTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_UpdateThreeCoinBallTiles:
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 3, 2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_UpdateBallTiles
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 3, 10
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_UpdateBallTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_UpdateTwoCoinBallTiles:
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 3, 4
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_UpdateBallTiles
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 3, 8
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_UpdateBallTiles
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_UpdateOneCoinBallTiles:
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord hl, 3, 6
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_UpdateBallTiles:
|
2015-07-24 21:39:45 +00:00
|
|
|
|
ld a, [wNewSlotMachineBallTile]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld bc, 13
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, bc
|
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld bc, 7
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, bc
|
|
|
|
|
inc a
|
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld bc, 13
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add hl, bc
|
|
|
|
|
ld [hl], a
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_AnimWheel1:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld bc, SlotMachineWheel1
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel1Offset
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld hl, wOAMBuffer
|
|
|
|
|
ld a, $30
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld [wBaseCoordX], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr SlotMachine_AnimWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_AnimWheel2:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld bc, SlotMachineWheel2
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel2Offset
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld hl, wOAMBuffer + $30
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $50
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld [wBaseCoordX], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr SlotMachine_AnimWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_AnimWheel3:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld bc, SlotMachineWheel3
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel3Offset
|
2014-05-26 21:04:56 +00:00
|
|
|
|
ld hl, wOAMBuffer + $60
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $70
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld [wBaseCoordX], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_AnimWheel:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $58
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld [wBaseCoordY], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
push de
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld d, b
|
|
|
|
|
add c
|
|
|
|
|
ld e, a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nc, .loop
|
2014-05-22 22:13:20 +00:00
|
|
|
|
inc d
|
2015-07-13 20:35:35 +00:00
|
|
|
|
.loop
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld a, [wBaseCoordY]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hli], a
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld a, [wBaseCoordX]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, $80
|
|
|
|
|
ld [hli], a
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld a, [wBaseCoordY]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld [hli], a
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld a, [wBaseCoordX]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
add $8
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
inc a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, $80
|
|
|
|
|
ld [hli], a
|
|
|
|
|
inc de
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld a, [wBaseCoordY]
|
2014-05-22 22:13:20 +00:00
|
|
|
|
sub $8
|
2015-08-31 02:38:41 +00:00
|
|
|
|
ld [wBaseCoordY], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
cp $28
|
2015-07-13 20:35:35 +00:00
|
|
|
|
jr nz, .loop
|
2014-05-22 22:13:20 +00:00
|
|
|
|
pop de
|
|
|
|
|
ld a, [de]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
inc a ; advance the offset so that the wheel animates
|
|
|
|
|
cp 30
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jr nz, .skip
|
2015-07-13 20:35:35 +00:00
|
|
|
|
xor a ; wrap around to 0 when the offset reaches 30
|
2014-05-22 22:13:20 +00:00
|
|
|
|
.skip
|
|
|
|
|
ld [de], a
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachine_HandleInputWhileWheelsSpin:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DelayFrame
|
2014-05-25 18:21:48 +00:00
|
|
|
|
call JoypadLowSensitivity
|
2014-08-31 02:48:49 +00:00
|
|
|
|
ld a, [hJoy5]
|
2015-07-13 20:35:35 +00:00
|
|
|
|
and A_BUTTON
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ret z
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld hl, wStoppingWhichSlotMachineWheel
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, [hl]
|
|
|
|
|
dec a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel1SlipCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jr z, .skip
|
|
|
|
|
dec a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
ld de, wSlotMachineWheel2SlipCounter
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jr z, .skip
|
|
|
|
|
.loop
|
|
|
|
|
inc [hl]
|
2015-07-19 08:46:12 +00:00
|
|
|
|
ld a, SFX_SLOTS_STOP_WHEEL
|
2014-05-22 22:13:20 +00:00
|
|
|
|
jp PlaySound
|
|
|
|
|
.skip
|
|
|
|
|
ld a, [de]
|
|
|
|
|
and a
|
|
|
|
|
ret nz
|
|
|
|
|
jr .loop
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
LoadSlotMachineTiles:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call DisableLCD
|
|
|
|
|
ld hl, SlotMachineTiles2
|
2014-05-29 08:31:46 +00:00
|
|
|
|
ld de, vChars0
|
|
|
|
|
ld bc, $1c0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, BANK(SlotMachineTiles2)
|
|
|
|
|
call FarCopyData2
|
|
|
|
|
ld hl, SlotMachineTiles1
|
2014-05-29 08:31:46 +00:00
|
|
|
|
ld de, vChars2
|
|
|
|
|
ld bc, $250
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, BANK(SlotMachineTiles1)
|
|
|
|
|
call FarCopyData2
|
|
|
|
|
ld hl, SlotMachineTiles2
|
2014-05-29 08:31:46 +00:00
|
|
|
|
ld de, vChars2 + $250
|
|
|
|
|
ld bc, $1c0
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, BANK(SlotMachineTiles2)
|
|
|
|
|
call FarCopyData2
|
|
|
|
|
ld hl, SlotMachineMap
|
2015-07-18 20:52:03 +00:00
|
|
|
|
coord de, 0, 0
|
2016-06-12 04:30:05 +00:00
|
|
|
|
ld bc, SlotMachineMapEnd - SlotMachineMap
|
2014-05-22 22:13:20 +00:00
|
|
|
|
call CopyData
|
|
|
|
|
call EnableLCD
|
2015-07-19 03:49:52 +00:00
|
|
|
|
ld hl, wSlotMachineWheel1Offset
|
2014-05-22 22:13:20 +00:00
|
|
|
|
ld a, $1c
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], a
|
2015-07-13 20:35:35 +00:00
|
|
|
|
call SlotMachine_AnimWheel1
|
|
|
|
|
call SlotMachine_AnimWheel2
|
|
|
|
|
jp SlotMachine_AnimWheel3
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachineMap:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
INCBIN "gfx/tilemaps/slotmachine.map"
|
2016-06-12 04:30:05 +00:00
|
|
|
|
SlotMachineMapEnd:
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
|
|
INCLUDE "data/slot_machine_wheels.asm"
|
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
|
SlotMachineTiles1:
|
2014-10-17 08:42:32 +00:00
|
|
|
|
IF DEF(_RED)
|
2014-05-22 22:13:20 +00:00
|
|
|
|
INCBIN "gfx/red/slotmachine1.2bpp"
|
|
|
|
|
ENDC
|
2014-10-17 08:42:32 +00:00
|
|
|
|
IF DEF(_BLUE)
|
2014-05-22 22:13:20 +00:00
|
|
|
|
INCBIN "gfx/blue/slotmachine1.2bpp"
|
|
|
|
|
ENDC
|