From 64479cd64205d611a66698f447aa42c16c334b2d Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 24 May 2014 11:40:38 -0700 Subject: Rename random number function and hram labels. GenRandom -> Random GenRandomInBattle -> BattleRandom H_RAND1 -> hRandomAdd H_RAND2 -> hRandomSub --- engine/slot_machine.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index a3c83e64..6c106239 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -179,7 +179,7 @@ SlotMachine_37480: ; 37480 (d:7480) ld a, [W_SUBANIMSUBENTRYADDR] and a jr nz, .skip1 - call GenRandom + call Random and a jr z, .skip2 ld b, a @@ -578,7 +578,7 @@ SlotReward300Func: ; 37702 (d:7702) call PrintText ld a, (SFX_1f_3b - SFX_Headers_1f) / 3 call PlaySound - call GenRandom + call Random cp $80 ld a, $0 jr c, .skip -- cgit v1.2.3 From bba84059925c25e04fdcef5e4f3e2192176faf2d Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 11:21:48 -0700 Subject: Rename GetJoypadState -> Joypad. --- engine/slot_machine.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 6c106239..1d320207 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -799,7 +799,7 @@ SlotMachine_3784e: ; 3784e (d:784e) SlotMachine_37882: ; 37882 (d:7882) call DelayFrame - call GetJoypadStateLowSensitivity + call JoypadLowSensitivity ld a, [$ffb5] and $1 ret z -- cgit v1.2.3 From 4be11293e5c7d6bf4a2fc374974545a21a5e3572 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 17:27:02 -0700 Subject: Label BCD math predefs. --- engine/slot_machine.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 1d320207..99ee942b 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -618,7 +618,7 @@ SlotMachine_37741: ; 37741 (d:7741) ld [hli], a ld de, $d5a5 ld c, $2 - ld a, $c + ld a, $c ; SubtractBCDPredef call Predef SlotMachine_37754: ; 37754 (d:7754) @@ -660,7 +660,7 @@ SlotMachine_3776b: ; 3776b (d:776b) ld hl, $cd47 ld de, $d5a5 ld c, $2 - ld a, $b + ld a, $b ; AddBCDPredef call Predef call SlotMachine_37754 call SlotMachine_3775f -- cgit v1.2.3 From 40c17c906b2b3f65b3b04b1933b90238a7ac5566 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 26 May 2014 14:04:56 -0700 Subject: Remove most static wram addresses. Use labels instead. For unknown addresses, use "w
". Label overleads are still an issue. --- engine/slot_machine.asm | 158 ++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 79 deletions(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 99ee942b..ec94dd28 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -1,7 +1,7 @@ PromptUserToPlaySlots: ; 3730e (d:730e) call SaveScreenTilesToBuffer2 ld a, BANK(DisplayTextIDInit) - ld [$cf0c], a + ld [wcf0c], a ld b, a ld hl, DisplayTextIDInit call Bankswitch @@ -12,8 +12,8 @@ PromptUserToPlaySlots: ; 3730e (d:730e) and a jr nz, .skip dec a - ld [$cfcb], a - ld hl, $cd4f + ld [wcfcb], a + ld hl, wcd4f xor a ld [hli], a ld [hl], $2 @@ -27,7 +27,7 @@ PromptUserToPlaySlots: ; 3730e (d:730e) call GBPalNormal ld a, $e4 ld [$ff48], a - ld hl, $d730 + ld hl, wd730 set 6, [hl] xor a ld [W_SUBANIMSUBENTRYADDR], a @@ -35,13 +35,13 @@ PromptUserToPlaySlots: ; 3730e (d:730e) ld bc, $0014 call FillMemory call MainSlotMachineLoop - ld hl, $d730 + ld hl, wd730 res 6, [hl] xor a ld [W_SUBANIMSUBENTRYADDR], a call GBPalWhiteOutWithDelay3 ld a, $1 - ld [$cfcb], a + ld [wcfcb], a call GoPAL_SET_CF1C call Func_3e08 call ReloadTilesetTilePatterns @@ -49,7 +49,7 @@ PromptUserToPlaySlots: ; 3730e (d:730e) call LoadScreenTilesFromBuffer2 call Delay3 call GBPalNormal - ld a, [$cc5e] + ld a, [wcc5e] push af jp CloseTextDisplay @@ -60,7 +60,7 @@ PlaySlotMachineText: ; 37390 (d:7390) MainSlotMachineLoop: ; 37395 (d:7395) call SlotMachine_37754 xor a - ld hl, $cd4a + ld hl, wcd4a ld [hli], a ld [hl], a call SlotMachine_3775f @@ -79,12 +79,12 @@ MainSlotMachineLoop: ; 37395 (d:7395) xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld [$cc37], a - ld hl, $c48a + ld [wcc37], a + ld hl, wTileMap + $ea ld b, $5 ld c, $4 call TextBoxBorder - ld hl, $c4a0 + ld hl, wTileMap + $100 ld de, CoinMultiplierSlotMachineText call PlaceString call HandleMenuInput @@ -94,7 +94,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) ld b, a ld a, $3 sub b - ld [$cd50], a + ld [wcd50], a ld hl, wPlayerCoins ld c, a ld a, [hli] @@ -112,7 +112,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) call SlotMachine_377d5 call SlotMachine_37480 ld a, $4 - ld hl, $cd4d + ld hl, wcd4d ld [hli], a ld [hli], a ld [hl], a @@ -134,12 +134,12 @@ MainSlotMachineLoop: ; 37395 (d:7395) .skip2 ld hl, OneMoreGoSlotMachineText call PrintText - ld hl, $c49e + ld hl, wTileMap + $fe ld bc, $0d0f xor a - ld [$d12c], a + ld [wd12c], a ld a, $14 - ld [$d125], a + ld [wd125], a call DisplayTextBoxID ld a, [wCurrentMenuItem] and a @@ -173,7 +173,7 @@ OneMoreGoSlotMachineText: ; 3747b (d:747b) db "@" SlotMachine_37480: ; 37480 (d:7480) - ld hl, $cd4c + ld hl, wcd4c bit 7, [hl] ret nz ld a, [W_SUBANIMSUBENTRYADDR] @@ -183,7 +183,7 @@ SlotMachine_37480: ; 37480 (d:7480) and a jr z, .skip2 ld b, a - ld a, [$cc5b] + ld a, [wcc5b] cp b jr c, .skip3 ld a, $d2 @@ -222,7 +222,7 @@ SlotMachine_374ad: ; 374ad (d:74ad) call SlotMachine_374fb call SlotMachine_37517 ret c - ld a, [$cf1b] + ld a, [wcf1b] xor $1 inc a ld c, a @@ -237,7 +237,7 @@ SlotMachine_374df: ; 374df (d:74df) ld a, [de] rra jr nc, .skip - ld hl, $cd4d + ld hl, wcd4d ld a, [hl] and a ret z @@ -255,7 +255,7 @@ SlotMachine_374fb: ; 374fb (d:74fb) ld a, [de] rra jr nc, .skip - ld hl, $cd4e + ld hl, wcd4e ld a, [hl] and a ret z @@ -283,7 +283,7 @@ SlotMachine_37517: ; 37517 (d:7517) SlotMachine_3752c: ; 3752c (d:752c) call SlotMachine_GetWheelOneTile ld hl, wTrainerScreenX - ld a, [$cd4c] + ld a, [wcd4c] and $80 jr nz, .skip1 inc hl @@ -302,13 +302,13 @@ SlotMachine_3752c: ; 3752c (d:752c) ret .skip2 inc a - ld hl, $cd4d + ld hl, wcd4d ld [hl], $0 ret SlotMachine_37552: ; 37552 (d:7552) call SlotMachine_GetWheelTwoTile - ld a, [$cd4c] + ld a, [wcd4c] and $80 jr nz, .skip1 call SlotMachine_3756e @@ -321,12 +321,12 @@ SlotMachine_37552: ; 37552 (d:7552) ret nc .skip2 xor a - ld [$cd4e], a + ld [wcd4e], a ret SlotMachine_3756e: ; 3756e (d:756e) ld hl, wTrainerScreenX - ld de, $cd44 + ld de, wcd44 ld a, [de] cp [hl] ret z @@ -350,42 +350,42 @@ SlotMachine_3756e: ; 3756e (d:756e) SlotMachine_37588: ; 37588 (d:7588) call SlotMachine_GetWheelThreeTile - ld a, [$cd50] + ld a, [wcd50] cp $2 jr z, .skip1 cp $1 jr z, .skip2 ld hl, wTrainerScreenX - ld de, $cd45 - ld bc, $cd49 + ld de, wcd45 + ld bc, wcd49 call SlotMachine_CheckForMatch jp z, .skip5 - ld hl, $cd43 - ld de, $cd45 - ld bc, $cd47 + ld hl, wcd43 + ld de, wcd45 + ld bc, wcd47 call SlotMachine_CheckForMatch jr z, .skip5 .skip1 - ld hl, $cd43 - ld de, $cd46 - ld bc, $cd49 + ld hl, wcd43 + ld de, wcd46 + ld bc, wcd49 call SlotMachine_CheckForMatch jr z, .skip5 ld hl, wTrainerScreenX - ld de, $cd44 - ld bc, $cd47 + ld de, wcd44 + ld bc, wcd47 call SlotMachine_CheckForMatch jr z, .skip5 .skip2 - ld hl, $cd42 - ld de, $cd45 - ld bc, $cd48 + ld hl, wcd42 + ld de, wcd45 + ld bc, wcd48 call SlotMachine_CheckForMatch jr z, .skip5 - ld a, [$cd4c] + ld a, [wcd4c] and $c0 jr z, .skip3 - ld hl, $cd4f + ld hl, wcd4f dec [hl] jr nz, .skip4 .skip3 @@ -393,7 +393,7 @@ SlotMachine_37588: ; 37588 (d:7588) call PrintText .loop xor a - ld [$c002], a + ld [wc002], a ret .skip4 call SlotMachine_37833 @@ -402,7 +402,7 @@ SlotMachine_37588: ; 37588 (d:7588) call DelayFrame jp SlotMachine_37588 .skip5 - ld a, [$cd4c] + ld a, [wcd4c] and $c0 jr z, .skip4 and $80 @@ -426,7 +426,7 @@ SlotMachine_37588: ; 37588 (d:7588) ld a, [hli] ld h, [hl] ld l, a - ld de, $cf4b + ld de, wcf4b ld bc, $0004 call CopyData pop hl @@ -442,7 +442,7 @@ SlotMachine_37588: ; 37588 (d:7588) call DelayFrames dec b jr nz, .asm_37638 - ld hl, $cd4a + ld hl, wcd4a ld [hl], d inc hl ld [hl], e @@ -512,13 +512,13 @@ SlotMachine_CheckForMatch: ; 376a2 (d:76a2) ret SlotMachine_GetWheelThreeTile: ; 376a8 (d:76a8) - ld de, $cd47 + ld de, wcd47 ld hl, SlotMachineWheel3 ld a, [wTrainerScreenY] call SlotMachine_GetWheelTile SlotMachine_GetWheelTwoTile: ; 376b4 (d:76b4) - ld de, $cd44 + ld de, wcd44 ld hl, SlotMachineWheel2 ld a, [wTrainerFacingDirection] call SlotMachine_GetWheelTile @@ -568,7 +568,7 @@ SlotReward100Func: ; 376f3 (d:76f3) ld a, (SFX_1f_42 - SFX_Headers_1f) / 3 call PlaySound xor a - ld [$cd4c], a + ld [wcd4c], a ld b, $8 ld de, 100 ret @@ -582,7 +582,7 @@ SlotReward300Func: ; 37702 (d:7702) cp $80 ld a, $0 jr c, .skip - ld [$cd4c], a + ld [wcd4c], a .skip ld [W_SUBANIMSUBENTRYADDR], a ld b, $14 @@ -594,7 +594,7 @@ YeahText: ; 37722 (d:7722) db $0a, "@" SlotMachine_37728: ; 37728 (d:7728) - ld hl, $c4ba + ld hl, wTileMap + $11a ld a, [wTrainerScreenX] add $25 ld [hli], a @@ -606,38 +606,38 @@ SlotMachine_37728: ; 37728 (d:7728) ld [hli], a inc a ld [hl], a - ld hl, $c4f2 + ld hl, wTileMap + $152 ld [hl], $ee ret SlotMachine_37741: ; 37741 (d:7741) - ld hl, $cd4b - ld a, [$cd50] + ld hl, wcd4b + ld a, [wcd50] ld [hld], a xor a ld [hli], a - ld de, $d5a5 + ld de, wPlayerCoins + 1 ld c, $2 ld a, $c ; SubtractBCDPredef call Predef SlotMachine_37754: ; 37754 (d:7754) - ld hl, $c3b9 + ld hl, wTileMap + $19 ld de, wPlayerCoins ld c, $2 jp PrintBCDNumber SlotMachine_3775f: ; 3775f (d:775f) - ld hl, $c3bf - ld de, $cd4a + ld hl, wTileMap + $1f + ld de, wcd4a ld bc, $8204 jp PrintNumber SlotMachine_3776b: ; 3776b (d:776b) ld a, $1 - ld [$c002], a + ld [wc002], a call WaitForSoundToFinish - ld hl, $cd46 + ld hl, wcd46 xor a ld [hli], a inc a @@ -645,20 +645,20 @@ SlotMachine_3776b: ; 3776b (d:776b) ld a, $5 ld [W_SUBANIMTRANSFORM], a .loop - ld a, [$cd4b] + ld a, [wcd4b] ld l, a - ld a, [$cd4a] + ld a, [wcd4a] ld h, a or l ret z ld de, $ffff add hl, de ld a, l - ld [$cd4b], a + ld [wcd4b], a ld a, h - ld [$cd4a], a - ld hl, $cd47 - ld de, $d5a5 + ld [wcd4a], a + ld hl, wcd47 + ld de, wPlayerCoins + 1 ld c, $2 ld a, $b ; AddBCDPredef call Predef @@ -686,35 +686,35 @@ SlotMachine_3776b: ; 3776b (d:776b) SlotMachine_377ce: ; 377ce (d:77ce) ld a, $23 - ld [$d08a], a + ld [wd08a], a jr SlotMachine_377e3 SlotMachine_377d5: ; 377d5 (d:77d5) ld a, $14 - ld [$d08a], a - ld a, [$cd50] + ld [wd08a], a + ld a, [wcd50] dec a jr z, SlotMachine_377fb dec a jr z, SlotMachine_377ef SlotMachine_377e3: ; 377e3 (d:77e3) - ld hl, $c3cb + ld hl, wTileMap + $2b call SlotMachine_377fe - ld hl, $c46b + ld hl, wTileMap + $cb call SlotMachine_377fe SlotMachine_377ef: ; 377ef (d:77ef) - ld hl, $c3f3 + ld hl, wTileMap + $53 call SlotMachine_377fe - ld hl, $c443 + ld hl, wTileMap + $a3 call SlotMachine_377fe SlotMachine_377fb: ; 377fb (d:77fb) - ld hl, $c41b + ld hl, wTileMap + $7b SlotMachine_377fe: ; 377fe (d:77fe) - ld a, [$d08a] + ld a, [wd08a] ld [hl], a ld bc, $000d add hl, bc @@ -739,7 +739,7 @@ SlotMachine_37813: ; 37813 (d:7813) SlotMachine_37823: ; 37823 (d:7823) ld bc, SlotMachineWheel2 ld de, wTrainerFacingDirection - ld hl, $c330 + ld hl, wOAMBuffer + $30 ld a, $50 ld [W_BASECOORDX], a jr SlotMachine_37841 @@ -747,7 +747,7 @@ SlotMachine_37823: ; 37823 (d:7823) SlotMachine_37833: ; 37833 (d:7833) ld bc, SlotMachineWheel3 ld de, wTrainerScreenY - ld hl, $c360 + ld hl, wOAMBuffer + $60 ld a, $70 ld [W_BASECOORDX], a @@ -806,10 +806,10 @@ SlotMachine_37882: ; 37882 (d:7882) ld hl, wTrainerSpriteOffset ld a, [hl] dec a - ld de, $cd4d + ld de, wcd4d jr z, .skip dec a - ld de, $cd4e + ld de, wcd4e jr z, .skip .loop inc [hl] -- cgit v1.2.3 From da0a72cdbf45fa624b2d1151afe94a98d7da2ae0 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 29 May 2014 01:31:46 -0700 Subject: Use VRAM constants where applicable. --- engine/slot_machine.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index ec94dd28..68a15a18 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -824,18 +824,18 @@ SlotMachine_37882: ; 37882 (d:7882) LoadSlotMachineTiles: ; 378a8 (d:78a8) call DisableLCD ld hl, SlotMachineTiles2 - ld de, $8000 - ld bc, $01c0 + ld de, vChars0 + ld bc, $1c0 ld a, BANK(SlotMachineTiles2) call FarCopyData2 ld hl, SlotMachineTiles1 - ld de, $9000 - ld bc, $0250 + ld de, vChars2 + ld bc, $250 ld a, BANK(SlotMachineTiles1) call FarCopyData2 ld hl, SlotMachineTiles2 - ld de, $9250 - ld bc, $01c0 + ld de, vChars2 + $250 + ld bc, $1c0 ld a, BANK(SlotMachineTiles2) call FarCopyData2 ld hl, SlotMachineMap -- cgit v1.2.3 From 35f2bb90d4a8f8e4dcac3fbab7d89cbc590285e8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:03:05 -0700 Subject: Rename predef functions so they aren't excessive in length. This is mostly because of an rgbasm bug that prevents macro arguments from exceeding 16 characters, but the names were bad anyway. --- engine/slot_machine.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 68a15a18..0e17d13f 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -618,7 +618,7 @@ SlotMachine_37741: ; 37741 (d:7741) ld [hli], a ld de, wPlayerCoins + 1 ld c, $2 - ld a, $c ; SubtractBCDPredef + ld a, $c ; SubBCDPredef call Predef SlotMachine_37754: ; 37754 (d:7754) -- cgit v1.2.3 From b36f793667924f868282ce979fabab3e95d642a5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:57:26 -0700 Subject: Use macros for predef calls/jumps instead of static ids. --- engine/slot_machine.asm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'engine/slot_machine.asm') diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 0e17d13f..e43cc9ab 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -17,8 +17,7 @@ PromptUserToPlaySlots: ; 3730e (d:730e) xor a ld [hli], a ld [hl], $2 - ld a, $4c - call Predef + predef EmotionBubble call GBPalWhiteOutWithDelay3 call LoadSlotMachineTiles call LoadFontTilePatterns @@ -618,8 +617,7 @@ SlotMachine_37741: ; 37741 (d:7741) ld [hli], a ld de, wPlayerCoins + 1 ld c, $2 - ld a, $c ; SubBCDPredef - call Predef + predef SubBCDPredef SlotMachine_37754: ; 37754 (d:7754) ld hl, wTileMap + $19 @@ -660,8 +658,7 @@ SlotMachine_3776b: ; 3776b (d:776b) ld hl, wcd47 ld de, wPlayerCoins + 1 ld c, $2 - ld a, $b ; AddBCDPredef - call Predef + predef AddBCDPredef call SlotMachine_37754 call SlotMachine_3775f ld a, (SFX_1f_65 - SFX_Headers_1f) / 3 -- cgit v1.2.3