From 4a8c9993ad182296131ef87111e1b6d6e2af4201 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jul 2015 23:00:48 -0700 Subject: named wram variables --- scripts/ceruleanhouse2.asm | 2 +- scripts/daycarem.asm | 6 +++--- scripts/oakslab.asm | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/ceruleanhouse2.asm b/scripts/ceruleanhouse2.asm index 423c0209..2d012d70 100755 --- a/scripts/ceruleanhouse2.asm +++ b/scripts/ceruleanhouse2.asm @@ -26,7 +26,7 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15) ld a, h ld [wList + 1], a xor a - ld [wcf93], a + ld [wPrintItemPrices], a ld [wMenuItemToSwap], a ld a, SPECIALLISTMENU ld [wListMenuID], a diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 3fa2d3b9..83b9b3a7 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -49,7 +49,7 @@ DayCareMText1: ; 56254 (15:6254) ld [W_DAYCARE_IN_USE], a ld a, $3 ld [wcf95], a - call Func_3a68 + call MoveMon xor a ld [wcf95], a call RemovePokemon @@ -158,14 +158,14 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) predef SubBCDPredef ld a, (SFX_02_5a - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent - ld a, $13 + ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID ld hl, DayCareMText_5644f call PrintText ld a, $2 ld [wcf95], a - call Func_3a68 + call MoveMon ld a, [wDayCareMonSpecies] ld [wcf91], a ld a, [wPartyCount] diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 7c99d802..1c255103 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -641,7 +641,7 @@ OaksLabScript_1d00a: ; 1d00a (7:500a) ld a, c ld [wWhichPokemon], a ld a, $1 - ld [wcf96], a + ld [wItemQuantity], a jp RemoveItemFromInventory OaksLabScript_1d02b: ; 1d02b (7:502b) -- cgit v1.3.1-sl0p From bcfca2e267a6ee023271d90e27e4a7fde06f66fc Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jul 2015 23:36:56 -0700 Subject: movemon and removepokemon wram variables --- constants/misc_constants.asm | 6 +++++ engine/cable_club.asm | 2 +- engine/in_game_trades.asm | 2 +- engine/menu/bills_pc.asm | 16 ++++++------ home.asm | 4 +-- main.asm | 58 ++++++++++++++++++++++---------------------- scripts/daycarem.asm | 18 +++++++------- wram.asm | 11 ++++++++- 8 files changed, 66 insertions(+), 51 deletions(-) (limited to 'scripts') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index a96fc59f..8aac849e 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -66,6 +66,12 @@ CANCELLED_MENU EQU 2 ; pressed B CHOSE_FIRST_ITEM EQU 1 CHOSE_SECOND_ITEM EQU 2 +; move mon constants +BOX_TO_PARTY EQU 0 +PARTY_TO_BOX EQU 1 +DAYCARE_TO_PARTY EQU 2 +PARTY_TO_DAYCARE EQU 3 + ; serial ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 diff --git a/engine/cable_club.asm b/engine/cable_club.asm index be403fa6..c115ed4a 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -793,7 +793,7 @@ TradeCenter_Trade: ld a, [hl] ld [wTradedPlayerMonSpecies], a xor a - ld [wcf95], a + ld [wRemoveMonFromBox], a call RemovePokemon ld a, [wTradingWhichEnemyMon] ld c, a diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index 32b55002..3594a26e 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -131,7 +131,7 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07) ld [wcf91],a xor a ld [wcc49],a - ld [wcf95],a + ld [wRemoveMonFromBox],a call RemovePokemon ld a,$80 ld [wcc49],a diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index b4ac3680..530ab961 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -229,11 +229,11 @@ BillsPCDeposit: ld a, [wcf91] call GetCryData call PlaySoundWaitForCurrent - ld a, $1 - ld [wcf95], a + ld a, PARTY_TO_BOX + ld [wMoveMonType], a call MoveMon xor a - ld [wcf95], a + ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish ld hl, wWhichTrade @@ -281,11 +281,11 @@ Func_21618: ; 21618 (8:5618) ld a, [wcf91] call GetCryData call PlaySoundWaitForCurrent - xor a - ld [wcf95], a + xor a ; BOX_TO_PARTY + ld [wMoveMonType], a call MoveMon - ld a, $1 - ld [wcf95], a + ld a, 1 + ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish ld hl, MonIsTakenOutText @@ -310,7 +310,7 @@ Func_21673: ; 21673 (8:5673) and a jr nz, .asm_21682 inc a - ld [wcf95], a + ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish ld a, [wcf91] diff --git a/home.asm b/home.asm index b9041fef..51e10118 100644 --- a/home.asm +++ b/home.asm @@ -3599,8 +3599,8 @@ CopyDataUntil:: ; 3913 (0:3913) ; Function to remove a pokemon from the party or the current box. ; wWhichPokemon determines the pokemon. -; [wcf95] == 0 specifies the party. -; [wcf95] != 0 specifies the current box. +; [wRemoveMonFromBox] == 0 specifies the party. +; [wRemoveMonFromBox] != 0 specifies the current box. RemovePokemon:: ; 391f (0:391f) ld hl, _RemovePokemon ld b, BANK(_RemovePokemon) diff --git a/main.asm b/main.asm index 3a79bdd6..54440e60 100755 --- a/main.asm +++ b/main.asm @@ -1916,7 +1916,7 @@ INCLUDE "engine/menu/players_pc.asm" _RemovePokemon: ; 7b68 (1:7b68) ld hl, wPartyCount - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7b74 ld hl, W_NUMINBOX @@ -1939,7 +1939,7 @@ _RemovePokemon: ; 7b68 (1:7b68) jr nz, .asm_7b81 ld hl, wPartyMonOT ld d, $5 - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7b97 ld hl, wBoxMonOT @@ -1958,7 +1958,7 @@ _RemovePokemon: ; 7b68 (1:7b68) ld bc, $b add hl, bc ld bc, wPartyMonNicks - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7bb8 ld bc, wBoxMonNicks @@ -1966,7 +1966,7 @@ _RemovePokemon: ; 7b68 (1:7b68) call CopyDataUntil ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7bcd ld hl, wBoxMons @@ -1976,7 +1976,7 @@ _RemovePokemon: ; 7b68 (1:7b68) call AddNTimes ld d, h ld e, l - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7be4 ld bc, wBoxMon2 - wBoxMon1 @@ -1990,7 +1990,7 @@ _RemovePokemon: ; 7b68 (1:7b68) .asm_7beb call CopyDataUntil ld hl, wPartyMonNicks - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7bfa ld hl, wBoxMonNicks @@ -2003,7 +2003,7 @@ _RemovePokemon: ; 7b68 (1:7b68) ld bc, $b add hl, bc ld bc, wPokedexOwned - ld a, [wcf95] + ld a, [wRemoveMonFromBox] and a jr z, .asm_7c15 ld bc, wBoxMonNicksEnd @@ -3867,12 +3867,12 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) ret ; return success _MoveMon: ; f51e (3:751e) - ld a, [wcf95] + ld a, [wMoveMonType] and a jr z, .checkPartyMonSlots - cp $2 + cp DAYCARE_TO_PARTY jr z, .checkPartyMonSlots - cp $3 + cp PARTY_TO_DAYCARE ld hl, wDayCareMon jr z, .asm_f575 ld hl, W_NUMINBOX @@ -3892,17 +3892,17 @@ _MoveMon: ; f51e (3:751e) inc a ld [hl], a ; increment number of mons in party/box ld c, a - ld b, $0 + ld b, 0 add hl, bc - ld a, [wcf95] - cp $2 + ld a, [wMoveMonType] + cp DAYCARE_TO_PARTY ld a, [wDayCareMon] jr z, .asm_f556 ld a, [wcf91] .asm_f556 ld [hli], a ; write new mon ID ld [hl], $ff ; write new sentinel - ld a, [wcf95] + ld a, [wMoveMonType] dec a ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 ; $2c @@ -3918,12 +3918,12 @@ _MoveMon: ; f51e (3:751e) push hl ld e, l ld d, h - ld a, [wcf95] + ld a, [wMoveMonType] and a ld hl, wBoxMons ld bc, wBoxMon2 - wBoxMon1 ; $21 jr z, .asm_f591 - cp $2 + cp DAYCARE_TO_PARTY ld hl, wDayCareMon jr z, .asm_f597 ld hl, wPartyMons @@ -3938,10 +3938,10 @@ _MoveMon: ; f51e (3:751e) call CopyData pop de pop hl - ld a, [wcf95] + ld a, [wMoveMonType] and a jr z, .asm_f5b4 - cp $2 + cp DAYCARE_TO_PARTY jr z, .asm_f5b4 ld bc, wBoxMon2 - wBoxMon1 add hl, bc @@ -3951,8 +3951,8 @@ _MoveMon: ; f51e (3:751e) inc de ld [de], a .asm_f5b4 - ld a, [wcf95] - cp $3 + ld a, [wMoveMonType] + cp PARTY_TO_DAYCARE ld de, W_DAYCAREMONOT jr z, .asm_f5d3 dec a @@ -3968,11 +3968,11 @@ _MoveMon: ; f51e (3:751e) ld e, l .asm_f5d3 ld hl, wBoxMonOT - ld a, [wcf95] + ld a, [wMoveMonType] and a jr z, .asm_f5e6 ld hl, W_DAYCAREMONOT - cp $2 + cp DAYCARE_TO_PARTY jr z, .asm_f5ec ld hl, wPartyMonOT .asm_f5e6 @@ -3981,8 +3981,8 @@ _MoveMon: ; f51e (3:751e) .asm_f5ec ld bc, $b call CopyData - ld a, [wcf95] - cp $3 + ld a, [wMoveMonType] + cp PARTY_TO_DAYCARE ld de, W_DAYCAREMONNAME jr z, .asm_f611 dec a @@ -3998,11 +3998,11 @@ _MoveMon: ; f51e (3:751e) ld e, l .asm_f611 ld hl, wBoxMonNicks - ld a, [wcf95] + ld a, [wMoveMonType] and a jr z, .asm_f624 ld hl, W_DAYCAREMONNAME - cp $2 + cp DAYCARE_TO_PARTY jr z, .asm_f62a ld hl, wPartyMonNicks .asm_f624 @@ -4012,10 +4012,10 @@ _MoveMon: ; f51e (3:751e) ld bc, $b call CopyData pop hl - ld a, [wcf95] - cp $1 + ld a, [wMoveMonType] + cp PARTY_TO_BOX jr z, .asm_f664 - cp $3 + cp PARTY_TO_DAYCARE jr z, .asm_f664 push hl srl a diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 83b9b3a7..f48584dc 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -45,13 +45,13 @@ DayCareMText1: ; 56254 (15:6254) call GetPartyMonName ld hl, DayCareMText_56419 call PrintText - ld a, $1 + ld a, 1 ld [W_DAYCARE_IN_USE], a - ld a, $3 - ld [wcf95], a + ld a, PARTY_TO_DAYCARE + ld [wMoveMonType], a call MoveMon xor a - ld [wcf95], a + ld [wRemoveMonFromBox], a call RemovePokemon ld a, [wcf91] call PlayCry @@ -163,21 +163,21 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) call DisplayTextBoxID ld hl, DayCareMText_5644f call PrintText - ld a, $2 - ld [wcf95], a + ld a, DAYCARE_TO_PARTY + ld [wMoveMonType], a call MoveMon ld a, [wDayCareMonSpecies] ld [wcf91], a ld a, [wPartyCount] dec a push af - ld bc, $002c + ld bc, wPartyMon2 - wPartyMon1 push bc ld hl, wPartyMon1Moves call AddNTimes ld d, h ld e, l - ld a, $1 + ld a, 1 ld [wHPBarMaxHP], a predef WriteMonMoves pop bc @@ -186,7 +186,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) call AddNTimes ld d, h ld e, l - ld bc, $0021 + ld bc, wPartyMon1MaxHP - wPartyMon1HP add hl, bc ld a, [hli] ld [de], a diff --git a/wram.asm b/wram.asm index 65681990..c5f06e53 100755 --- a/wram.asm +++ b/wram.asm @@ -851,7 +851,16 @@ wListMenuID:: ; cf94 ; ID used by DisplayListMenuID ds 1 -wcf95:: ds 1 ; used with RemovePokemon (BoxMons, Daycare, Trades, etc.) +wRemoveMonFromBox:: ; cf95 +; if non-zero, RemovePokemon will remove the mon from the current box, +; else it will remove the mon from the party + +wMoveMonType:: ; cf95 +; 0 = move from box to party +; 1 = move from party to box +; 2 = move from daycare to party +; 3 = move from party to daycare + ds 1 wItemQuantity:: ; cf96 ds 1 -- cgit v1.3.1-sl0p From f66a74b9fcb762d693e89415836386bcad2475b5 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 13 Jul 2015 13:35:35 -0700 Subject: comment slot machine --- constants/misc_constants.asm | 13 + engine/HoF_room_pc.asm | 4 +- engine/battle/animations.asm | 6 +- engine/game_corner_slots.asm | 24 +- engine/menu/diploma.asm | 2 +- engine/menu/naming_screen.asm | 2 +- engine/mon_party_sprites.asm | 4 +- engine/slot_machine.asm | 596 ++++++++++++++++++++++-------------------- engine/town_map.asm | 8 +- home.asm | 2 +- home/init.asm | 4 +- scripts/celadongamecorner.asm | 4 +- wram.asm | 109 +++++++- 13 files changed, 449 insertions(+), 329 deletions(-) (limited to 'scripts') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 8aac849e..323e2ab6 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -72,6 +72,19 @@ PARTY_TO_BOX EQU 1 DAYCARE_TO_PARTY EQU 2 PARTY_TO_DAYCARE EQU 3 +; emotion bubbles +EXCLAMATION_BUBBLE EQU 0 +QUESTION_BUBBLE EQU 1 +SMILE_BUBBLE EQU 2 + +; slot symbols +SLOTS7 EQU $0200 +SLOTSBAR EQU $0604 +SLOTSCHERRY EQU $0A08 +SLOTSFISH EQU $0E0C +SLOTSBIRD EQU $1210 +SLOTSMOUSE EQU $1614 + ; serial ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 14382288..7a2226be 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -77,7 +77,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb) call Func_74164 call FillMiddleOfScreenWithWhite ld a,$FC - ld [$FF47],a + ld [rBGP],a ld bc,7 .next call Func_74140 @@ -94,7 +94,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb) xor a ld [hWY],a ld a,$C0 - ld [$FF47],a + ld [rBGP],a ret INCLUDE "data/credit_mons.asm" diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index a54233d0..ea879e53 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -2645,16 +2645,16 @@ Unknown_79c50: ; 79c50 (1e:5c50) AnimationLeavesFalling: ; 79c74 (1e:5c74) ; Makes leaves float down from the top of the screen. This is used ; in Razor Leaf's animation. - ld a, [$ff48] + ld a, [rOBP0] push af ld a, [wcc79] - ld [$ff48], a + ld [rOBP0], a ld d, $37 ld a, $3 ld [W_SUBANIMTRANSFORM], a call Func_79c97 pop af - ld [$ff48], a + ld [rOBP0], a ret AnimationPetalsFalling: ; 79c8a (1e:5c8a) diff --git a/engine/game_corner_slots.asm b/engine/game_corner_slots.asm index 01d42d21..b3b2490c 100755 --- a/engine/game_corner_slots.asm +++ b/engine/game_corner_slots.asm @@ -1,5 +1,5 @@ StartSlotMachine: ; 37e2d (d:7e2d) - ld a, [wTrainerSpriteOffset] + ld a, [wHiddenObjectFunctionArgument] cp $fd jr z, .printOutOfOrder cp $fe @@ -7,23 +7,23 @@ StartSlotMachine: ; 37e2d (d:7e2d) cp $ff jr z, .printSomeonesKeys callba AbleToPlaySlotsCheck - ld a, [wTrainerSpriteOffset] + ld a, [wHiddenObjectFunctionArgument] and a ret z - ld a, [wUnknownSlotVar] + ld a, [wLuckySlotHiddenObjectIndex] ld b, a - ld a, [wTrainerFacingDirection] + ld a, [wHiddenObjectIndex] inc a cp b - jr z, .asm_37e58 - ld a, $fd - jr .asm_37e5a -.asm_37e58 - ld a, $fa -.asm_37e5a - ld [wcc5b], a + jr z, .match + ld a, 253 + jr .next +.match + ld a, 250 +.next + ld [wSlotMachineSevenAndBarModeChance], a ld a, [H_LOADEDROMBANK] - ld [wcc5e], a + ld [wSlotMachineSavedROMBank], a call PromptUserToPlaySlots ret .printOutOfOrder diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm index 067cd7d2..9305bb0c 100755 --- a/engine/menu/diploma.asm +++ b/engine/menu/diploma.asm @@ -56,7 +56,7 @@ DisplayDiploma: ; 566e2 (15:66e2) call Delay3 call GBPalNormal ld a, $90 - ld [$ff48], a + ld [rOBP0], a call WaitForTextScrollButtonPress ld hl, wd730 res 6, [hl] diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index bd1c39dd..f77f7331 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -114,7 +114,7 @@ DisplayNamingScreen: ; 6596 (1:6596) ld hl, wHPBarMaxHP + 1 ld [hli], a ld [hli], a - ld [wPartyMonAnimCounter], a + ld [wAnimCounter], a .asm_65ed call PrintAlphabet call GBPalNormal diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm index e3323cfc..e3ccde57 100755 --- a/engine/mon_party_sprites.asm +++ b/engine/mon_party_sprites.asm @@ -27,7 +27,7 @@ GetAnimationSpeed: ; 7170a (1c:570a) ld c, a add a ld b, a - ld a, [wPartyMonAnimCounter] + ld a, [wAnimCounter] and a jr z, .resetSprites cp c @@ -38,7 +38,7 @@ GetAnimationSpeed: ; 7170a (1c:570a) jr nz, .skipResetTimer xor a ; reset timer .skipResetTimer - ld [wPartyMonAnimCounter], a + ld [wAnimCounter], a jp DelayFrame .resetSprites push bc diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 6dae7293..f30a361c 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -10,13 +10,13 @@ PromptUserToPlaySlots: ; 3730e (d:730e) call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .skip + jr nz, .done ; if player chose No dec a ld [wUpdateSpritesEnabled], a - ld hl, wcd4f + ld hl, wSlotMachineRerollCounter xor a ld [hli], a - ld [hl], $2 + ld [hl], SMILE_BUBBLE predef EmotionBubble call GBPalWhiteOutWithDelay3 call LoadSlotMachineTiles @@ -25,30 +25,30 @@ PromptUserToPlaySlots: ; 3730e (d:730e) call GoPAL_SET call GBPalNormal ld a, $e4 - ld [$ff48], a + ld [rOBP0], a ld hl, wd730 set 6, [hl] xor a - ld [W_SUBANIMSUBENTRYADDR], a - ld hl, wTrainerSpriteOffset + ld [wSlotMachineAllowMatchesCounter], a + ld hl, wStoppingWhichSlotMachineWheel ld bc, $0014 call FillMemory call MainSlotMachineLoop ld hl, wd730 res 6, [hl] xor a - ld [W_SUBANIMSUBENTRYADDR], a + ld [wSlotMachineAllowMatchesCounter], a call GBPalWhiteOutWithDelay3 ld a, $1 ld [wUpdateSpritesEnabled], a call GoPAL_SET_CF1C call ReloadMapSpriteTilePatterns call ReloadTilesetTilePatterns -.skip +.done call LoadScreenTilesFromBuffer2 call Delay3 call GBPalNormal - ld a, [wcc5e] + ld a, [wSlotMachineSavedROMBank] push af jp CloseTextDisplay @@ -57,43 +57,43 @@ PlaySlotMachineText: ; 37390 (d:7390) db "@" MainSlotMachineLoop: ; 37395 (d:7395) - call SlotMachine_37754 + call SlotMachine_PrintCreditCoins xor a - ld hl, wcd4a + ld hl, wPayoutCoins ld [hli], a ld [hl], a - call SlotMachine_3775f + call SlotMachine_PrintPayoutCoins ld hl, BetHowManySlotMachineText call PrintText call SaveScreenTilesToBuffer1 .loop - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, $2 + ld a, 2 ld [wMaxMenuItem], a - ld a, $c + ld a, 12 ld [wTopMenuItemY], a - ld a, $f + ld a, 15 ld [wTopMenuItemX], a xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a - ld hl, wTileMap + $ea - ld b, $5 - ld c, $4 + hlCoord 14, 11 + ld b, 5 + ld c, 4 call TextBoxBorder - ld hl, wTileMap + $100 + hlCoord 16, 12 ld de, CoinMultiplierSlotMachineText call PlaceString call HandleMenuInput - and $2 + and B_BUTTON jp nz, LoadScreenTilesFromBuffer1 ld a, [wCurrentMenuItem] ld b, a - ld a, $3 + ld a, 3 sub b - ld [wcd50], a + ld [wSlotMachineBet], a ld hl, wPlayerCoins ld c, a ld a, [hli] @@ -107,11 +107,11 @@ MainSlotMachineLoop: ; 37395 (d:7395) jr .loop .skip1 call LoadScreenTilesFromBuffer1 - call SlotMachine_37741 - call SlotMachine_377d5 - call SlotMachine_37480 - ld a, $4 - ld hl, wcd4d + call SlotMachine_SubtractBetFromPlayerCoins + call SlotMachine_LightBalls + call SlotMachine_SetFlags + ld a, 4 + ld hl, wSlotMachineWheel1SlipCounter ld [hli], a ld [hli], a ld [hl], a @@ -120,8 +120,8 @@ MainSlotMachineLoop: ; 37395 (d:7395) call PlaySound ld hl, StartSlotMachineText call PrintText - call SlotMachine_374ad - call SlotMachine_37588 + call SlotMachine_SpinWheels + call SlotMachine_CheckForMatches ld hl, wPlayerCoins ld a, [hli] or [hl] @@ -143,7 +143,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) ld a, [wCurrentMenuItem] and a ret nz - call SlotMachine_377ce + call SlotMachine_PutOutLitBalls jp MainSlotMachineLoop CoinMultiplierSlotMachineText: ; 3745e (d:745e) @@ -171,55 +171,55 @@ OneMoreGoSlotMachineText: ; 3747b (d:747b) TX_FAR _OneMoreGoSlotMachineText db "@" -SlotMachine_37480: ; 37480 (d:7480) - ld hl, wcd4c +SlotMachine_SetFlags: ; 37480 (d:7480) + ld hl, wSlotMachineFlags bit 7, [hl] ret nz - ld a, [W_SUBANIMSUBENTRYADDR] + ld a, [wSlotMachineAllowMatchesCounter] and a - jr nz, .skip1 + jr nz, .allowMatches call Random and a - jr z, .skip2 + jr z, .setAllowMatchesCounter ; 1/256 (~0.4%) chance ld b, a - ld a, [wcc5b] + ld a, [wSlotMachineSevenAndBarModeChance] cp b - jr c, .skip3 - ld a, $d2 + jr c, .allowSevenAndBarMatches + ld a, 210 cp b - jr c, .skip1 - ld [hl], $0 + jr c, .allowMatches ; 55/256 (~21.5%) chance + ld [hl], 0 ret -.skip1 +.allowMatches set 6, [hl] ret -.skip2 - ld a, $3c - ld [W_SUBANIMSUBENTRYADDR], a +.setAllowMatchesCounter + ld a, 60 + ld [wSlotMachineAllowMatchesCounter], a ret -.skip3 +.allowSevenAndBarMatches set 7, [hl] ret -SlotMachine_374ad: ; 374ad (d:74ad) +SlotMachine_SpinWheels: ; 374ad (d:74ad) ld c, 20 .loop1 push bc - call SlotMachine_37813 - call SlotMachine_37823 - call SlotMachine_37833 + call SlotMachine_AnimWheel1 + call SlotMachine_AnimWheel2 + call SlotMachine_AnimWheel3 ld c, 2 call DelayFrames pop bc dec c jr nz, .loop1 xor a - ld [wTrainerSpriteOffset], a + ld [wStoppingWhichSlotMachineWheel], a .loop2 - call SlotMachine_37882 - call SlotMachine_374df - call SlotMachine_374fb - call SlotMachine_37517 + call SlotMachine_HandleInputWhileWheelsSpin + call SlotMachine_StopOrAnimWheel1 + call SlotMachine_StopOrAnimWheel2 + call SlotMachine_StopOrAnimWheel3 ret c ld a, [wOnSGB] xor $1 @@ -228,194 +228,214 @@ SlotMachine_374ad: ; 374ad (d:74ad) call DelayFrames jr .loop2 -SlotMachine_374df: ; 374df (d:74df) - ld a, [wTrainerSpriteOffset] - cp $1 - jr c, .skip - ld de, wTrainerEngageDistance +; 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. + +SlotMachine_StopOrAnimWheel1: ; 374df (d:74df) + ld a, [wStoppingWhichSlotMachineWheel] + cp 1 + jr c, .animWheel + ld de, wSlotMachineWheel1Offset ld a, [de] rra - jr nc, .skip - ld hl, wcd4d + jr nc, .animWheel ; check that a symbol is centred in the wheel + ld hl, wSlotMachineWheel1SlipCounter ld a, [hl] and a ret z dec [hl] - call SlotMachine_3752c + call SlotMachine_StopWheel1Early ret nz -.skip - jp SlotMachine_37813 - -SlotMachine_374fb: ; 374fb (d:74fb) - ld a, [wTrainerSpriteOffset] - cp $2 - jr c, .skip - ld de, wTrainerFacingDirection +.animWheel + jp SlotMachine_AnimWheel1 + +SlotMachine_StopOrAnimWheel2: ; 374fb (d:74fb) + ld a, [wStoppingWhichSlotMachineWheel] + cp 2 + jr c, .animWheel + ld de, wSlotMachineWheel2Offset ld a, [de] rra - jr nc, .skip - ld hl, wcd4e + jr nc, .animWheel ; check that a symbol is centred in the wheel + ld hl, wSlotMachineWheel2SlipCounter ld a, [hl] and a ret z dec [hl] - call SlotMachine_37552 + call SlotMachine_StopWheel2Early ret z -.skip - jp SlotMachine_37823 - -SlotMachine_37517: ; 37517 (d:7517) - ld a, [wTrainerSpriteOffset] - cp $3 - jr c, .skip - ld de, wTrainerScreenY +.animWheel + jp SlotMachine_AnimWheel2 + +SlotMachine_StopOrAnimWheel3: ; 37517 (d:7517) + ld a, [wStoppingWhichSlotMachineWheel] + cp 3 + jr c, .animWheel + ld de, wSlotMachineWheel3Offset ld a, [de] rra - jr nc, .skip + jr nc, .animWheel ; check that a symbol is centred in the wheel +; wheel 3 stops as soon as possible scf ret -.skip - call SlotMachine_37833 +.animWheel + call SlotMachine_AnimWheel3 and a ret -SlotMachine_3752c: ; 3752c (d:752c) - call SlotMachine_GetWheelOneTile - ld hl, wTrainerScreenX - ld a, [wcd4c] +SlotMachine_StopWheel1Early: ; 3752c (d:752c) + call SlotMachine_GetWheel1Tiles + ld hl, wSlotMachineWheel1BottomTile + ld a, [wSlotMachineFlags] and $80 - jr nz, .skip1 + jr nz, .sevenAndBarMode +; Stop early if the middle symbol is not a cherry. inc hl ld a, [hl] - cp $a - jr nz, .skip2 + cp SLOTSCHERRY >> 8 + jr nz, .stopWheel ret -.skip1 +; 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 ld c, $3 .loop ld a, [hli] - cp $2 - jr c, .skip2 + cp SLOTS7 >> 8 + jr c, .stopWheel ; condition never true dec c jr nz, .loop ret -.skip2 +.stopWheel inc a - ld hl, wcd4d - ld [hl], $0 + ld hl, wSlotMachineWheel1SlipCounter + ld [hl], 0 ret -SlotMachine_37552: ; 37552 (d:7552) - call SlotMachine_GetWheelTwoTile - ld a, [wcd4c] +SlotMachine_StopWheel2Early: ; 37552 (d:7552) + call SlotMachine_GetWheel2Tiles + ld a, [wSlotMachineFlags] and $80 - jr nz, .skip1 - call SlotMachine_3756e + jr nz, .sevenAndBarMode +; Stop early if any symbols are lined up in the first two wheels. + call SlotMachine_FindWheel1Wheel2Matches ret nz - jr .skip2 -.skip1 - call SlotMachine_3756e + 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 ld a, [de] - cp $7 + cp (SLOTSBAR >> 8) + 1 ret nc -.skip2 +.stopWheel xor a - ld [wcd4e], a + ld [wSlotMachineWheel2SlipCounter], a ret -SlotMachine_3756e: ; 3756e (d:756e) - ld hl, wTrainerScreenX - ld de, wcd44 +SlotMachine_FindWheel1Wheel2Matches: ; 3756e (d:756e) +; 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 ld a, [de] - cp [hl] + cp [hl] ; wheel 1 bottom, wheel 2 bottom ret z inc de ld a, [de] - cp [hl] + cp [hl] ; wheel 1 bottom, wheel 2 middle ret z inc hl - cp [hl] + cp [hl] ; wheel 1 middle, wheel 2 middle ret z inc hl - cp [hl] + cp [hl] ; wheel 1 top, wheel 2 middle ret z inc de ld a, [de] - cp [hl] + cp [hl] ; wheel 1 top, wheel 2 top ret z dec de dec de ret -SlotMachine_37588: ; 37588 (d:7588) - call SlotMachine_GetWheelThreeTile - ld a, [wcd50] - cp $2 - jr z, .skip1 - cp $1 - jr z, .skip2 - ld hl, wTrainerScreenX - ld de, wcd45 - ld bc, wcd49 +SlotMachine_CheckForMatches: ; 37588 (d:7588) + 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 call SlotMachine_CheckForMatch - jp z, .skip5 - ld hl, wcd43 - ld de, wcd45 - ld bc, wcd47 + jp z, .foundMatch + ld hl, wSlotMachineWheel1TopTile + ld de, wSlotMachineWheel2MiddleTile + ld bc, wSlotMachineWheel3BottomTile call SlotMachine_CheckForMatch - jr z, .skip5 -.skip1 - ld hl, wcd43 - ld de, wcd46 - ld bc, wcd49 + 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 call SlotMachine_CheckForMatch - jr z, .skip5 - ld hl, wTrainerScreenX - ld de, wcd44 - ld bc, wcd47 + jr z, .foundMatch + ld hl, wSlotMachineWheel1BottomTile + ld de, wSlotMachineWheel2BottomTile + ld bc, wSlotMachineWheel3BottomTile call SlotMachine_CheckForMatch - jr z, .skip5 -.skip2 - ld hl, wcd42 - ld de, wcd45 - ld bc, wcd48 + jr z, .foundMatch +; 1 coin bet only allows a middle horizontal match +.checkMatchFor1CoinBet + ld hl, wSlotMachineWheel1MiddleTile + ld de, wSlotMachineWheel2MiddleTile + ld bc, wSlotMachineWheel3MiddleTile call SlotMachine_CheckForMatch - jr z, .skip5 - ld a, [wcd4c] + jr z, .foundMatch + ld a, [wSlotMachineFlags] and $c0 - jr z, .skip3 - ld hl, wcd4f + jr z, .noMatch + ld hl, wSlotMachineRerollCounter dec [hl] - jr nz, .skip4 -.skip3 + jr nz, .rollWheel3DownByOneSymbol +.noMatch ld hl, NotThisTimeText call PrintText -.loop +.done xor a ld [wc002], a ret -.skip4 - call SlotMachine_37833 +.rollWheel3DownByOneSymbol + call SlotMachine_AnimWheel3 call DelayFrame - call SlotMachine_37833 + call SlotMachine_AnimWheel3 call DelayFrame - jp SlotMachine_37588 -.skip5 - ld a, [wcd4c] + jp SlotMachine_CheckForMatches +.foundMatch + ld a, [wSlotMachineFlags] and $c0 - jr z, .skip4 + jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win and $80 - jr nz, .skip6 + jr nz, .acceptMatch +; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel ld a, [hl] - cp $7 - jr c, .skip4 -.skip6 + cp (SLOTSBAR >> 8) + 1 + jr c, .rollWheel3DownByOneSymbol +.acceptMatch ld a, [hl] sub $2 - ld [wTrainerScreenX], a + ld [wSlotMachineWinningSymbol], a ld hl, SlotRewardPointers ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hli] ld e, a @@ -426,39 +446,39 @@ SlotMachine_37588: ; 37588 (d:7588) ld h, [hl] ld l, a ld de, wcf4b - ld bc, $0004 + ld bc, 4 call CopyData pop hl - ld de, .asm_37638 + ld de, .flashScreenLoop push de jp [hl] -.asm_37638 - ld a, [$ff47] +.flashScreenLoop + ld a, [rBGP] xor $40 - ld [$ff47], a + ld [rBGP], a ld c, 5 call DelayFrames dec b - jr nz, .asm_37638 - ld hl, wcd4a + jr nz, .flashScreenLoop + ld hl, wPayoutCoins ld [hl], d inc hl ld [hl], e - call SlotMachine_3775f - ld hl, SlotsMachineText_37665 + call SlotMachine_PrintPayoutCoins + ld hl, SymbolLinedUpSlotMachineText call PrintText call WaitForTextScrollButtonPress - call SlotMachine_3776b - call SlotMachine_3775f + call SlotMachine_PayCoinsToPlayer + call SlotMachine_PrintPayoutCoins ld a, $e4 - ld [$ff48], a - jp .loop + ld [rOBP0], a + jp .done -SlotsMachineText_37665: ; 37665 (d:7665) +SymbolLinedUpSlotMachineText: ; 37665 (d:7665) TX_ASM push bc - call SlotMachine_37728 + call SlotMachine_PrintWinningSymbol ld hl, LinedUpText pop bc inc bc @@ -510,28 +530,28 @@ SlotMachine_CheckForMatch: ; 376a2 (d:76a2) cp [hl] ret -SlotMachine_GetWheelThreeTile: ; 376a8 (d:76a8) - ld de, wcd47 +SlotMachine_GetWheel3Tiles: ; 376a8 (d:76a8) + ld de, wSlotMachineWheel3BottomTile ld hl, SlotMachineWheel3 - ld a, [wTrainerScreenY] - call SlotMachine_GetWheelTile + ld a, [wSlotMachineWheel3Offset] + call SlotMachine_GetWheelTiles -SlotMachine_GetWheelTwoTile: ; 376b4 (d:76b4) - ld de, wcd44 +SlotMachine_GetWheel2Tiles: ; 376b4 (d:76b4) + ld de, wSlotMachineWheel2BottomTile ld hl, SlotMachineWheel2 - ld a, [wTrainerFacingDirection] - call SlotMachine_GetWheelTile + ld a, [wSlotMachineWheel2Offset] + call SlotMachine_GetWheelTiles -SlotMachine_GetWheelOneTile: ; 376c0 (d:76c0) - ld de, wTrainerScreenX +SlotMachine_GetWheel1Tiles: ; 376c0 (d:76c0) + ld de, wSlotMachineWheel1BottomTile ld hl, SlotMachineWheel1 - ld a, [wTrainerEngageDistance] + ld a, [wSlotMachineWheel1Offset] -SlotMachine_GetWheelTile: ; 376c9 (d:76c9) +SlotMachine_GetWheelTiles: ; 376c9 (d:76c9) ld c, a - ld b, $0 + ld b, 0 add hl, bc - ld c, $3 + ld c, 3 .loop ld a, [hli] ld [de], a @@ -542,7 +562,7 @@ SlotMachine_GetWheelTile: ; 376c9 (d:76c9) ret SlotReward8Func: ; 376d7 (d:76d7) - ld hl, W_SUBANIMSUBENTRYADDR + ld hl, wSlotMachineAllowMatchesCounter ld a, [hl] and a jr z, .skip @@ -553,7 +573,7 @@ SlotReward8Func: ; 376d7 (d:76d7) ret SlotReward15Func: ; 376e5 (d:76e5) - ld hl, W_SUBANIMSUBENTRYADDR + ld hl, wSlotMachineAllowMatchesCounter ld a, [hl] and a jr z, .skip @@ -567,7 +587,7 @@ SlotReward100Func: ; 376f3 (d:76f3) ld a, (SFX_1f_42 - SFX_Headers_1f) / 3 call PlaySound xor a - ld [wcd4c], a + ld [wSlotMachineFlags], a ld b, $8 ld de, 100 ret @@ -581,9 +601,9 @@ SlotReward300Func: ; 37702 (d:7702) cp $80 ld a, $0 jr c, .skip - ld [wcd4c], a + ld [wSlotMachineFlags], a .skip - ld [W_SUBANIMSUBENTRYADDR], a + ld [wSlotMachineAllowMatchesCounter], a ld b, $14 ld de, 300 ret @@ -592,26 +612,27 @@ YeahText: ; 37722 (d:7722) TX_FAR _YeahText db $0a, "@" -SlotMachine_37728: ; 37728 (d:7728) - ld hl, wTileMap + $11a - ld a, [wTrainerScreenX] +SlotMachine_PrintWinningSymbol: ; 37728 (d:7728) +; prints winning symbol and down arrow in text box + hlCoord 2, 14 + ld a, [wSlotMachineWinningSymbol] add $25 ld [hli], a inc a ld [hld], a inc a - ld de, $ffec + ld de, -SCREEN_WIDTH add hl, de ld [hli], a inc a ld [hl], a - ld hl, wTileMap + $152 - ld [hl], $ee + hlCoord 18, 16 + ld [hl], $ee ; down arrow ret -SlotMachine_37741: ; 37741 (d:7741) - ld hl, wcd4b - ld a, [wcd50] +SlotMachine_SubtractBetFromPlayerCoins: ; 37741 (d:7741) + ld hl, wTempCoins2 + 1 + ld a, [wSlotMachineBet] ld [hld], a xor a ld [hli], a @@ -619,136 +640,143 @@ SlotMachine_37741: ; 37741 (d:7741) ld c, $2 predef SubBCDPredef -SlotMachine_37754: ; 37754 (d:7754) - ld hl, wTileMap + $19 +SlotMachine_PrintCreditCoins: ; 37754 (d:7754) + hlCoord 5, 1 ld de, wPlayerCoins ld c, $2 jp PrintBCDNumber -SlotMachine_3775f: ; 3775f (d:775f) - ld hl, wTileMap + $1f - ld de, wcd4a - ld bc, $8204 +SlotMachine_PrintPayoutCoins: ; 3775f (d:775f) + hlCoord 11, 1 + ld de, wPayoutCoins + ld bc, $8204 ; 2 bytes, 4 digits, leading zeroes jp PrintNumber -SlotMachine_3776b: ; 3776b (d:776b) +SlotMachine_PayCoinsToPlayer: ; 3776b (d:776b) ld a, $1 ld [wc002], a call WaitForSoundToFinish - ld hl, wcd46 + +; 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 xor a ld [hli], a inc a ld [hl], a - ld a, $5 - ld [W_SUBANIMTRANSFORM], a + + 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. .loop - ld a, [wcd4b] + ld a, [wPayoutCoins + 1] ld l, a - ld a, [wcd4a] + ld a, [wPayoutCoins] ld h, a or l ret z - ld de, $ffff + ld de, -1 add hl, de ld a, l - ld [wcd4b], a + ld [wPayoutCoins + 1], a ld a, h - ld [wcd4a], a - ld hl, wcd47 + ld [wPayoutCoins], a + ld hl, wTempCoins1 + 1 ld de, wPlayerCoins + 1 ld c, $2 predef AddBCDPredef - call SlotMachine_37754 - call SlotMachine_3775f + call SlotMachine_PrintCreditCoins + call SlotMachine_PrintPayoutCoins ld a, (SFX_1f_65 - SFX_Headers_1f) / 3 call PlaySound - ld a, [W_SUBANIMTRANSFORM] + ld a, [wAnimCounter] dec a jr nz, .skip1 - ld a, [$ff48] - xor $40 - ld [$ff48], a - ld a, $5 + ld a, [rOBP0] + xor $40 ; make the slot wheel symbols flash + ld [rOBP0], a + ld a, 5 .skip1 - ld [W_SUBANIMTRANSFORM], a - ld a, [wTrainerScreenX] - cp $7 + ld [wAnimCounter], a + ld a, [wSlotMachineWinningSymbol] + cp (SLOTSBAR >> 8) + 1 ld c, 8 jr nc, .skip2 - srl c + srl c ; c = 4 (make the the coins transfer faster if the symbol was 7 or bar) .skip2 call DelayFrames jr .loop -SlotMachine_377ce: ; 377ce (d:77ce) +SlotMachine_PutOutLitBalls: ; 377ce (d:77ce) ld a, $23 ld [wd08a], a - jr SlotMachine_377e3 + jr SlotMachine_UpdateThreeCoinBallTiles -SlotMachine_377d5: ; 377d5 (d:77d5) +SlotMachine_LightBalls: ; 377d5 (d:77d5) ld a, $14 ld [wd08a], a - ld a, [wcd50] + ld a, [wSlotMachineBet] dec a - jr z, SlotMachine_377fb + jr z, SlotMachine_UpdateOneCoinBallTiles dec a - jr z, SlotMachine_377ef + jr z, SlotMachine_UpdateTwoCoinBallTiles -SlotMachine_377e3: ; 377e3 (d:77e3) - ld hl, wTileMap + $2b - call SlotMachine_377fe - ld hl, wTileMap + $cb - call SlotMachine_377fe +SlotMachine_UpdateThreeCoinBallTiles: ; 377e3 (d:77e3) + hlCoord 3, 2 + call SlotMachine_UpdateBallTiles + hlCoord 3, 10 + call SlotMachine_UpdateBallTiles -SlotMachine_377ef: ; 377ef (d:77ef) - ld hl, wTileMap + $53 - call SlotMachine_377fe - ld hl, wTileMap + $a3 - call SlotMachine_377fe +SlotMachine_UpdateTwoCoinBallTiles: ; 377ef (d:77ef) + hlCoord 3, 4 + call SlotMachine_UpdateBallTiles + hlCoord 3, 8 + call SlotMachine_UpdateBallTiles -SlotMachine_377fb: ; 377fb (d:77fb) - ld hl, wTileMap + $7b +SlotMachine_UpdateOneCoinBallTiles: ; 377fb (d:77fb) + hlCoord 3, 6 -SlotMachine_377fe: ; 377fe (d:77fe) +SlotMachine_UpdateBallTiles: ; 377fe (d:77fe) ld a, [wd08a] ld [hl], a - ld bc, $000d + ld bc, 13 add hl, bc ld [hl], a - ld bc, $0007 + ld bc, 7 add hl, bc inc a ld [hl], a - ld bc, $000d + ld bc, 13 add hl, bc ld [hl], a ret -SlotMachine_37813: ; 37813 (d:7813) +SlotMachine_AnimWheel1: ; 37813 (d:7813) ld bc, SlotMachineWheel1 - ld de, wTrainerEngageDistance + ld de, wSlotMachineWheel1Offset ld hl, wOAMBuffer ld a, $30 ld [W_BASECOORDX], a - jr SlotMachine_37841 + jr SlotMachine_AnimWheel -SlotMachine_37823: ; 37823 (d:7823) +SlotMachine_AnimWheel2: ; 37823 (d:7823) ld bc, SlotMachineWheel2 - ld de, wTrainerFacingDirection + ld de, wSlotMachineWheel2Offset ld hl, wOAMBuffer + $30 ld a, $50 ld [W_BASECOORDX], a - jr SlotMachine_37841 + jr SlotMachine_AnimWheel -SlotMachine_37833: ; 37833 (d:7833) +SlotMachine_AnimWheel3: ; 37833 (d:7833) ld bc, SlotMachineWheel3 - ld de, wTrainerScreenY + ld de, wSlotMachineWheel3Offset ld hl, wOAMBuffer + $60 ld a, $70 ld [W_BASECOORDX], a -SlotMachine_37841: ; 37841 (d:7841) +SlotMachine_AnimWheel: ; 37841 (d:7841) ld a, $58 ld [W_BASECOORDY], a push de @@ -756,10 +784,9 @@ SlotMachine_37841: ; 37841 (d:7841) ld d, b add c ld e, a - jr nc, SlotMachine_3784e + jr nc, .loop inc d - -SlotMachine_3784e: ; 3784e (d:784e) +.loop ld a, [W_BASECOORDY] ld [hli], a ld a, [W_BASECOORDX] @@ -783,30 +810,30 @@ SlotMachine_3784e: ; 3784e (d:784e) sub $8 ld [W_BASECOORDY], a cp $28 - jr nz, SlotMachine_3784e + jr nz, .loop pop de ld a, [de] - inc a - cp $1e + inc a ; advance the offset so that the wheel animates + cp 30 jr nz, .skip - xor a + xor a ; wrap around to 0 when the offset reaches 30 .skip ld [de], a ret -SlotMachine_37882: ; 37882 (d:7882) +SlotMachine_HandleInputWhileWheelsSpin: ; 37882 (d:7882) call DelayFrame call JoypadLowSensitivity ld a, [hJoy5] - and $1 + and A_BUTTON ret z - ld hl, wTrainerSpriteOffset + ld hl, wStoppingWhichSlotMachineWheel ld a, [hl] dec a - ld de, wcd4d + ld de, wSlotMachineWheel1SlipCounter jr z, .skip dec a - ld de, wcd4e + ld de, wSlotMachineWheel2SlipCounter jr z, .skip .loop inc [hl] @@ -845,20 +872,13 @@ LoadSlotMachineTiles: ; 378a8 (d:78a8) ld [hli], a ld [hli], a ld [hl], a - call SlotMachine_37813 - call SlotMachine_37823 - jp SlotMachine_37833 + call SlotMachine_AnimWheel1 + call SlotMachine_AnimWheel2 + jp SlotMachine_AnimWheel3 SlotMachineMap: ; 378f5 (d:78f5) INCBIN "gfx/tilemaps/slotmachine.map" -SLOTS7 EQU $0200 -SLOTSBAR EQU $0604 -SLOTSCHERRY EQU $0A08 -SLOTSFISH EQU $0E0C -SLOTSBIRD EQU $1210 -SLOTSMOUSE EQU $1614 - INCLUDE "data/slot_machine_wheels.asm" SlotMachineTiles1: ; 37a51 (d:7a51) diff --git a/engine/town_map.asm b/engine/town_map.asm index 0dd84226..d90dab95 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -79,7 +79,7 @@ Func_70e92: ; 70e92 (1c:4e92) xor a ld [wTownMapSpriteBlinkingEnabled], a ld [hJoy7], a - ld [wTownMapSpriteBlinkingCounter], a + ld [wAnimCounter], a call Func_711ab pop hl pop af @@ -319,7 +319,7 @@ LoadTownMap: ; 7109b (1c:509b) call Delay3 call GBPalNormal xor a - ld [wTownMapSpriteBlinkingCounter], a + ld [wAnimCounter], a inc a ld [wTownMapSpriteBlinkingEnabled], a ret @@ -577,7 +577,7 @@ MonNestIcon: ; 716be (1c:56be) INCBIN "gfx/mon_nest_icon.1bpp" TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6) - ld a, [wTownMapSpriteBlinkingCounter] + ld a, [wAnimCounter] inc a cp 25 jr z, .hideSprites @@ -601,5 +601,5 @@ TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6) jr nz, .hideSpritesLoop ld a, 25 .done - ld [wTownMapSpriteBlinkingCounter], a + ld [wAnimCounter], a jp DelayFrame diff --git a/home.asm b/home.asm index f6a1c914..f7da6e3a 100644 --- a/home.asm +++ b/home.asm @@ -3928,7 +3928,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2 .loop1 xor a - ld [wPartyMonAnimCounter],a ; counter for pokemon shaking animation + ld [wAnimCounter],a ; counter for pokemon shaking animation call PlaceMenuCursor call Delay3 .loop2 diff --git a/home/init.asm b/home/init.asm index 5a74dca9..b3f31944 100644 --- a/home/init.asm +++ b/home/init.asm @@ -31,8 +31,8 @@ rLCDC_DEFAULT EQU %11100011 ld [$ff4a], a ld [$ff06], a ld [$ff07], a - ld [$ff47], a - ld [$ff48], a + ld [rBGP], a + ld [rOBP0], a ld [$ff49], a ld a, rLCDC_ENABLE_MASK diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 6887c9c4..64701f08 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -12,7 +12,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf) res 6, [hl] ret z call Random - ld a, [$ffd3] + ld a, [hRandomAdd] cp $7 jr nc, .asm_48be2 ld a, $8 @@ -20,7 +20,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf) srl a srl a srl a - ld [wUnknownSlotVar], a + ld [wLuckySlotHiddenObjectIndex], a ret CeladonGameCornerScript_48bec: ; 48bec (12:4bec) diff --git a/wram.asm b/wram.asm index a1b9f1d3..c1002fcd 100755 --- a/wram.asm +++ b/wram.asm @@ -357,6 +357,13 @@ wNPCMovementScriptBank:: ; cc58 ds 2 +wSlotMachineSevenAndBarModeChance:: ; cc5b +; If a random number greater than this value is generated, then the player is +; allowed to have three 7 symbols or bar symbols line up. +; So, this value is actually the chance of NOT entering that mode. +; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance. +; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance. + wHallOfFame:: ; cc5b wBoostExpByExpAll:: ; cc5b wAnimationType:: ; cc5b @@ -365,7 +372,12 @@ wAnimationType:: ; cc5b wcc5b:: ds 1 ; these upcoming values below are miscellaneous storage values wcc5c:: ds 1 ; used in pokedex evaluation as well wcc5d:: ds 1 ; used in pokedex evaluation -wcc5e:: ds 13 ; as well as used as miscellaneous storage value, this is also used for the game corner slots + +wSlotMachineSavedROMBank:: ; cc5e +; ROM back to return to when the player is done with the slot machine + ds 1 + + ds 12 wcc6b:: ds 14 ; doesn't seem to be used for anything, probably just more storage wcc79:: ds 30 ; used in battle animations @@ -463,7 +475,7 @@ wPlayerMonMinimized:: ds 1 ; ccf7 ds 13 -wUnknownSlotVar:: ; cd05 +wLuckySlotHiddenObjectIndex:: ; cd05 wEnemyNumHits:: ; cd05 ; number of hits by enemy in attacks like Double Slap, etc. @@ -588,6 +600,10 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b ds 1 +wStoppingWhichSlotMachineWheel:: ; cd3d +; which wheel the player is trying to stop +; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3 + wTradedPlayerMonSpecies:: ; cd3d wTradingWhichPlayerMon:: ; cd3d @@ -611,6 +627,8 @@ wWhichTrade:: ; cd3d wTrainerSpriteOffset:: ; cd3d ds 1 +wSlotMachineWheel1Offset:: ; cd3e + wTradedEnemyMonSpecies:: ; cd3e wTradingWhichEnemyMon:: ; cd3e @@ -626,6 +644,8 @@ wHiddenObjectFunctionRomBank:: ; cd3e wTrainerEngageDistance:: ; cd3e ds 1 +wSlotMachineWheel2Offset:: ; cd3f + wNameOfPlayerMonToBeTraded:: ; cd3f wFlyAnimBirdSpriteImageIndex:: ; cd3f @@ -640,6 +660,8 @@ wTrainerFacingDirection:: ; cd3f wcd3f:: ; used with daycare text for money amount ds 1 +wSlotMachineWheel3Offset:: ; cd40 + wPlayerSpinInPlaceAnimSoundID:: ; cd40 wHiddenObjectY:: ; cd40 @@ -651,30 +673,89 @@ wTradedPlayerMonOT:: ; cd41 wHiddenObjectX:: ; cd41 +wSlotMachineWinningSymbol:: ; cd42 +; the OAM tile number of the upper left corner of the winning symbol minus 2 + +wSlotMachineWheel1BottomTile:: ; cd41 + wTrainerScreenX:: ; cd41 ds 1 ; a lot of the uses for these values use more than the said address +wSlotMachineWheel1MiddleTile:: ; cd42 + wcd42:: ds 1 ; used in pewter center script, printing field mon moves, slot machines and HoF PC + +wSlotMachineWheel1TopTile:: ; cd43 + wcd43:: ds 1 ; slot machine stuff and GetMonFieldMoves -wcd44:: ds 1 ; just slot machine -wcd45:: ds 1 ; slot machine... -wcd46:: ds 1 ; slot machine... + +wSlotMachineWheel2BottomTile:: ; cd44 + ds 1 + +wSlotMachineWheel2MiddleTile:: ; cd45 + ds 1 + +wTempCoins1:: ; cd46 +; 2 bytes +; temporary variable used to add payout amount to the player's coins + +wSlotMachineWheel2TopTile:: ; cd46 + ds 1 + +wSlotMachineWheel3BottomTile:: ; cd47 + wcd47:: ds 1 ; used in slot machine and spinning player sprite + +wSlotMachineWheel3MiddleTile:: ; cd48 + wcd48:: ds 1 ; same as above + +wSlotMachineWheel3TopTile:: ; cd49 + wcd49:: ds 1 ; used in slot machine, displaying the gym leaders/badges on the trainer card, and displaying the town map -wcd4a:: ds 1 ; probably used in one of the above mentioned functions -wcd4b:: ds 1 ; same as above + +wTempCoins2:: ; cd4a +; 2 bytes +; temporary variable used to subtract the bet amount from the player's coins + +wPayoutCoins:: ; cd4a +; 2 bytes + ds 1 + +wcd4b:: ; cd4b +; used in player animations + ds 1 wTradedPlayerMonOTID:: ; cd4c -wcd4c:: ds 1 ; slot machine and probably other above stuff +wSlotMachineFlags:: ; cd4c +; These flags are set randomly and control when the wheels stop. +; bit 6: allow the player to win in general +; bit 7: allow the player to win with 7 or bar (plus the effect of bit 6) + ds 1 + +wSlotMachineWheel1SlipCounter:: ; cd4d +; wheel 1 can "slip" while this is non-zero + wcd4d:: ds 1 ; used with cut and slot machine +wSlotMachineWheel2SlipCounter:: ; cd4e +; wheel 2 can "slip" while this is non-zero + wTradedEnemyMonOT:: ; cd4e wcd4e:: ds 1 ; used with in-game trades and slot machine + +wSlotMachineRerollCounter:: ; cd4f +; The remaining number of times wheel 3 will roll down a symbol until a match is +; found, when winning is enabled. It's initialized to 4 each bet. + wcd4f:: ds 1 ; used with in-game trades, emotion bubbles, and player animations + +wSlotMachineBet:: ; cd50 +; how many coins the player bet on the slot machine (1 to 3) + wcd50:: ds 9 ; used with in-game trades, emotion bubbles, and player and miscellaneous sprite animations wTradedEnemyMonOTID:: ; cd59 @@ -1194,9 +1275,8 @@ wTradedMonMovingRight:: ; d08a wd08a:: ds 1 ; used with sprites and displaying the option menu on the main menu screen? -wTownMapSpriteBlinkingCounter:: ; d08b - -wPartyMonAnimCounter:: ; d08b +wAnimCounter:: ; d08b +; generic counter variable for various animations W_SUBANIMTRANSFORM:: ; d08b ; controls what transformations are applied to the subanimation @@ -1222,6 +1302,13 @@ wEndBattleTextRomBank:: ; d092 W_SUBANIMADDRPTR:: ; d094 ; the address _of the address_ of the current subanimation entry ds 2 + +wSlotMachineAllowMatchesCounter:: ; d096 +; If non-zero, the allow matches flag is always set. +; There is a 1/256 (~0.4%) chance that this value will be set to 60, which is +; the only way it can increase. Winning certain payout amounts will decrement it +; or zero it. + W_SUBANIMSUBENTRYADDR:: ; d096 ; the address of the current subentry of the current subanimation ds 2 -- cgit v1.3.1-sl0p From 0066e09828265cc1cc83eca27e6be76911f187ec Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 13 Jul 2015 15:40:33 -0700 Subject: named party menu/naming screen wram variables --- constants/misc_constants.asm | 24 +++++++++++++++++++++ engine/battle/animations.asm | 4 ++-- engine/battle/core.asm | 16 +++++++------- engine/in_game_trades.asm | 4 ++-- engine/items/items.asm | 46 ++++++++++++++++++++--------------------- engine/menu/naming_screen.asm | 28 ++++++++++++------------- engine/menu/party_menu.asm | 16 +++++++------- engine/menu/start_sub_menus.asm | 14 ++++++------- engine/oak_speech2.asm | 8 +++---- home.asm | 2 +- main.asm | 4 ++-- scripts/daycarem.asm | 2 +- scripts/namerater.asm | 4 ++-- wram.asm | 8 ++++++- 14 files changed, 105 insertions(+), 75 deletions(-) (limited to 'scripts') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 323e2ab6..eca97408 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -85,6 +85,30 @@ SLOTSFISH EQU $0E0C SLOTSBIRD EQU $1210 SLOTSMOUSE EQU $1614 +; party menu types +NORMAL_PARTY_MENU EQU 0 +USE_ITEM_PARTY_MENU EQU 1 +BATTLE_PARTY_MENU EQU 2 +TMHM_PARTY_MENU EQU 3 +SWAP_MONS_PARTY_MENU EQU 4 +EVO_STONE_PARTY_MENU EQU 5 + +; party memu message IDs +ANTIDOTE_MSG EQU $F0 +BURN_HEAL_MSG EQU $F1 +ICE_HEAL_MSG EQU $F2 +AWAKENING_MSG EQU $F3 +PARALYZ_HEAL_MSG EQU $F4 +POTION_MSG EQU $F5 +FULL_HEAL_MSG EQU $F6 +REVIVE_MSG EQU $F7 +RARE_CANDY_MSG EQU $F8 + +; naming screen types +NAME_PLAYER_SCREEN EQU 0 +NAME_RIVAL_SCREEN EQU 1 +NAME_MON_SCREEN EQU 2 + ; serial ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index ea879e53..83590d4c 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -336,14 +336,14 @@ LoadAnimationTileset: ; 781d2 (1e:41d2) ld d,0 add hl,de ld a,[hli] - ld [wd07d],a ; number of tiles + ld [wTempTilesetNumTiles],a ; number of tiles ld a,[hli] ld e,a ld a,[hl] ld d,a ; de = address of tileset ld hl,vSprites + $310 ld b, BANK(AnimationTileset1) ; ROM bank - ld a,[wd07d] + ld a,[wTempTilesetNumTiles] ld c,a ; number of tiles jp CopyVideoData ; load tileset diff --git a/engine/battle/core.asm b/engine/battle/core.asm index f37da950..a611864d 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1162,8 +1162,8 @@ UseNextMonText: ; 3c7d3 (f:47d3) ; choose next player mon to send out ; stores whether enemy mon has no HP left in Z flag ChooseNextMon: ; 3c7d8 (f:47d8) - ld a, $2 - ld [wd07d], a + ld a, BATTLE_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a call DisplayPartyMenu .checkIfMonChosen jr nc, .monChosen @@ -1462,8 +1462,8 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld a,[wCurrentMenuItem] and a jr nz,.next4 - ld a,2 - ld [wd07d],a + ld a,BATTLE_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a call DisplayPartyMenu .next9 ld a,1 @@ -2384,8 +2384,8 @@ PartyMenuOrRockOrRun: jp UseBagItem .partyMenuWasSelected call LoadScreenTilesFromBuffer1 - xor a - ld [wd07d], a + xor a ; NORMAL_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a ld [wMenuItemToSwap], a call DisplayPartyMenu .checkIfPartyMonWasSelected @@ -2403,8 +2403,8 @@ PartyMenuOrRockOrRun: ld bc, $81 ld a, $7f call FillMemory - xor a - ld [wd07d], a + xor a ; NORMAL_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a call GoBackToPartyMenu jr .checkIfPartyMonWasSelected .partyMonWasSelected diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index 3594a26e..7366996c 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -87,8 +87,8 @@ InGameTrade_GetMonName: ; 71b6a (1c:5b6a) INCLUDE "data/trades.asm" InGameTrade_DoTrade: ; 71c07 (1c:5c07) - xor a - ld [wd07d],a + xor a ; NORMAL_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a dec a ld [wUpdateSpritesEnabled],a call DisplayPartyMenu diff --git a/engine/items/items.asm b/engine/items/items.asm index 24ff544e..fae2a871 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -633,8 +633,8 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld a,[wcf91] ld [wd156],a push af - ld a,$05 ; evolution stone party menu - ld [wd07d],a + ld a,EVO_STONE_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a ld a,$ff ld [wUpdateSpritesEnabled],a call DisplayPartyMenu @@ -678,8 +678,8 @@ ItemUseMedicine: ; dabb (3:5abb) push af ld a,[wcf91] push af - ld a,$01 - ld [wd07d],a ; item use party menu + ld a,USE_ITEM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a ld a,$ff ld [wUpdateSpritesEnabled],a ld a,[wd152] @@ -737,22 +737,22 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,4 add hl,bc ; hl now points to status ld a,[wcf91] - ld bc,$f008 + ld bc, (ANTIDOTE_MSG << 8) | (1 << PSN) cp a,ANTIDOTE jr z,.checkMonStatus - ld bc,$f110 + ld bc, (BURN_HEAL_MSG << 8) | (1 << BRN) cp a,BURN_HEAL jr z,.checkMonStatus - ld bc,$f220 + ld bc, (ICE_HEAL_MSG << 8) | (1 << FRZ) cp a,ICE_HEAL jr z,.checkMonStatus - ld bc,$f307 + ld bc, (AWAKENING_MSG << 8) | SLP cp a,AWAKENING jr z,.checkMonStatus - ld bc,$f440 + ld bc, (PARALYZ_HEAL_MSG << 8) | (1 << PAR) cp a,PARLYZ_HEAL jr z,.checkMonStatus - ld bc,$f6ff ; Full Heal + ld bc, (FULL_HEAL_MSG << 8) | $ff ; Full Heal .checkMonStatus ld a,[hl] ; pokemon's status and c ; does the pokemon have a status ailment the item can cure? @@ -761,7 +761,7 @@ ItemUseMedicine: ; dabb (3:5abb) xor a ld [hl],a ; remove the status ailment in the party data ld a,b - ld [wd07d],a ; the message to display for the item used + ld [wPartyMenuTypeOrMessageID],a ; the message to display for the item used ld a,[wPlayerMonNumber] cp d ; is pokemon the item was used on active in battle? jp nz,.doneHealing @@ -1078,15 +1078,15 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[hFlags_0xFFF6] res 0,a ld [hFlags_0xFFF6],a - ld a,$f7 ; revived message - ld [wd07d],a + ld a,REVIVE_MSG + ld [wPartyMenuTypeOrMessageID],a ld a,[wcf91] cp a,REVIVE jr z,.showHealingItemMessage cp a,MAX_REVIVE jr z,.showHealingItemMessage - ld a,$f5 ; standard HP healed message - ld [wd07d],a + ld a,POTION_MSG + ld [wPartyMenuTypeOrMessageID],a jr .showHealingItemMessage .playStatusAilmentCuringSound ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound @@ -1257,8 +1257,8 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[hl] adc b ld [hl],a - ld a,$f8 ; level up message - ld [wd07d],a + ld a,RARE_CANDY_MSG + ld [wPartyMenuTypeOrMessageID],a call RedrawPartyMenu pop de ld a,d @@ -1878,8 +1878,8 @@ ItemUsePPRestore: ; e31e (3:631e) .chooseMon xor a ld [wUpdateSpritesEnabled],a - ld a,$01 ; item use party menu - ld [wd07d],a + ld a,USE_ITEM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a call DisplayPartyMenu jr nc,.chooseMove jp .itemNotUsed @@ -2118,8 +2118,8 @@ ItemUseTMHM: ; e479 (3:6479) call CopyData ld a,$ff ld [wUpdateSpritesEnabled],a - ld a,$03 ; teach TM/HM party menu - ld [wd07d],a + ld a,TMHM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a call DisplayPartyMenu push af ld hl,wd036 @@ -2650,8 +2650,8 @@ SendNewMonToBox: ; e7a4 (3:67a4) jr nz, .asm_e817 .asm_e82a ld hl, wBoxMonNicks - ld a, $2 - ld [wd07d], a + ld a, NAME_MON_SCREEN + ld [wNamingScreenType], a predef AskName ld a, [W_NUMINBOX] dec a diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index f77f7331..9bdfbee2 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -27,8 +27,8 @@ AskName: ; 64eb (1:64eb) xor a ld [wUpdateSpritesEnabled], a push hl - ld a, $2 - ld [wd07d], a + ld a, NAME_MON_SCREEN + ld [wNamingScreenType], a call DisplayNamingScreen ld a, [W_ISINBATTLE] and a @@ -53,12 +53,12 @@ DoYouWantToNicknameText: ; 0x6557 TX_FAR _DoYouWantToNicknameText db "@" -Func_655c: ; 655c (1:655c) +DisplayNameRaterScreen: ; 655c (1:655c) ld hl, wHPBarMaxHP xor a ld [wUpdateSpritesEnabled], a - ld a, $2 - ld [wd07d], a + ld a, NAME_MON_SCREEN + ld [wNamingScreenType], a call DisplayNamingScreen call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns @@ -236,8 +236,8 @@ DisplayNamingScreen: ; 6596 (1:6596) cp $e4 ld de, Handakutens jr z, .asm_66e3 - ld a, [wd07d] - cp $2 + ld a, [wNamingScreenType] + cp NAME_MON_SCREEN jr nc, .checkMonNameLength ld a, [wHPBarMaxHP] cp $7 ; max length of player/rival names @@ -377,8 +377,8 @@ Func_680e: ; 680e (1:680e) ld de, wcf4b call PlaceString hlCoord 10, 3 - ld a, [wd07d] - cp $2 + ld a, [wNamingScreenType] + cp NAME_MON_SCREEN jr nc, .asm_6835 ld b, $7 jr .asm_6837 @@ -390,8 +390,8 @@ Func_680e: ; 680e (1:680e) ld [hli], a dec b jr nz, .asm_6839 - ld a, [wd07d] - cp $2 + ld a, [wNamingScreenType] + cp NAME_MON_SCREEN ld a, [wHPBarMaxHP] jr nc, .asm_684b cp $7 @@ -405,8 +405,8 @@ Func_680e: ; 680e (1:680e) ld [wTopMenuItemX], a ld a, $5 ld [wCurrentMenuItem], a - ld a, [wd07d] - cp $2 + ld a, [wNamingScreenType] + cp NAME_MON_SCREEN ld a, $9 jr nc, .asm_6867 ld a, $6 @@ -462,7 +462,7 @@ CalcStringLength: ; 68eb (1:68eb) PrintNamingText: ; 68f8 (1:68f8) hlCoord 0, 1 - ld a, [wd07d] + ld a, [wNamingScreenType] ld de, YourTextString and a jr z, .notNickname diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index 6b365e2b..edd65a81 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -1,4 +1,4 @@ -; [wd07d] = menu type / message ID +; [wPartyMenuTypeOrMessageID] = menu type / message ID ; if less than $F0, it is a menu type ; menu types: ; 00: normal pokemon menu (e.g. Start menu) @@ -25,11 +25,11 @@ DrawPartyMenu_: ; 12cd2 (4:6cd2) callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics RedrawPartyMenu_: ; 12ce3 (4:6ce3) - ld a,[wd07d] - cp a,$04 + ld a,[wPartyMenuTypeOrMessageID] + cp a,SWAP_MONS_PARTY_MENU jp z,.printMessage call ErasePartyMenuCursors - callba SendBlkPacket_PartyMenu ; loads some data to wcf2e + callba SendBlkPacket_PartyMenu hlCoord 3, 0 ld de,wPartySpecies xor a @@ -75,10 +75,10 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) inc hl inc hl .skipUnfilledRightArrow - ld a,[wd07d] ; menu type - cp a,$03 + ld a,[wPartyMenuTypeOrMessageID] ; menu type + cp a,TMHM_PARTY_MENU jr z,.teachMoveMenu - cp a,$05 + cp a,EVO_STONE_PARTY_MENU jr z,.evolutionStoneMenu push hl ld bc,14 ; 14 columns to the right @@ -196,7 +196,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) push af push hl set 6,[hl] ; turn off letter printing delay - ld a,[wd07d] ; message ID + ld a,[wPartyMenuTypeOrMessageID] ; message ID cp a,$F0 jr nc,.printItemUseMessage add a diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 0a940356..d97c3d99 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -12,14 +12,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) jp z,RedisplayStartMenu xor a ld [wMenuItemToSwap],a - ld [wd07d],a + ld [wPartyMenuTypeOrMessageID],a ld [wUpdateSpritesEnabled],a call DisplayPartyMenu jr .checkIfPokemonChosen .loop xor a ld [wMenuItemToSwap],a - ld [wd07d],a + ld [wPartyMenuTypeOrMessageID],a call GoBackToPartyMenu .checkIfPokemonChosen jr nc,.chosePokemon @@ -89,8 +89,8 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) cp a,2 ; is there more than one pokemon in the party? jp c,StartMenu_Pokemon ; if not, no switching call SwitchPartyMon_Stats - ld a,$04 ; swap pokemon positions menu - ld [wd07d],a + ld a,SWAP_MONS_PARTY_MENU + ld [wPartyMenuTypeOrMessageID],a call GoBackToPartyMenu jp .checkIfPokemonChosen .choseStats @@ -747,7 +747,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ret .asm_13661 xor a - ld [wd07d], a + ld [wPartyMenuTypeOrMessageID], a ld a, [wMenuItemToSwap] dec a ld b, a @@ -757,7 +757,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) jr nz, .asm_1367b xor a ld [wMenuItemToSwap], a - ld [wd07d], a + ld [wPartyMenuTypeOrMessageID], a ret .asm_1367b ld a, b @@ -845,7 +845,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld [wWhichTrade], a xor a ld [wMenuItemToSwap], a - ld [wd07d], a + ld [wPartyMenuTypeOrMessageID], a pop de pop hl ret diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index d8043484..49154d13 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -12,8 +12,8 @@ LoadDefaultNamesPlayer: ; 695d (1:695d) jr .asm_6999 .asm_697a ld hl, wPlayerName - xor a - ld [wd07d], a + xor a ; NAME_PLAYER_SCREEN + ld [wNamingScreenType], a call DisplayNamingScreen ld a, [wcf4b] cp $50 @@ -45,8 +45,8 @@ LoadDefaultNamesRival: ; 69a4 (1:69a4) jr .asm_69e1 .asm_69c1 ld hl, W_RIVALNAME - ld a, $1 - ld [wd07d], a + ld a, NAME_RIVAL_SCREEN + ld [wNamingScreenType], a call DisplayNamingScreen ld a, [wcf4b] cp $50 diff --git a/home.asm b/home.asm index f7da6e3a..b76713bf 100644 --- a/home.asm +++ b/home.asm @@ -456,7 +456,7 @@ HandlePartyMenuInput:: ; 145a (0:145a) callba ErasePartyMenuCursors xor a ld [wMenuItemToSwap],a - ld [wd07d],a + ld [wPartyMenuTypeOrMessageID],a call RedrawPartyMenu jr HandlePartyMenuInput .handleSwap diff --git a/main.asm b/main.asm index 3a1e0621..d3e2f404 100755 --- a/main.asm +++ b/main.asm @@ -3582,8 +3582,8 @@ _AddPartyMon: ; f2e5 (3:72e5) ld a, [$ffe4] dec a call SkipFixedLengthTextEntries - ld a, $2 - ld [wd07d], a + ld a, NAME_MON_SCREEN + ld [wNamingScreenType], a predef AskName .asm_f33f ld hl, wPartyMons diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index f48584dc..5e80a10f 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -25,7 +25,7 @@ DayCareMText1: ; 56254 (15:6254) call PrintText xor a ld [wUpdateSpritesEnabled], a - ld [wd07d], a + ld [wPartyMenuTypeOrMessageID], a ld [wMenuItemToSwap], a call DisplayPartyMenu push af diff --git a/scripts/namerater.asm b/scripts/namerater.asm index 010dc0cd..c2d028ef 100755 --- a/scripts/namerater.asm +++ b/scripts/namerater.asm @@ -49,7 +49,7 @@ NameRaterText1: ; 1da56 (7:5a56) ld hl, NameRaterText_1dab8 call PrintText xor a - ld [wd07d], a + ld [wPartyMenuTypeOrMessageID], a ld [wUpdateSpritesEnabled], a ld [wMenuItemToSwap], a call DisplayPartyMenu @@ -68,7 +68,7 @@ NameRaterText1: ; 1da56 (7:5a56) jr nz, .asm_1daae ld hl, NameRaterText_1dac2 call PrintText - callba Func_655c + callba DisplayNameRaterScreen jr c, .asm_1daae ld hl, NameRaterText_1dac7 .asm_1daa8 diff --git a/wram.asm b/wram.asm index c1002fcd..13853b55 100755 --- a/wram.asm +++ b/wram.asm @@ -1232,7 +1232,13 @@ W_ANIMATIONID:: ; d07c ; ID number of the current battle animation ds 1 -wd07d:: ds 1 ; used with naming functions and party display type +wNamingScreenType:: ; d07d + +wPartyMenuTypeOrMessageID:: ; d07d + +wTempTilesetNumTiles:: ; d07d +; temporary storage for the number of tiles in a tileset + ds 1 wSavedListScrollOffset:: ; d07e ; used by the pokemart code to save the existing value of wListScrollOffset -- cgit v1.3.1-sl0p