From cd649184f556db777d592671a7274bfa4a8423d7 Mon Sep 17 00:00:00 2001 From: "U-Daniel-PC\\Daniel" Date: Fri, 3 Jul 2015 14:37:53 -0500 Subject: Rename/organize part 1 of 4 rename functions, clean up address/wram comments, other misc only broken up so that all changes are viewable on github --- engine/items/items.asm | 114 ++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 21e6e924..ea4b7403 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -115,7 +115,7 @@ ItemUseBall: ; d687 (3:5687) ld a,[W_NUMINBOX] ;is Box full? cp a,MONS_PER_BOX jp z,BoxFullCannotThrowBall -.UseBall ;$56a7 +.UseBall ;ok, you can use a ball xor a ld [wd11c],a @@ -126,7 +126,7 @@ ItemUseBall: ; d687 (3:5687) ; remove a Safari Ball from inventory ld hl,W_NUMSAFARIBALLS dec [hl] -.skipSafariZoneCode ;$56b6 +.skipSafariZoneCode call GoPAL_SET_CF1C ld a,$43 ld [wd11e],a @@ -144,8 +144,8 @@ ItemUseBall: ; d687 (3:5687) ld de,wPlayerName ld bc,11 call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno glitch) - jp .BallSuccess ;$578b -.notOldManBattle ;$56e9 + jp .BallSuccess +.notOldManBattle ld a,[W_CURMAP] cp a,POKEMONTOWER_6 jr nz,.loop @@ -155,13 +155,13 @@ ItemUseBall: ; d687 (3:5687) jp z,.next12 ; if not fighting ghost Marowak, loop until a random number in the current ; pokeball's allowed range is found -.loop ;$56fa +.loop call Random ld b,a ld hl,wcf91 ld a,[hl] cp a,MASTER_BALL - jp z,.BallSuccess ;$578b + jp z,.BallSuccess cp a,POKE_BALL jr z,.checkForAilments ld a,200 @@ -173,7 +173,7 @@ ItemUseBall: ; d687 (3:5687) ld a,150 ;get only numbers <= 150 for Ultra Ball cp b jr c,.loop -.checkForAilments ;$571a +.checkForAilments ; pokemon can be caught more easily with any (primary) status ailment ; Frozen/Asleep pokemon are relatively even easier to catch ; for Frozen/Asleep pokemon, any random number from 0-24 ensures a catch. @@ -185,12 +185,12 @@ ItemUseBall: ; d687 (3:5687) ld c,12 jr z,.notFrozenOrAsleep ld c,25 -.notFrozenOrAsleep ;$5728 +.notFrozenOrAsleep ld a,b sub c - jp c,.BallSuccess ;$578b + jp c,.BallSuccess ld b,a -.noAilments ;$572e +.noAilments push bc ;save RANDOM number xor a ld [H_MULTIPLICAND],a @@ -207,7 +207,7 @@ ItemUseBall: ; d687 (3:5687) ld a,12 ;any other BallFactor jr nz,.next7 ld a,8 -.next7 ;$574d +.next7 ld [H_DIVISOR],a ld b,4 ; number of bytes in dividend call Divide @@ -226,7 +226,7 @@ ItemUseBall: ; d687 (3:5687) and a jr nz,.next8 inc a -.next8 ;$5766 +.next8 ld [H_DIVISOR],a ld b,4 call Divide ; ((MaxHP * 255) / BallFactor) / (CurHP / 4) @@ -235,7 +235,7 @@ ItemUseBall: ; d687 (3:5687) jr z,.next9 ld a,255 ld [H_QUOTIENT + 3],a -.next9 ;$5776 +.next9 pop bc ld a,[wEnemyMonCatchRate] ;enemy: Catch Rate cp b @@ -248,9 +248,9 @@ ItemUseBall: ; d687 (3:5687) ld a,[H_QUOTIENT + 3] cp b jr c,.next10 -.BallSuccess ;$578b +.BallSuccess jr .BallSuccess2 -.next10 ;$578d +.next10 ld a,[H_QUOTIENT + 3] ld [wd11e],a xor a @@ -271,7 +271,7 @@ ItemUseBall: ; d687 (3:5687) ld b,150 cp a,ULTRA_BALL jr z,.next11 -.next11 ;$57b8 +.next11 ld a,b ld [H_DIVISOR],a ld b,4 @@ -294,11 +294,11 @@ ItemUseBall: ; d687 (3:5687) ld b,5 jr z,.next14 ld b,10 -.next14 ;$57e6 +.next14 ld a,[H_QUOTIENT + 3] add b ld [H_QUOTIENT + 3],a -.next13 ;$57eb +.next13 ld a,[H_QUOTIENT + 3] cp a,10 ld b,$20 @@ -310,10 +310,10 @@ ItemUseBall: ; d687 (3:5687) ld b,$62 jr c,.next12 ld b,$63 -.next12 ;$5801 +.next12 ld a,b ld [wd11e],a -.BallSuccess2 ;$5805 +.BallSuccess2 ld c,20 call DelayFrames ld a,TOSS_ANIM @@ -362,14 +362,14 @@ ItemUseBall: ; d687 (3:5687) ld a,$4c ld [wEnemyMonSpecies2],a jr .next16 -.next15 ;$5871 +.next15 set Transformed,[hl] ld hl,wcceb ld a,[wEnemyMonDVs] ld [hli],a ld a,[wEnemyMonDVs + 1] ld [hl],a -.next16 ;$587e +.next16 ld a,[wcf91] push af ld a,[wEnemyMonSpecies2] @@ -419,7 +419,7 @@ ItemUseBall: ; d687 (3:5687) ld a,[wEnemyMonSpecies] ;caught mon_ID ld [wd11e],a predef ShowPokedexData -.checkParty ;$58f4 +.checkParty ld a,[wPartyCount] cp a,PARTY_LENGTH ;is party full? jr z,.sendToBox @@ -428,7 +428,7 @@ ItemUseBall: ; d687 (3:5687) call ClearSprites call AddPartyMon ;add mon to Party jr .End -.sendToBox ;$5907 +.sendToBox call ClearSprites call SendNewMonToBox ld hl,ItemUseBallText07 @@ -436,22 +436,22 @@ ItemUseBall: ; d687 (3:5687) bit 0,a ;already met Bill? jr nz,.sendToBox2 ld hl,ItemUseBallText08 -.sendToBox2 ;$591a +.sendToBox2 call PrintText jr .End -.printText1 ;$591f +.printText1 ld hl,ItemUseBallText05 -.printText0 ;$5922 +.printText0 call PrintText call ClearSprites -.End ;$5928 +.End ld a,[W_BATTLETYPE] and a ret nz ld hl,wNumBagItems inc a ld [wcf96],a - jp RemoveItemFromInventory ;remove ITEM (XXX) + jp RemoveItemFromInventory ItemUseBallText00: ; d937 (3:5937) ;"It dodged the thrown ball!" ;"This pokemon can't be caught" @@ -645,8 +645,8 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld a,$01 ld [wccd4],a ld a,(SFX_02_3e - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound - call WaitForSoundToFinish ; wait for sound to end + call PlaySoundWaitForCurrent + call WaitForSoundToFinish callab TryEvolvingMon ; try to evolve pokemon ld a,[wd121] and a @@ -918,7 +918,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,2 * 20 call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled ld a,(SFX_02_3d - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a ld [hFlags_0xFFF6],a @@ -1068,7 +1068,7 @@ ItemUseMedicine: ; dabb (3:5abb) cp a,FULL_HEAL jr z,.playStatusAilmentCuringSound ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a ld [hFlags_0xFFF6],a @@ -1179,7 +1179,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,10 call CopyData ; copy the stat's name to wcf4b ld a,(SFX_02_3e - SFX_Headers_02) / 3 - call PlaySound ; play sound + call PlaySound ld hl,VitaminStatRoseText call PrintText jp RemoveUsedItem @@ -1722,7 +1722,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215) call PlaySound ; turn off music ld a, (SFX_02_5e - SFX_Headers_02) / 3 ld c, BANK(SFX_02_5e) - call PlayMusic ; play music + call PlayMusic .musicWaitLoop ; wait for music to finish playing ld a,[wc028] cp a,$b8 @@ -1747,7 +1747,7 @@ OldRodCode: ; e24c (3:624c) jp c, ItemUseNotTime ld bc, (5 << 8) | MAGIKARP ld a, $1 ; set bite - jr RodResponse ; 0xe257 $34 + jr RodResponse GoodRodCode: ; e259 (3:6259) call FishingInit @@ -1780,7 +1780,7 @@ INCLUDE "data/good_rod.asm" SuperRodCode: ; e283 (3:6283) call FishingInit jp c, ItemUseNotTime - call ReadSuperRodData ; 0xe8ea + call ReadSuperRodData ld a, e RodResponse: ; e28d (3:628d) ld [wWhichTrade], a @@ -1825,7 +1825,7 @@ FishingInit: ; e2b4 (3:62b4) ld hl,ItemUseText00 call PrintText ld a,(SFX_02_3e - SFX_Headers_02) / 3 - call PlaySound ; play sound + call PlaySound ld c,80 call DelayFrames and a @@ -1848,9 +1848,9 @@ ItemUseItemfinder: ; e2e1 (3:62e1) ld c,4 .loop ld a,(SFX_02_4a - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent ld a,(SFX_02_5a - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent dec c jr nz,.loop ld hl,ItemfinderFoundItemText @@ -2147,7 +2147,7 @@ ItemUseTMHM: ; e479 (3:6479) jr nz,.checkIfAlreadyLearnedMove ; if the pokemon can't learn the move ld a,(SFX_02_51 - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent ld hl,MonCannotLearnMachineMoveText call PrintText jr .chooseMon @@ -2187,7 +2187,7 @@ PrintItemUseTextAndRemoveItem: ; e563 (3:6563) ld hl,ItemUseText00 call PrintText ld a,(SFX_02_3e - SFX_Headers_02) / 3 - call PlaySound ; play sound + call PlaySound call WaitForTextScrollButtonPress ; wait for button press RemoveUsedItem: ; e571 (3:6571) @@ -2568,7 +2568,7 @@ IsKeyItem_: ; e764 (3:6764) INCLUDE "data/key_items.asm" SendNewMonToBox: ; e7a4 (3:67a4) - ld de, W_NUMINBOX ; wda80 + ld de, W_NUMINBOX ld a, [de] inc a ld [de], a @@ -2587,7 +2587,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) call GetMonHeader ld hl, wBoxMonOT ld bc, $b - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a jr z, .asm_e7ee dec a @@ -2598,7 +2598,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld d, h ld e, l pop hl - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a ld b, a .asm_e7db @@ -2615,11 +2615,11 @@ SendNewMonToBox: ; e7a4 (3:67a4) dec b jr nz, .asm_e7db .asm_e7ee - ld hl, wPlayerName ; wd158 + ld hl, wPlayerName ld de, wBoxMonOT ld bc, $b call CopyData - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a jr z, .asm_e82a ld hl, wBoxMonNicks @@ -2632,7 +2632,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld d, h ld e, l pop hl - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a ld b, a .asm_e817 @@ -2653,7 +2653,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld a, $2 ld [wd07d], a predef AskName - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a jr z, .asm_e867 ld hl, wBoxMons @@ -2666,7 +2666,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld d, h ld e, l pop hl - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] dec a ld b, a .asm_e854 @@ -2683,13 +2683,13 @@ SendNewMonToBox: ; e7a4 (3:67a4) dec b jr nz, .asm_e854 .asm_e867 - ld a, [wEnemyMonLevel] ; wEnemyMonLevel + ld a, [wEnemyMonLevel] ld [wEnemyMonBoxLevel], a ld hl, wEnemyMon ld de, wBoxMon1 ld bc, $c call CopyData - ld hl, wPlayerID ; wPlayerID + ld hl, wPlayerID ld a, [hli] ld [de], a inc de @@ -2697,11 +2697,11 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld [de], a inc de push de - ld a, [W_CURENEMYLVL] ; W_CURENEMYLVL + ld a, [W_CURENEMYLVL] ld d, a callab CalcExperience pop de - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) ld [de], a inc de ld a, [$ff97] @@ -2723,7 +2723,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) inc de ld a, [hli] ld [de], a - ld hl, wEnemyMonPP ; wcffe + ld hl, wEnemyMonPP ld b, $4 .asm_e8b1 ld a, [hli] @@ -2777,7 +2777,7 @@ ReadSuperRodData: ; e8ea (3:68ea) ld e, $2 ; $2 if no fishing groups found ret -.ReadFishingGroup ; 0xe8f6 +.ReadFishingGroup ; hl points to the fishing group entry in the index inc hl ; skip map id @@ -2790,7 +2790,7 @@ ReadSuperRodData: ; e8ea (3:68ea) inc hl ; point to data ld e, $0 ; no bite yet -.RandomLoop ; 0xe90c +.RandomLoop call Random srl a ret c ; 50% chance of no battle -- cgit v1.2.3 From 4a8c9993ad182296131ef87111e1b6d6e2af4201 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jul 2015 23:00:48 -0700 Subject: named wram variables --- engine/items/items.asm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index ea4b7403..24ff544e 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -450,7 +450,7 @@ ItemUseBall: ; d687 (3:5687) ret nz ld hl,wNumBagItems inc a - ld [wcf96],a + ld [wItemQuantity],a jp RemoveItemFromInventory ItemUseBallText00: ; d937 (3:5937) ;"It dodged the thrown ball!" @@ -655,7 +655,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld [wWhichPokemon],a ld hl,wNumBagItems ld a,1 ; remove 1 stone - ld [wcf96],a + ld [wItemQuantity],a jp RemoveItemFromInventory .noEffect call ItemUseNoEffect @@ -2193,7 +2193,7 @@ PrintItemUseTextAndRemoveItem: ; e563 (3:6563) RemoveUsedItem: ; e571 (3:6571) ld hl,wNumBagItems ld a,1 ; one item - ld [wcf96],a ; store quantity + ld [wItemQuantity],a jp RemoveItemFromInventory ItemUseNoEffect: ; e57c (3:657c) @@ -2464,7 +2464,7 @@ GetSelectedMoveOffset2: ; e6e9 (3:66e9) ; hl = address of inventory (either wNumBagItems or wNumBoxItems) ; [wcf91] = item ID ; [wWhichPokemon] = index of item within inventory -; [wcf96] = quantity to toss +; [wItemQuantity] = quantity to toss ; OUTPUT: ; clears carry flag if the item is tossed, sets carry flag if not TossItem_: ; e6f1 (3:66f1) @@ -2475,7 +2475,7 @@ TossItem_: ; e6f1 (3:66f1) jr c,.tooImportantToToss push hl call IsKeyItem_ - ld a,[wd124] + ld a,[wIsKeyItem] pop hl and a jr nz,.tooImportantToToss @@ -2491,11 +2491,11 @@ TossItem_: ; e6f1 (3:66f1) ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu - ld a,[wd12e] - cp a,2 + ld a,[wMenuExitMethod] + cp a,CHOSE_SECOND_ITEM pop hl scf - ret z + ret z ; return if the player chose No ; if the player chose Yes push hl ld a,[wWhichPokemon] @@ -2533,12 +2533,12 @@ TooImportantToTossText: ; e75f (3:675f) ; INPUT: ; [wcf91] = item ID ; OUTPUT: -; [wd124] = result +; [wIsKeyItem] = result ; 00: item is not key item ; 01: item is key item IsKeyItem_: ; e764 (3:6764) ld a,$01 - ld [wd124],a + ld [wIsKeyItem],a ld a,[wcf91] cp a,HM_01 ; is the item an HM or TM? jr nc,.checkIfItemIsHM @@ -2562,7 +2562,7 @@ IsKeyItem_: ; e764 (3:6764) call IsItemHM ret c xor a - ld [wd124],a + ld [wIsKeyItem],a ret INCLUDE "data/key_items.asm" -- cgit v1.2.3 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 --- engine/items/items.asm | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'engine/items/items.asm') 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 -- cgit v1.2.3 From b1cb3788938fa981e65619f022a41f1c1d91ae3b Mon Sep 17 00:00:00 2001 From: dannye Date: Tue, 14 Jul 2015 03:46:23 -0500 Subject: Comment naming screen also use more joypad constants --- engine/items/items.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index fae2a871..8d6037eb 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -643,7 +643,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld a,b ld [wcf91],a ld a,$01 - ld [wccd4],a + ld [wForceEvolution],a ld a,(SFX_02_3e - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent call WaitForSoundToFinish @@ -1275,7 +1275,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wcc49],a predef LearnMoveFromLevelUp ; learn level up move, if any xor a - ld [wccd4],a + ld [wForceEvolution],a callab TryEvolvingMon ; evolve pokemon, if appropriate ld a,$01 ld [wUpdateSpritesEnabled],a -- cgit v1.2.3 From 01631a2e5910b5334ba0f7cc534bc5d7e5b60ccc Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 14:32:49 -0700 Subject: player animations, emotion bubbles, etc. --- engine/items/items.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 8d6037eb..c632f57d 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1783,7 +1783,7 @@ SuperRodCode: ; e283 (3:6283) call ReadSuperRodData ld a, e RodResponse: ; e28d (3:628d) - ld [wWhichTrade], a + ld [wRodResponse], a dec a ; is there a bite? jr nz, .next @@ -1801,7 +1801,7 @@ RodResponse: ; e28d (3:628d) push af push hl ld [hl], 0 - callba Func_707b6 + callba FishingAnim pop hl pop af ld [hl], a -- cgit v1.2.3 From 994c2cbf289efa2e23eabf1af96ba62e4f066005 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 23:16:06 -0700 Subject: named wram variables --- engine/items/items.asm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index c632f57d..6ae4e228 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1,6 +1,6 @@ UseItem_: ; d5c7 (3:55c7) ld a,1 - ld [wcd6a],a + ld [wActionResultOrTookBattleTurn],a ; initialise to success value ld a,[wcf91] ;contains item_ID cp a,HM_01 jp nc,ItemUseTMHM @@ -661,7 +661,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) call ItemUseNoEffect .canceledItemUse xor a - ld [wcd6a],a + ld [wActionResultOrTookBattleTurn],a ; item not used pop af ret @@ -691,7 +691,7 @@ ItemUseMedicine: ; dabb (3:5abb) .emptyParty ld hl,.emptyPartyText xor a - ld [wcd6a],a ; item use failed + ld [wActionResultOrTookBattleTurn],a ; item use failed jp PrintText .emptyPartyText text "You don't have" @@ -706,7 +706,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[wWhichPokemon] call AddNTimes ld a,[wWhichPokemon] - ld [wcf06],a + ld [wUsedItemOnWhichPokemon],a ld d,a ld a,[wcf91] ld e,a @@ -803,7 +803,7 @@ ItemUseMedicine: ; dabb (3:5abb) push hl push de push bc - ld a,[wcf06] + ld a,[wUsedItemOnWhichPokemon] ld c,a ld hl,wPartyFoughtCurrentEnemyFlags ld b,$02 @@ -811,7 +811,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,c and a jr z,.next - ld a,[wcf06] + ld a,[wUsedItemOnWhichPokemon] ld c,a ld hl,wPartyGainExpFlags ld b,$01 @@ -1106,7 +1106,7 @@ ItemUseMedicine: ; dabb (3:5abb) jr .done .canceledItemUse xor a - ld [wcd6a],a ; item use failed + ld [wActionResultOrTookBattleTurn],a ; item use failed pop af pop af .done @@ -1384,7 +1384,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf) ld [W_SAFARIZONEENTRANCECURSCRIPT],a inc a ld [wEscapedFromBattle],a - ld [wcd6a],a ; item used + ld [wActionResultOrTookBattleTurn],a ; item used ld a,[wd152] and a ; using Dig? ret nz ; if so, return @@ -1550,7 +1550,7 @@ ItemUseXStat: ; e104 (3:6104) jr nz,.inBattle call ItemUseNotTime ld a,2 - ld [wcd6a],a ; item not used + ld [wActionResultOrTookBattleTurn],a ; item not used ret .inBattle ld hl,W_PLAYERMOVENUM @@ -2043,7 +2043,7 @@ ItemUsePPRestore: ; e31e (3:631e) call GoPAL_SET_CF1C pop af xor a - ld [wcd6a],a ; item use failed + ld [wActionResultOrTookBattleTurn],a ; item use failed ret RaisePPWhichTechniqueText: ; e45d (3:645d) @@ -2104,7 +2104,7 @@ ItemUseTMHM: ; e479 (3:6479) and a jr z,.useMachine ld a,2 - ld [wcd6a],a ; item not used + ld [wActionResultOrTookBattleTurn],a ; item not used ret .useMachine ld a,[wWhichPokemon] @@ -2234,7 +2234,7 @@ SurfingAttemptFailed: ; e5b6 (3:65b6) ItemUseFailed: ; e5b9 (3:65b9) xor a - ld [wcd6a],a ; item use failed + ld [wActionResultOrTookBattleTurn],a ; item use failed jp PrintText ItemUseNotTimeText: ; e5c0 (3:65c0) @@ -2301,13 +2301,13 @@ RestoreBonusPP: ; e606 (3:6606) ld a,[wWhichPokemon] call AddNTimes push hl - ld de,wcd78 - 1 - predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wcd78 + ld de,wNormalMaxPPList - 1 + predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList pop hl ld c,21 ld b,0 add hl,bc ; hl now points to move 1 PP - ld de,wcd78 + ld de,wNormalMaxPPList ld b,0 ; initialize move counter to zero ; loop through the pokemon's moves .loop @@ -2420,7 +2420,7 @@ GetMaxPP: ; e677 (3:6677) ld de,wcd6d ld a,BANK(Moves) call FarCopyData - ld de,wcd72 + ld de,wcd6d + 5 ; PP is byte 5 of move data ld a,[de] ld b,a ; b = normal max PP pop hl -- cgit v1.2.3 From bd7d9815936decc5b636f4235c0ee745812dcb48 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 15 Jul 2015 20:04:58 -0700 Subject: menu stuff --- engine/items/items.asm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 6ae4e228..b65e8f1e 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -423,8 +423,8 @@ ItemUseBall: ; d687 (3:5687) ld a,[wPartyCount] cp a,PARTY_LENGTH ;is party full? jr z,.sendToBox - xor a - ld [wcc49],a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call ClearSprites call AddPartyMon ;add mon to Party jr .End @@ -1265,14 +1265,14 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wWhichPokemon],a ld a,e ld [wd11e],a - xor a - ld [wcc49],a ; load from player's party + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call LoadMonData ld d,$01 callab PrintStatsBox ; display new stats text box call WaitForTextScrollButtonPress ; wait for button press - xor a - ld [wcc49],a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a predef LearnMoveFromLevelUp ; learn level up move, if any xor a ld [wForceEvolution],a @@ -1963,8 +1963,8 @@ ItemUsePPRestore: ; e31e (3:631e) ; unsets zero flag if PP was restored, sets zero flag if not ; however, this is bugged for Max Ethers and Max Elixirs (see below) .restorePP - xor a - ld [wcc49],a ; party pokemon + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call GetMaxPP ld hl,wPartyMon1Moves ld bc,44 @@ -2379,7 +2379,7 @@ AddBonusPP: ; e642 (3:6642) ; gets max PP of a pokemon's move (including PP from PP Ups) ; INPUT: ; [wWhichPokemon] = index of pokemon within party/box -; [wcc49] = pokemon source +; [wMonDataLocation] = pokemon source ; 00: player's party ; 01: enemy's party ; 02: current box @@ -2389,7 +2389,7 @@ AddBonusPP: ; e642 (3:6642) ; OUTPUT: ; [wd11e] = max PP GetMaxPP: ; e677 (3:6677) - ld a,[wcc49] + ld a,[wMonDataLocation] and a ld hl,wPartyMon1Moves ld bc,wPartyMon2 - wPartyMon1 @@ -2426,7 +2426,7 @@ GetMaxPP: ; e677 (3:6677) pop hl push bc ld bc,21 ; PP offset if not player's in-battle pokemon data - ld a,[wcc49] + ld a,[wMonDataLocation] cp a,4 ; player's in-battle pokemon? jr nz,.addPPOffset ld bc,17 ; PP offset if player's in-battle pokemon data -- cgit v1.2.3 From fc9af362ae65d24c66b39ea7759637cc9c1f9b0a Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 18 Jul 2015 08:17:29 -0700 Subject: fix variable naming --- engine/items/items.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index b65e8f1e..7617ba6c 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -556,11 +556,11 @@ ItemUseSurfboard: ; d9b4 (3:59b4) jp PrintText .tryToStopSurfing xor a - ld [$ff8c],a + ld [hSpriteIndexOrTextID],a ld d,16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 res 7,[hl] - ld a,[$ff8c] + ld a,[hSpriteIndexOrTextID] and a ; is there a sprite in the way? jr nz,.cannotStopSurfing ld hl,TilePairCollisionsWater -- cgit v1.2.3 From 148d3f3cf28f9c270e3d5043af0692d95bc731c5 Mon Sep 17 00:00:00 2001 From: dannye Date: Sat, 18 Jul 2015 15:52:03 -0500 Subject: Consolidate coord macros --- engine/items/items.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 7617ba6c..bd19c152 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -913,7 +913,7 @@ ItemUseMedicine: ; dabb (3:5abb) sbc b ld [hl],a ld [wHPBarNewHP+1],a - hlCoord 4, 1 + coord hl, 4, 1 ld a,[wWhichPokemon] ld bc,2 * 20 call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled @@ -2095,7 +2095,7 @@ ItemUseTMHM: ; e479 (3:6479) call PrintText ld hl,TeachMachineMoveText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a @@ -2486,7 +2486,7 @@ TossItem_: ; e6f1 (3:66f1) call CopyStringToCF4B ; copy name to wcf4b ld hl,IsItOKToTossItemText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a -- cgit v1.2.3 From b96ef8d2d495b8c39f703742e8c1965c774fc54f Mon Sep 17 00:00:00 2001 From: dannye Date: Sat, 18 Jul 2015 23:53:43 -0500 Subject: A few missed TX_ASM --- engine/items/items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index bd19c152..fe2d71c8 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1713,7 +1713,7 @@ FluteWokeUpText: ; e210 (3:6210) PlayedFluteHadEffectText: ; e215 (3:6215) TX_FAR _PlayedFluteHadEffectText db $06 - db $08 + TX_ASM ld a,[W_ISINBATTLE] and a jr nz,.done -- cgit v1.2.3 From c169073eed4f0362ef42170098a141a2fcbd71d0 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 18 Jul 2015 20:49:52 -0700 Subject: misc --- engine/items/items.asm | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index fe2d71c8..bc8d16fa 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1216,11 +1216,11 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,-19 add hl,bc ; hl now points to experience ; update experience to minimum for new level - ld a,[$ff96] + ld a,[hExperience] ld [hli],a - ld a,[$ff97] + ld a,[hExperience + 1] ld [hli],a - ld a,[$ff98] + ld a,[hExperience + 2] ld [hl],a pop hl ld a,[wWhichPokemon] @@ -1618,8 +1618,8 @@ ItemUsePokeflute: ; e140 (3:6140) jp PrintText .inBattle xor a - ld [wWhichTrade],a ; initialize variable that indicates if any pokemon were woken up to zero - ld b,~SLP & $FF + ld [wWereAnyMonsAsleep],a + ld b,~SLP & $ff ld hl,wPartyMon1Status call WakeUpEntireParty ld a,[W_ISINBATTLE] @@ -1638,7 +1638,7 @@ ItemUsePokeflute: ; e140 (3:6140) and b ; remove Sleep status ld [hl],a call LoadScreenTilesFromBuffer2 ; restore saved screen - ld a,[wWhichTrade] + ld a,[wWereAnyMonsAsleep] and a ; were any pokemon asleep before playing the flute? ld hl,PlayedFluteNoEffectText jp z,PrintText ; if no pokemon were asleep @@ -1662,9 +1662,9 @@ ItemUsePokeflute: ; e140 (3:6140) ; INPUT: ; hl must point to status of first pokemon in party (player's or enemy's) ; b must equal ~SLP -; [wWhichTrade] should be initialized to 0 +; [wWereAnyMonsAsleep] should be initialized to 0 ; OUTPUT: -; [wWhichTrade]: set to 1 if any pokemon were asleep +; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep WakeUpEntireParty: ; e1e5 (3:61e5) ld de,44 ld c,6 @@ -1674,7 +1674,7 @@ WakeUpEntireParty: ; e1e5 (3:61e5) and a,SLP ; is pokemon asleep? jr z,.notAsleep ld a,1 - ld [wWhichTrade],a ; indicate that a pokemon had to be woken up + ld [wWereAnyMonsAsleep],a ; indicate that a pokemon had to be woken up .notAsleep pop af and b ; remove Sleep status @@ -1874,7 +1874,7 @@ ItemUsePPRestore: ; e31e (3:631e) ld a,[wWhichPokemon] push af ld a,[wcf91] - ld [wWhichTrade],a + ld [wPPRestoreItem],a .chooseMon xor a ld [wUpdateSpritesEnabled],a @@ -1884,13 +1884,13 @@ ItemUsePPRestore: ; e31e (3:631e) jr nc,.chooseMove jp .itemNotUsed .chooseMove - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ELIXER jp nc,.useElixir ; if Elixir or Max Elixir ld a,$02 ld [wMoveMenuType],a ld hl,RaisePPWhichTechniqueText - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ETHER ; is it a PP Up? jr c,.printWhichTechniqueMessage ; if so, print the raise PP message ld hl,RestorePPWhichTechniqueText ; otherwise, print the restore PP message @@ -1911,7 +1911,7 @@ ItemUsePPRestore: ; e31e (3:631e) call GetMoveName call CopyStringToCF4B ; copy name to wcf4b pop hl - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ETHER jr nc,.useEther ; if Ether or Max Ether .usePPUp @@ -1973,7 +1973,7 @@ ItemUsePPRestore: ; e31e (3:631e) add hl,bc ; hl now points to move's PP ld a,[wd11e] ld b,a ; b = max PP - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,MAX_ETHER jr z,.fullyRestorePP ld a,[hl] ; move PP @@ -2005,7 +2005,7 @@ ItemUsePPRestore: ; e31e (3:631e) jr .storeNewAmount .useElixir ; decrement the item ID so that ELIXER becomes ETHER and MAX_ELIXER becomes MAX_ETHER - ld hl,wWhichTrade + ld hl,wPPRestoreItem dec [hl] dec [hl] xor a @@ -2701,13 +2701,13 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld d, a callab CalcExperience pop de - ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) + ld a, [hExperience] ld [de], a inc de - ld a, [$ff97] + ld a, [hExperience + 1] ld [de], a inc de - ld a, [$ff98] + ld a, [hExperience + 2] ld [de], a inc de xor a -- cgit v1.2.3 From ea9cc86949cecc3508aeac06b807372b6b0134d8 Mon Sep 17 00:00:00 2001 From: dannye Date: Sun, 19 Jul 2015 03:46:12 -0500 Subject: Name sound effects --- engine/items/items.asm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index fe2d71c8..69e8b4bf 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -644,7 +644,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld [wcf91],a ld a,$01 ld [wForceEvolution],a - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySoundWaitForCurrent call WaitForSoundToFinish callab TryEvolvingMon ; try to evolve pokemon @@ -917,7 +917,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[wWhichPokemon] ld bc,2 * 20 call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled - ld a,(SFX_02_3d - SFX_Headers_02) / 3 + ld a,SFX_HEAL_HP call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a @@ -1067,7 +1067,7 @@ ItemUseMedicine: ; dabb (3:5abb) jr c,.playStatusAilmentCuringSound cp a,FULL_HEAL jr z,.playStatusAilmentCuringSound - ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound + ld a,SFX_HEAL_HP call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a @@ -1089,7 +1089,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wPartyMenuTypeOrMessageID],a jr .showHealingItemMessage .playStatusAilmentCuringSound - ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound + ld a,SFX_HEAL_AILMENT call PlaySoundWaitForCurrent .showHealingItemMessage xor a @@ -1178,7 +1178,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld de,wcf4b ld bc,10 call CopyData ; copy the stat's name to wcf4b - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld hl,VitaminStatRoseText call PrintText @@ -1720,7 +1720,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215) ; play out-of-battle pokeflute music ld a,$ff call PlaySound ; turn off music - ld a, (SFX_02_5e - SFX_Headers_02) / 3 + ld a, SFX_POKEFLUE ld c, BANK(SFX_02_5e) call PlayMusic .musicWaitLoop ; wait for music to finish playing @@ -1824,7 +1824,7 @@ FishingInit: ; e2b4 (3:62b4) call ItemUseReloadOverworldData ld hl,ItemUseText00 call PrintText - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld c,80 call DelayFrames @@ -1847,9 +1847,9 @@ ItemUseItemfinder: ; e2e1 (3:62e1) jr nc,.printText ; if no hidden items ld c,4 .loop - ld a,(SFX_02_4a - SFX_Headers_02) / 3 + ld a,SFX_HEALING_MACHINE call PlaySoundWaitForCurrent - ld a,(SFX_02_5a - SFX_Headers_02) / 3 + ld a,SFX_PURCHASE call PlaySoundWaitForCurrent dec c jr nz,.loop @@ -1951,7 +1951,7 @@ ItemUsePPRestore: ; e31e (3:631e) ld bc,4 call CopyData ; copy party data to in-battle data .skipUpdatingInBattleData - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld hl,PPRestoredText call PrintText @@ -2146,7 +2146,7 @@ ItemUseTMHM: ; e479 (3:6479) and a ; can the pokemon learn the move? jr nz,.checkIfAlreadyLearnedMove ; if the pokemon can't learn the move - ld a,(SFX_02_51 - SFX_Headers_02) / 3 + ld a,SFX_DENIED call PlaySoundWaitForCurrent ld hl,MonCannotLearnMachineMoveText call PrintText @@ -2186,7 +2186,7 @@ MonCannotLearnMachineMoveText: ; e55e (3:655e) PrintItemUseTextAndRemoveItem: ; e563 (3:6563) ld hl,ItemUseText00 call PrintText - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound call WaitForTextScrollButtonPress ; wait for button press -- cgit v1.2.3 From 02bd91b7076165653a900a8e39c12a92a9bd2976 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 19 Jul 2015 11:56:13 -0700 Subject: jpab/jpba macros --- engine/items/items.asm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 704e6034..f9f76278 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -499,9 +499,7 @@ ItemUseTownMap: ; d968 (3:5968) ld a,[W_ISINBATTLE] and a jp nz,ItemUseNotTime - ld b, BANK(DisplayTownMap) - ld hl, DisplayTownMap - jp Bankswitch ; display Town Map + jpba DisplayTownMap ItemUseBicycle: ; d977 (3:5977) ld a,[W_ISINBATTLE] -- cgit v1.2.3 From 1d86932cc9c38815434409f07d14c2bfe4e7a836 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 19 Jul 2015 17:52:26 -0700 Subject: naming --- engine/items/items.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index f9f76278..000940d2 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -591,14 +591,14 @@ ItemUseSurfboard: ; d9b4 (3:59b4) jp LoadWalkingPlayerSpriteGraphics ; uses a simulated button press to make the player move forward .makePlayerMoveForward - ld a,[wd52a] ; direction the player is going - bit 3,a + ld a,[wPlayerDirection] ; direction the player is going + bit PLAYER_DIR_BIT_UP,a ld b,D_UP jr nz,.storeSimulatedButtonPress - bit 2,a + bit PLAYER_DIR_BIT_DOWN,a ld b,D_DOWN jr nz,.storeSimulatedButtonPress - bit 1,a + bit PLAYER_DIR_BIT_LEFT,a ld b,D_LEFT jr nz,.storeSimulatedButtonPress ld b,D_RIGHT -- cgit v1.2.3 From db7d941d22d89cf8d6d13cbf768208c5cf2ac2c2 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 19 Jul 2015 20:45:34 -0700 Subject: constants for flag actions --- engine/items/items.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 000940d2..f2c41ef6 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -400,15 +400,15 @@ ItemUseBall: ; d687 (3:5687) ld a,[wd11e] dec a ld c,a - ld b,2 - ld hl,wPokedexOwned ;Dex_own_flags (pokemon) + ld b,FLAG_TEST + ld hl,wPokedexOwned predef FlagActionPredef ld a,c push af ld a,[wd11e] dec a ld c,a - ld b,1 + ld b,FLAG_SET predef FlagActionPredef pop af and a @@ -804,7 +804,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[wUsedItemOnWhichPokemon] ld c,a ld hl,wPartyFoughtCurrentEnemyFlags - ld b,$02 + ld b,FLAG_TEST predef FlagActionPredef ld a,c and a @@ -812,7 +812,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[wUsedItemOnWhichPokemon] ld c,a ld hl,wPartyGainExpFlags - ld b,$01 + ld b,FLAG_SET predef FlagActionPredef .next pop bc @@ -2550,8 +2550,8 @@ IsKeyItem_: ; e764 (3:6764) dec a ld c,a ld hl,wHPBarMaxHP - ld b,$02 ; test bit - predef FlagActionPredef ; bitfield operation function + ld b,FLAG_TEST + predef FlagActionPredef ld a,c and a ret nz -- cgit v1.2.3 From fcab935a0f449246380480613ac0896e0b90a0d8 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 20 Jul 2015 18:32:02 -0700 Subject: enumerate events --- engine/items/items.asm | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index f2c41ef6..a7c731c2 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -432,8 +432,7 @@ ItemUseBall: ; d687 (3:5687) call ClearSprites call SendNewMonToBox ld hl,ItemUseBallText07 - ld a,[wd7f1] - bit 0,a ;already met Bill? + CheckEvent EVENT_550 jr nz,.sendToBox2 ld hl,ItemUseBallText08 .sendToBox2 @@ -1375,8 +1374,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf) set 6,[hl] ld hl,wd72e res 4,[hl] - ld hl,wd790 - res 7,[hl] ; unset Safari Zone bit + ResetEvent EVENT_IN_SAFARI_ZONE xor a ld [W_NUMSAFARIBALLS],a ld [W_SAFARIZONEENTRANCECURSCRIPT],a @@ -1584,8 +1582,7 @@ ItemUsePokeflute: ; e140 (3:6140) ld a,[W_CURMAP] cp a,ROUTE_12 jr nz,.notRoute12 - ld a,[wd7d8] - bit 7,a ; has the player beaten Route 12 Snorlax yet? + CheckEvent EVENT_BEAT_ROUTE12_SNORLAX jr nz,.noSnorlaxToWakeUp ; if the player hasn't beaten Route 12 Snorlax ld hl,Route12SnorlaxFluteCoords @@ -1593,14 +1590,12 @@ ItemUsePokeflute: ; e140 (3:6140) jr nc,.noSnorlaxToWakeUp ld hl,PlayedFluteHadEffectText call PrintText - ld hl,wd7d8 - set 6,[hl] ; trigger Snorlax fight (handled by map script) + SetEvent EVENT_FIGHT_ROUTE12_SNORLAX ret .notRoute12 cp a,ROUTE_16 jr nz,.noSnorlaxToWakeUp - ld a,[wd7e0] - bit 1,a ; has the player beaten Route 16 Snorlax yet? + CheckEvent EVENT_BEAT_ROUTE16_SNORLAX jr nz,.noSnorlaxToWakeUp ; if the player hasn't beaten Route 16 Snorlax ld hl,Route16SnorlaxFluteCoords @@ -1608,8 +1603,7 @@ ItemUsePokeflute: ; e140 (3:6140) jr nc,.noSnorlaxToWakeUp ld hl,PlayedFluteHadEffectText call PrintText - ld hl,wd7e0 - set 0,[hl] ; trigger Snorlax fight (handled by map script) + SetEvent EVENT_FIGHT_ROUTE16_SNORLAX ret .noSnorlaxToWakeUp ld hl,PlayedFluteNoEffectText -- cgit v1.2.3 From 73171bfff573fa8900563319c014f3e626db6b3e Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 21 Jul 2015 10:36:03 -0700 Subject: named most of the used events --- engine/items/items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index a7c731c2..eb9f5663 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -432,7 +432,7 @@ ItemUseBall: ; d687 (3:5687) call ClearSprites call SendNewMonToBox ld hl,ItemUseBallText07 - CheckEvent EVENT_550 + CheckEvent EVENT_MET_BILL jr nz,.sendToBox2 ld hl,ItemUseBallText08 .sendToBox2 -- cgit v1.2.3 From b4081e851ac4b7ce5cf1fa7c9fc83a490a4c83ec Mon Sep 17 00:00:00 2001 From: dannye Date: Wed, 22 Jul 2015 09:57:31 -0500 Subject: Rename sound effect files --- engine/items/items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index f2c41ef6..a62f75d2 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1719,7 +1719,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215) ld a,$ff call PlaySound ; turn off music ld a, SFX_POKEFLUE - ld c, BANK(SFX_02_5e) + ld c, BANK(SFX_Pokeflute) call PlayMusic .musicWaitLoop ; wait for music to finish playing ld a,[wc028] -- cgit v1.2.3 From bbb86671eaac735fe6ef57da01ef79fd16953238 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 24 Jul 2015 10:49:33 +0200 Subject: Use more wram labels and other constants --- engine/items/items.asm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index a60d765a..bda922e8 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -2417,11 +2417,11 @@ GetMaxPP: ; e677 (3:6677) ld b,a ; b = normal max PP pop hl push bc - ld bc,21 ; PP offset if not player's in-battle pokemon data + ld bc,wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data ld a,[wMonDataLocation] cp a,4 ; player's in-battle pokemon? jr nz,.addPPOffset - ld bc,17 ; PP offset if player's in-battle pokemon data + ld bc,wBattleMonPP - wBattleMonMoves ; PP offset if player's in-battle pokemon data .addPPOffset add hl,bc ld a,[hl] ; a = current PP @@ -2601,7 +2601,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) pop hl ld d, h ld e, l - ld bc, $fff5 + ld bc, -$b add hl, bc pop bc dec b @@ -2635,7 +2635,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) pop hl ld d, h ld e, l - ld bc, $fff5 + ld bc, -$b add hl, bc pop bc dec b @@ -2669,7 +2669,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) pop hl ld d, h ld e, l - ld bc, $ffdf + ld bc, wBoxMon1 - wBoxMon2 add hl, bc pop bc dec b @@ -2679,7 +2679,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld [wEnemyMonBoxLevel], a ld hl, wEnemyMon ld de, wBoxMon1 - ld bc, $c + ld bc, wEnemyMonDVs - wEnemyMon call CopyData ld hl, wPlayerID ld a, [hli] @@ -2703,7 +2703,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld [de], a inc de xor a - ld b, $a + ld b, NUM_STATS * 2 .asm_e89f ld [de], a inc de @@ -2716,7 +2716,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld a, [hli] ld [de], a ld hl, wEnemyMonPP - ld b, $4 + ld b, NUM_MOVES .asm_e8b1 ld a, [hli] inc de -- cgit v1.2.3 From 82512e449115aa9d004e24a3d1526dd32570c56d Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 24 Jul 2015 14:39:45 -0700 Subject: named animation functions/variables --- engine/items/items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index a60d765a..b0013b46 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -319,7 +319,7 @@ ItemUseBall: ; d687 (3:5687) ld a,TOSS_ANIM ld [W_ANIMATIONID],a xor a - ld [$fff3],a + ld [H_WHOSETURN],a ld [wAnimationType],a ld [wDamageMultipliers],a ld a,[wWhichPokemon] -- cgit v1.2.3 From 7f6d0d49b61a77cfba76057d99881634b882486b Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 24 Jul 2015 20:27:59 -0700 Subject: more naming variables --- engine/items/items.asm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index b0013b46..5669f012 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -118,7 +118,7 @@ ItemUseBall: ; d687 (3:5687) .UseBall ;ok, you can use a ball xor a - ld [wd11c],a + ld [wCapturedMonSpecies],a ld a,[W_BATTLETYPE] cp a,2 ;SafariBattle jr nz,.skipSafariZoneCode @@ -388,7 +388,7 @@ ItemUseBall: ; d687 (3:5687) pop af ld [hl],a ld a,[wEnemyMonSpecies] ;enemy - ld [wd11c],a + ld [wCapturedMonSpecies],a ld [wcf91],a ld [wd11e],a ld a,[W_BATTLETYPE] @@ -645,7 +645,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) call PlaySoundWaitForCurrent call WaitForSoundToFinish callab TryEvolvingMon ; try to evolve pokemon - ld a,[wd121] + ld a,[wEvolutionOccurred] and a jr z,.noEffect pop af @@ -2537,13 +2537,13 @@ IsKeyItem_: ; e764 (3:6764) ; if the item is not an HM or TM push af ld hl,KeyItemBitfield - ld de,wHPBarMaxHP + ld de,wBuffer ld bc,15 ; only 11 bytes are actually used call CopyData pop af dec a ld c,a - ld hl,wHPBarMaxHP + ld hl,wBuffer ld b,FLAG_TEST predef FlagActionPredef ld a,c -- cgit v1.2.3 From 93255d6d17fbb3702a0f8670d7ecc2ed627af2a7 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 25 Jul 2015 19:26:54 -0700 Subject: yet more naming --- engine/items/items.asm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 5669f012..7f16691d 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -628,7 +628,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld a,[wWhichPokemon] push af ld a,[wcf91] - ld [wd156],a + ld [wEvoStoneItemID],a push af ld a,EVO_STONE_PARTY_MENU ld [wPartyMenuTypeOrMessageID],a @@ -679,7 +679,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wPartyMenuTypeOrMessageID],a ld a,$ff ld [wUpdateSpritesEnabled],a - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Softboiled? jr z,.notUsingSoftboiled ; if using softboiled @@ -712,7 +712,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wcf91],a pop af ld [wWhichPokemon],a - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Softboiled? jr z,.checkItemType ; if using softboiled @@ -865,7 +865,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wHPBarMaxHP+1],a ld a,[hl] ld [wHPBarMaxHP],a ; max HP stored at wHPBarMaxHP (2 bytes, big-endian) - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Softboiled? jp z,.notUsingSoftboiled2 ; if using softboiled @@ -1052,7 +1052,7 @@ ItemUseMedicine: ; dabb (3:5abb) call ItemUseNoEffect jp .done .doneHealing - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Softboiled? jr nz,.skipRemovingItem ; no item to remove if using Softboiled push hl @@ -1107,7 +1107,7 @@ ItemUseMedicine: ; dabb (3:5abb) pop af pop af .done - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Softboiled? ret nz ; if so, return call GBPalWhiteOut @@ -1381,7 +1381,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf) inc a ld [wEscapedFromBattle],a ld [wActionResultOrTookBattleTurn],a ; item used - ld a,[wd152] + ld a,[wPseudoItemID] and a ; using Dig? ret nz ; if so, return call ItemUseReloadOverworldData @@ -1419,7 +1419,7 @@ ItemUseXAccuracy: ; e013 (3:6013) ; The Card Key is handled in a different way. ItemUseCardKey: ; e022 (3:6022) xor a - ld [wd71f],a + ld [wUnusedD71F],a call GetTileAndCoordsInFrontOfPlayer ld a,[GetTileAndCoordsInFrontOfPlayer] ; $4586 cp a,$18 @@ -1451,7 +1451,7 @@ ItemUseCardKey: ; e022 (3:6022) cp e jr nz,.nextEntry3 ld a,[hl] - ld [wd71f],a + ld [wUnusedD71F],a jr .done .nextEntry1 inc hl -- cgit v1.2.3 From 891627d4ba193dd839e03e9e30f1e492e57eac9f Mon Sep 17 00:00:00 2001 From: dannye Date: Wed, 5 Aug 2015 09:33:32 -0500 Subject: Rename rod functions --- engine/items/items.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 953f953a..2cbe6a02 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -91,9 +91,9 @@ ItemUsePtrTable: ; d5e1 (3:55e1) dw ItemUsePokeflute ; POKE_FLUTE dw UnusableItem ; LIFT_KEY dw UnusableItem ; EXP__ALL - dw OldRodCode ; OLD_ROD - dw GoodRodCode ; GOOD_ROD - dw SuperRodCode ; SUPER_ROD + dw ItemUseOldRod ; OLD_ROD + dw ItemUseGoodRod ; GOOD_ROD + dw ItemUseSuperRod ; SUPER_ROD dw ItemUsePPUp ; PP_UP (real one) dw ItemUsePPRestore ; ETHER dw ItemUsePPRestore ; MAX_ETHER @@ -1734,14 +1734,14 @@ CoinCaseNumCoinsText: ; e247 (3:6247) TX_FAR _CoinCaseNumCoinsText db "@" -OldRodCode: ; e24c (3:624c) +ItemUseOldRod: ; e24c (3:624c) call FishingInit jp c, ItemUseNotTime ld bc, (5 << 8) | MAGIKARP ld a, $1 ; set bite jr RodResponse -GoodRodCode: ; e259 (3:6259) +ItemUseGoodRod: ; e259 (3:6259) call FishingInit jp c,ItemUseNotTime .RandomLoop @@ -1769,7 +1769,7 @@ GoodRodCode: ; e259 (3:6259) INCLUDE "data/good_rod.asm" -SuperRodCode: ; e283 (3:6283) +ItemUseSuperRod: ; e283 (3:6283) call FishingInit jp c, ItemUseNotTime call ReadSuperRodData -- cgit v1.2.3 From f8a9c37a0019eb085c22c6e3ae53b16ff0cd4f6a Mon Sep 17 00:00:00 2001 From: dannye Date: Wed, 5 Aug 2015 16:20:29 -0500 Subject: Use more lb and other clean up --- engine/items/items.asm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 2cbe6a02..364570da 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -734,22 +734,22 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,4 add hl,bc ; hl now points to status ld a,[wcf91] - ld bc, (ANTIDOTE_MSG << 8) | (1 << PSN) + lb bc, ANTIDOTE_MSG, 1 << PSN cp a,ANTIDOTE jr z,.checkMonStatus - ld bc, (BURN_HEAL_MSG << 8) | (1 << BRN) + lb bc, BURN_HEAL_MSG, 1 << BRN cp a,BURN_HEAL jr z,.checkMonStatus - ld bc, (ICE_HEAL_MSG << 8) | (1 << FRZ) + lb bc, ICE_HEAL_MSG, 1 << FRZ cp a,ICE_HEAL jr z,.checkMonStatus - ld bc, (AWAKENING_MSG << 8) | SLP + lb bc, AWAKENING_MSG, SLP cp a,AWAKENING jr z,.checkMonStatus - ld bc, (PARALYZ_HEAL_MSG << 8) | (1 << PAR) + lb bc, PARALYZ_HEAL_MSG, 1 << PAR cp a,PARLYZ_HEAL jr z,.checkMonStatus - ld bc, (FULL_HEAL_MSG << 8) | $ff ; Full Heal + lb bc, FULL_HEAL_MSG, $ff ; Full Heal .checkMonStatus ld a,[hl] ; pokemon's status and c ; does the pokemon have a status ailment the item can cure? @@ -1737,7 +1737,7 @@ CoinCaseNumCoinsText: ; e247 (3:6247) ItemUseOldRod: ; e24c (3:624c) call FishingInit jp c, ItemUseNotTime - ld bc, (5 << 8) | MAGIKARP + lb bc, 5, MAGIKARP ld a, $1 ; set bite jr RodResponse @@ -2088,7 +2088,7 @@ ItemUseTMHM: ; e479 (3:6479) ld hl,TeachMachineMoveText call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu @@ -2479,7 +2479,7 @@ TossItem_: ; e6f1 (3:66f1) ld hl,IsItOKToTossItemText call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu @@ -2578,14 +2578,14 @@ SendNewMonToBox: ; e7a4 (3:67a4) jr nz, .asm_e7b1 call GetMonHeader ld hl, wBoxMonOT - ld bc, $b + ld bc, 11 ld a, [W_NUMINBOX] dec a jr z, .asm_e7ee dec a call AddNTimes push hl - ld bc, $b + ld bc, 11 add hl, bc ld d, h ld e, l @@ -2596,7 +2596,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7db push bc push hl - ld bc, $b + ld bc, 11 call CopyData pop hl ld d, h @@ -2609,17 +2609,17 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7ee ld hl, wPlayerName ld de, wBoxMonOT - ld bc, $b + ld bc, 11 call CopyData ld a, [W_NUMINBOX] dec a jr z, .asm_e82a ld hl, wBoxMonNicks - ld bc, $b + ld bc, 11 dec a call AddNTimes push hl - ld bc, $b + ld bc, 11 add hl, bc ld d, h ld e, l @@ -2630,7 +2630,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e817 push bc push hl - ld bc, $b + ld bc, 11 call CopyData pop hl ld d, h -- cgit v1.2.3 From f658aff5383fa1e22343efc17e4551c6e7685a39 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 7 Aug 2015 05:20:37 -0700 Subject: named wram variables --- engine/items/items.asm | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 364570da..a45b9185 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -312,7 +312,7 @@ ItemUseBall: ; d687 (3:5687) ld b,$63 .next12 ld a,b - ld [wd11e],a + ld [wPokeBallAnimData],a .BallSuccess2 ld c,20 call DelayFrames @@ -331,7 +331,7 @@ ItemUseBall: ; d687 (3:5687) ld [wcf91],a pop af ld [wWhichPokemon],a - ld a,[wd11e] + ld a,[wPokeBallAnimData] cp a,$10 ld hl,ItemUseBallText00 jp z,.printText0 @@ -1895,7 +1895,7 @@ ItemUsePPRestore: ; e31e (3:631e) ld [wPlayerMoveListIndex],a jr nz,.chooseMon ld hl,wPartyMon1Moves - ld bc,44 + ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset push hl ld a,[hl] @@ -1937,7 +1937,7 @@ ItemUsePPRestore: ; e31e (3:631e) cp b ; is the pokemon whose PP was restored active in battle? jr nz,.skipUpdatingInBattleData ld hl,wPartyMon1PP - ld bc,44 + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld de,wBattleMonPP ld bc,4 @@ -1959,12 +1959,12 @@ ItemUsePPRestore: ; e31e (3:631e) ld [wMonDataLocation],a call GetMaxPP ld hl,wPartyMon1Moves - ld bc,44 + ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset - ld bc,21 + ld bc, wPartyMon1PP - wPartyMon1Moves add hl,bc ; hl now points to move's PP - ld a,[wd11e] - ld b,a ; b = max PP + ld a,[wMaxPP] + ld b,a ld a,[wPPRestoreItem] cp a,MAX_ETHER jr z,.fullyRestorePP @@ -2009,7 +2009,7 @@ ItemUsePPRestore: ; e31e (3:631e) .elixirLoop push bc ld hl,wPartyMon1Moves - ld bc,44 + ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset ld a,[hl] and a ; does the current slot have a move? @@ -2283,20 +2283,17 @@ GotOffBicycleText: ; e5fc (3:65fc) ; also, when a PP Up is used, it increases the current PP by one PP Up bonus ; INPUT: ; [wWhichPokemon] = index of pokemon in party -; [wd11e] = mode -; 0: Pokemon Center healing -; 1: using a PP Up ; [wCurrentMenuItem] = index of move (when using a PP Up) RestoreBonusPP: ; e606 (3:6606) ld hl,wPartyMon1Moves - ld bc,44 + ld bc, wPartyMon2 - wPartyMon1 ld a,[wWhichPokemon] call AddNTimes push hl ld de,wNormalMaxPPList - 1 predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList pop hl - ld c,21 + ld c, wPartyMon1PP - wPartyMon1Moves ld b,0 add hl,bc ; hl now points to move 1 PP ld de,wNormalMaxPPList @@ -2307,7 +2304,7 @@ RestoreBonusPP: ; e606 (3:6606) ld a,b cp a,5 ; reached the end of the pokemon's moves? ret z ; if so, return - ld a,[wd11e] + ld a,[wUsingPPUp] dec a ; using a PP Up? jr nz,.skipMenuItemIDCheck ; if using a PP Up, check if this is the move it's being used on @@ -2329,8 +2326,6 @@ RestoreBonusPP: ; e606 (3:6606) ; INPUT: ; [de] = normal max PP ; [hl] = move PP -; [wd11e] = max number of times to add bonus -; set to 1 when using a PP Up, set to 255 otherwise AddBonusPP: ; e642 (3:6642) push bc ld a,[de] ; normal max PP of move @@ -2358,9 +2353,9 @@ AddBonusPP: ; e642 (3:6642) .addAmount add b ld b,a - ld a,[wd11e] - dec a - jr z,.done + ld a,[wUsingPPUp] + dec a ; is the player using a PP Up right now? + jr z,.done ; if so, only add the bonus once dec c jr nz,.loop .done @@ -2379,7 +2374,7 @@ AddBonusPP: ; e642 (3:6642) ; 04: player's in-battle pokemon ; [wCurrentMenuItem] = move index ; OUTPUT: -; [wd11e] = max PP +; [wMaxPP] = max PP GetMaxPP: ; e677 (3:6677) ld a,[wMonDataLocation] and a @@ -2432,12 +2427,12 @@ GetMaxPP: ; e677 (3:6677) ld l,e inc hl ; hl = wcd73 ld [hl],a - xor a - ld [wd11e],a ; no limit on PP Up amount + xor a ; add the bonus for the existing PP Up count + ld [wUsingPPUp],a call AddBonusPP ; add bonus PP from PP Ups ld a,[hl] and a,%00111111 ; mask out the PP Up count - ld [wd11e],a ; store max PP + ld [wMaxPP],a ; store max PP ret GetSelectedMoveOffset: ; e6e3 (3:66e3) -- cgit v1.2.3 From 2b018159997e3b580efd114ff4e3548a0de3cbc5 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 8 Aug 2015 22:32:44 -0700 Subject: commented audio code --- engine/items/items.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index a45b9185..84490521 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -856,7 +856,7 @@ ItemUseMedicine: ; dabb (3:5abb) .notFullHP ; if the pokemon's current HP doesn't equal its max HP xor a ld [wLowHealthAlarm],a ;disable low health alarm - ld [wc02a],a + ld [wChannelSoundIDs + CH4],a push hl push de ld bc,32 @@ -1643,7 +1643,7 @@ ItemUsePokeflute: ; e140 (3:6140) call WaitForSoundToFinish ; wait for sound to end callba Music_PokeFluteInBattle ; play in-battle pokeflute music .musicWaitLoop ; wait for music to finish playing - ld a,[wc02c] + ld a,[wChannelSoundIDs + CH6] and a ; music off? jr nz,.musicWaitLoop .skipMusic @@ -1716,8 +1716,8 @@ PlayedFluteHadEffectText: ; e215 (3:6215) ld c, BANK(SFX_Pokeflute) call PlayMusic .musicWaitLoop ; wait for music to finish playing - ld a,[wc028] - cp a,$b8 + ld a,[wChannelSoundIDs + CH2] + cp a, SFX_POKEFLUE jr z,.musicWaitLoop call PlayDefaultMusic ; start playing normal music again .done -- cgit v1.2.3 From 8a6d46f3d9ba4fb6939eb9ea9949f47aa8608d4a Mon Sep 17 00:00:00 2001 From: dannye Date: Sun, 9 Aug 2015 23:56:20 -0500 Subject: Replace some hardcoded data sizes --- engine/items/items.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 364570da..bae86ddb 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -912,7 +912,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wHPBarNewHP+1],a coord hl, 4, 1 ld a,[wWhichPokemon] - ld bc,2 * 20 + ld bc,2 * SCREEN_WIDTH call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled ld a,SFX_HEAL_HP call PlaySoundWaitForCurrent @@ -1937,7 +1937,7 @@ ItemUsePPRestore: ; e31e (3:631e) cp b ; is the pokemon whose PP was restored active in battle? jr nz,.skipUpdatingInBattleData ld hl,wPartyMon1PP - ld bc,44 + ld bc,wPartyMon2 - wPartyMon1 call AddNTimes ld de,wBattleMonPP ld bc,4 @@ -2289,7 +2289,7 @@ GotOffBicycleText: ; e5fc (3:65fc) ; [wCurrentMenuItem] = index of move (when using a PP Up) RestoreBonusPP: ; e606 (3:6606) ld hl,wPartyMon1Moves - ld bc,44 + ld bc,wPartyMon2 - wPartyMon1 ld a,[wWhichPokemon] call AddNTimes push hl @@ -2407,7 +2407,7 @@ GetMaxPP: ; e677 (3:6677) dec a push hl ld hl,Moves - ld bc,6 + ld bc,MoveEnd - Moves call AddNTimes ld de,wcd6d ld a,BANK(Moves) -- cgit v1.2.3 From 4aedff021786dd5c0b81d3a35f505b7aa42adddc Mon Sep 17 00:00:00 2001 From: dannye Date: Mon, 10 Aug 2015 23:51:20 -0500 Subject: Replace hardcoded name lengths with NAME_LENGTH --- engine/items/items.asm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index fe53082b..4ba3c706 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -142,7 +142,7 @@ ItemUseBall: ; d687 (3:5687) .oldManBattle ld hl,W_GRASSRATE ld de,wPlayerName - ld bc,11 + ld bc,NAME_LENGTH call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno glitch) jp .BallSuccess .notOldManBattle @@ -2573,14 +2573,14 @@ SendNewMonToBox: ; e7a4 (3:67a4) jr nz, .asm_e7b1 call GetMonHeader ld hl, wBoxMonOT - ld bc, 11 + ld bc, NAME_LENGTH ld a, [W_NUMINBOX] dec a jr z, .asm_e7ee dec a call AddNTimes push hl - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld d, h ld e, l @@ -2591,12 +2591,12 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7db push bc push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop hl ld d, h ld e, l - ld bc, -$b + ld bc, -NAME_LENGTH add hl, bc pop bc dec b @@ -2604,17 +2604,17 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7ee ld hl, wPlayerName ld de, wBoxMonOT - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [W_NUMINBOX] dec a jr z, .asm_e82a ld hl, wBoxMonNicks - ld bc, 11 + ld bc, NAME_LENGTH dec a call AddNTimes push hl - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld d, h ld e, l @@ -2625,12 +2625,12 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e817 push bc push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop hl ld d, h ld e, l - ld bc, -$b + ld bc, -NAME_LENGTH add hl, bc pop bc dec b -- cgit v1.2.3 From 64cfbcce7a71e6e75553575490fd60cbd61a5665 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 12 Aug 2015 02:16:56 -0700 Subject: commented SGB palette stuff --- engine/items/items.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 4ba3c706..418b21da 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -127,7 +127,7 @@ ItemUseBall: ; d687 (3:5687) ld hl,W_NUMSAFARIBALLS dec [hl] .skipSafariZoneCode - call GoPAL_SET_CF1C + call RunDefaultPaletteCommand ld a,$43 ld [wd11e],a call LoadScreenTilesFromBuffer1 ;restore screenBuffer from Backup @@ -1111,7 +1111,7 @@ ItemUseMedicine: ; dabb (3:5abb) and a ; using Softboiled? ret nz ; if so, return call GBPalWhiteOut - call z,GoPAL_SET_CF1C + call z,RunDefaultPaletteCommand ld a,[W_ISINBATTLE] and a ret nz @@ -1928,7 +1928,7 @@ ItemUsePPRestore: ; e31e (3:631e) pop af ld [wWhichPokemon],a call GBPalWhiteOut - call GoPAL_SET_CF1C + call RunDefaultPaletteCommand jp RemoveUsedItem .afterRestoringPP ; after using a (Max) Ether/Elixir ld a,[wWhichPokemon] @@ -2032,7 +2032,7 @@ ItemUsePPRestore: ; e31e (3:631e) call ItemUseNoEffect .itemNotUsed call GBPalWhiteOut - call GoPAL_SET_CF1C + call RunDefaultPaletteCommand pop af xor a ld [wActionResultOrTookBattleTurn],a ; item use failed @@ -2125,7 +2125,7 @@ ItemUseTMHM: ; e479 (3:6479) pop af call GBPalWhiteOutWithDelay3 call ClearSprites - call GoPAL_SET_CF1C + call RunDefaultPaletteCommand jp LoadScreenTilesFromBuffer1 ; restore saved screen .checkIfAbleToLearnMove predef CanLearnTM ; check if the pokemon can learn the move @@ -2201,7 +2201,7 @@ ItemUseNotYoursToUse: ; e586 (3:6586) jr ItemUseFailed ThrowBallAtTrainerMon: ; e58b (3:658b) - call GoPAL_SET_CF1C + call RunDefaultPaletteCommand call LoadScreenTilesFromBuffer1 ; restore saved screen call Delay3 ld a,TOSS_ANIM -- cgit v1.2.3 From 132d0367522b7acce602b146ca69bfad87ef96c6 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 12 Aug 2015 22:14:31 -0700 Subject: named more variables --- engine/items/items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 418b21da..1a342d97 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1324,7 +1324,7 @@ ItemUseRock: ; df67 (3:5f67) BaitRockCommon: ; df7f (3:5f7f) ld [W_ANIMATIONID],a xor a - ld [wcc5b],a + ld [wAnimationType],a ld [H_WHOSETURN],a ld [de],a ; zero escape factor (for bait), zero bait factor (for rock) .randomLoop ; loop until a random number less than 5 is generated -- cgit v1.2.3 From 599a6aeaaf81e7174577c782f3b3ba113a4a4c39 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 14 Aug 2015 00:36:06 -0700 Subject: named battle and learn move variables --- engine/items/items.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/items/items.asm') diff --git a/engine/items/items.asm b/engine/items/items.asm index 1a342d97..f0666587 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -364,7 +364,7 @@ ItemUseBall: ; d687 (3:5687) jr .next16 .next15 set Transformed,[hl] - ld hl,wcceb + ld hl,wTransformedEnemyMonOriginalDVs ld a,[wEnemyMonDVs] ld [hli],a ld a,[wEnemyMonDVs + 1] @@ -2105,16 +2105,16 @@ ItemUseTMHM: ; e479 (3:6479) push af .chooseMon ld hl,wcf4b - ld de,wd036 + ld de,wTempMoveNameBuffer ld bc,14 - call CopyData + call CopyData ; save the move name because DisplayPartyMenu will overwrite it ld a,$ff ld [wUpdateSpritesEnabled],a ld a,TMHM_PARTY_MENU ld [wPartyMenuTypeOrMessageID],a call DisplayPartyMenu push af - ld hl,wd036 + ld hl,wTempMoveNameBuffer ld de,wcf4b ld bc,14 call CopyData -- cgit v1.2.3