From 6fe56af2cd63abaf30040cc5031e3db5358cf638 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 10:51:02 -0500 Subject: Organize home and macro code --- engine/items/inventory.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/items') diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index c2e0b2b4..86003319 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -36,7 +36,7 @@ AddItemToInventory_:: inc hl .loop ld a, [hl] - cp a, $ff ; is it the end of the table? + cp $ff ; is it the end of the table? jr nz, .notAtEndOfInventory .addNewItem ; add an item not yet in the inventory pop hl -- cgit v1.3.1-sl0p From 472f5824a65eaa76f6c92e66bfabb1a1eac66442 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 13:23:47 -0500 Subject: Sync more with pokered --- constants/item_constants.asm | 3 +++ data/pokemon/unknown_list.asm | 36 ++++++++++++++++++++++++++++++++++++ engine/battle/animations.asm | 8 ++++---- engine/items/inventory.asm | 4 ++-- engine/items/item_effects.asm | 2 +- engine/items/tms.asm | 2 +- engine/items/town_map.asm | 2 +- engine/joypad.asm | 8 +++----- engine/link/print_waiting_text.asm | 9 +++++---- engine/pokemon/add_mon.asm | 6 +++--- engine/pokemon/evos_moves.asm | 35 +---------------------------------- engine/predefs.asm | 8 ++++---- 12 files changed, 64 insertions(+), 59 deletions(-) create mode 100644 data/pokemon/unknown_list.asm (limited to 'engine/items') diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 67416600..bf99ec9b 100755 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -223,3 +223,6 @@ assert NUM_TMS == const_value - TM01, "NUM_TMS ({d:NUM_TMS}) does not match the ; These fit in 7 bytes, with one unused bit left over. __tmhm_value__ = NUM_TMS + NUM_HMS + 1 UNUSED_TMNUM EQU __tmhm_value__ + +; used for Time Capsule held item compatibility +TWISTEDSPOON_GSC EQU $60 diff --git a/data/pokemon/unknown_list.asm b/data/pokemon/unknown_list.asm new file mode 100644 index 00000000..010d415b --- /dev/null +++ b/data/pokemon/unknown_list.asm @@ -0,0 +1,36 @@ +; This list is used by a unreferenced function. + +Pointer_3b0ee: + db NIDOKING + db IVYSAUR + db EXEGGUTOR + db GENGAR + db NIDOQUEEN + db ARCANINE + db GYARADOS + db BLASTOISE + db GOLEM + db DRAGONITE + db NINETALES + db DRAGONAIR + db KABUTOPS + db OMASTAR + db JIGGLYPUFF + db FLAREON + db JOLTEON + db VAPOREON + db BEEDRILL + db BUTTERFREE + db MACHAMP + db CLOYSTER + db CLEFABLE + db ALAKAZAM + db STARMIE + db VENUSAUR + db TENTACRUEL + db CHARMELEON + db WARTORTLE + db CHARIZARD + db VILEPLUME + db VICTREEBEL + db -1 ; end diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 98d85e02..64bdaa00 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1327,7 +1327,7 @@ BattleAnimWriteOAMEntry: ; Y coordinate = e (increased by 8 each call, before the write to OAM) ; X coordinate = [wBaseCoordX] ; tile = d -; attributes = variable (dependant on coords) +; attributes = variable (depending on coords) ld a, $1 ld [wdef5], a ld a, e @@ -1402,7 +1402,7 @@ AdjustOAMBlockYPos2: ret AnimationBlinkEnemyMon: - ; Make the enemy mon's sprite blink on and off for a second or two +; Make the enemy mon's sprite blink on and off for a second or two ld hl, AnimationBlinkMon jp CallWithTurnFlipped @@ -1880,7 +1880,7 @@ _AnimationSlideMonOff: jr nz, .slideLoop ret -; Since mon pic tile numbers go from top to bottom, left to right in order, +; Since mon pic tile numbers go from top to bottom, left to right in order, ; adding the height of the mon pic in tiles to a tile number gives the tile ; number of the tile one column to the right (and thus subtracting the height ; gives the reverse). If the next tile would be past the edge of the pic, the 2 @@ -2246,7 +2246,7 @@ ClearMonPicFromTileMap: ret ; puts the tile map destination address of a mon sprite in hl, given the row count in b -; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out, +; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out, ; in order to show only a portion of the mon sprite. GetMonSpriteTileMapPointerFromRowCount: push de diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 86003319..e28edc6c 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -34,7 +34,7 @@ AddItemToInventory_:: cp b ; does the current item in the table match the item being added? jp z, .increaseItemQuantity ; if so, increase the item's quantity inc hl -.loop +.addAnotherStackOfItem ld a, [hl] cp $ff ; is it the end of the table? jr nz, .notAtEndOfInventory @@ -74,7 +74,7 @@ AddItemToInventory_:: ; if so, store 99 in the current slot and store the rest in a new slot ld a, 99 ld [hli], a - jp .loop + jp .addAnotherStackOfItem .increaseItemQuantityFailed pop hl and a diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index d4c3ae18..f8a388d5 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -3092,7 +3092,7 @@ SendNewMonToBox: ld a, [wcf91] cp KADABRA jr nz, .notKadabra - ld a, $60 ; twistedspoon in gsc + ld a, TWISTEDSPOON_GSC ld [wBoxMon1CatchRate], a .notKadabra ret diff --git a/engine/items/tms.asm b/engine/items/tms.asm index dcf2665d..40030675 100755 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -11,7 +11,7 @@ CanLearnTM: ld hl, TechnicalMachines .findTMloop ld a, [hli] - cp $ff ; reached terminator? + cp -1 ; reached terminator? jr z, .done cp b jr z, .TMfoundLoop diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index c401d1c1..d385044a 100755 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -152,7 +152,7 @@ LoadTownMap_Fly:: call LoadFontTilePatterns ld de, BirdSprite ld b, BANK(BirdSprite) - ld c, $c + ld c, 12 ld hl, vSprites tile $04 call CopyVideoData ld de, TownMapUpArrow diff --git a/engine/joypad.asm b/engine/joypad.asm index 06a15e4e..d50eea08 100644 --- a/engine/joypad.asm +++ b/engine/joypad.asm @@ -7,7 +7,6 @@ ReadJoypad_:: ret nz ld a, 1 << 5 ; select direction keys - ;ld c, 0 ldh [rJOYP], a ldh a, [rJOYP] @@ -19,9 +18,9 @@ ReadJoypad_:: ld a, 1 << 4 ; select button keys ldh [rJOYP], a - REPT 6 +REPT 6 ldh a, [rJOYP] - ENDR +ENDR cpl and %1111 or b @@ -32,14 +31,13 @@ ReadJoypad_:: ldh [rJOYP], a ret - _Joypad:: ; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast ; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput ldh a, [hJoyInput] ld b, a - and $4F + and A_BUTTON + B_BUTTON + SELECT + START + D_UP cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset jp z, TrySoftReset diff --git a/engine/link/print_waiting_text.asm b/engine/link/print_waiting_text.asm index 98a44970..a07967fd 100644 --- a/engine/link/print_waiting_text.asm +++ b/engine/link/print_waiting_text.asm @@ -3,12 +3,13 @@ PrintWaitingText:: lb bc, 1, 11 ld a, [wIsInBattle] and a - jr z, .asm_4b9a + jr z, .trade +; battle call TextBoxBorder - jr .asm_4b9d -.asm_4b9a + jr .border_done +.trade call CableClub_TextBoxBorder -.asm_4b9d +.border_done hlcoord 4, 11 ld de, WaitingText call PlaceString diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index d3d08e99..52230099 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -172,10 +172,10 @@ _AddPartyMon:: ld [de], a ld a, [wcf91] cp KADABRA - jr nz, .skipGivingTwistedSpoon - ld a, $60 ; twistedspoon in gen 2 + jr nz, .notKadabra + ld a, TWISTEDSPOON_GSC ld [de], a -.skipGivingTwistedSpoon +.notKadabra ld hl, wMonHMoves ld a, [hli] inc de diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 4e48fe30..3df780c1 100755 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -452,40 +452,7 @@ Func_3b0a2: scf ret -Pointer_3b0ee: - db NIDOKING - db IVYSAUR - db EXEGGUTOR - db GENGAR - db NIDOQUEEN - db ARCANINE - db GYARADOS - db BLASTOISE - db GOLEM - db DRAGONITE - db NINETALES - db DRAGONAIR - db KABUTOPS - db OMASTAR - db JIGGLYPUFF - db FLAREON - db JOLTEON - db VAPOREON - db BEEDRILL - db BUTTERFREE - db MACHAMP - db CLOYSTER - db CLEFABLE - db ALAKAZAM - db STARMIE - db VENUSAUR - db TENTACRUEL - db CHARMELEON - db WARTORTLE - db CHARIZARD - db VILEPLUME - db VICTREEBEL - db $ff +INCLUDE "data/pokemon/unknown_list.asm" Func_3b10f: ld c, $0 diff --git a/engine/predefs.asm b/engine/predefs.asm index 73f69d03..a9877739 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -1,8 +1,8 @@ GetPredefPointer:: - ; Store the contents of the register - ; pairs (hl, de, bc) at wPredefRegisters. - ; Then put the bank and address of predef - ; wPredefID in [wPredefBank] and hl. +; Store the contents of the register +; pairs (hl, de, bc) at wPredefRegisters. +; Then put the bank and address of predef +; wPredefID in [wPredefBank] and hl. ld a, h ld [wPredefRegisters], a -- cgit v1.3.1-sl0p From ed7a2d49d75e3bdd7ecab907574d7cb51f1c81fa Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 15:17:48 -0500 Subject: Remove trailing whitespace --- data/maps/special_warps.asm | 6 +++--- engine/battle/core.asm | 2 +- engine/items/item_effects.asm | 2 +- engine/math/bcd.asm | 4 ++-- engine/minigame/surfing_pikachu.asm | 2 +- engine/movie/title.asm | 10 +++++----- engine/pikachu/pikachu_movement.asm | 2 +- engine/pokemon/add_mon.asm | 2 +- wram.asm | 12 ++++++------ 9 files changed, 21 insertions(+), 21 deletions(-) (limited to 'engine/items') diff --git a/data/maps/special_warps.asm b/data/maps/special_warps.asm index 80f88cc4..56dac3a5 100755 --- a/data/maps/special_warps.asm +++ b/data/maps/special_warps.asm @@ -48,11 +48,11 @@ FirstMapSpec: special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2 TradeCenterSpec1: special_warp_spec TRADE_CENTER, 3, 4, CLUB -TradeCenterSpec2: +TradeCenterSpec2: special_warp_spec TRADE_CENTER, 6, 4, CLUB -ColosseumSpec1: +ColosseumSpec1: special_warp_spec COLOSSEUM, 3, 4, CLUB -ColosseumSpec2: +ColosseumSpec2: special_warp_spec COLOSSEUM, 6, 4, CLUB diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 804625cd..ac9676ec 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4642,7 +4642,7 @@ CalculateDamage: ld b, 4 call Divide -; Update wCurDamage. +; Update wCurDamage. ; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997. ld hl, wDamage ld b, [hl] diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index f8a388d5..00a575f1 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -386,7 +386,7 @@ ItemUseBall: ldh [hDivisor], a ld b, 4 call Divide - + ; Determine Status2. ; no status ailment: Status2 = 0 ; Burn/Paralysis/Poison: Status2 = 5 diff --git a/engine/math/bcd.asm b/engine/math/bcd.asm index 92bf6f17..5747a684 100644 --- a/engine/math/bcd.asm +++ b/engine/math/bcd.asm @@ -13,7 +13,7 @@ DivideBCD:: ldh [hDivideBCDBuffer+1], a ldh [hDivideBCDBuffer+2], a ld d, $1 -.mulBy10Loop +.mulBy10Loop ; multiply the divisor by 10 until the leading digit is nonzero ; to set up the standard long division algorithm ldh a, [hDivideBCDDivisor] @@ -108,7 +108,7 @@ DivideBCD:: ldh a, [hDivideBCDBuffer+2] ldh [hDivideBCDQuotient+2], a pop de - ld a, $6 + ld a, $6 sub d and a ret z diff --git a/engine/minigame/surfing_pikachu.asm b/engine/minigame/surfing_pikachu.asm index 6d319867..641c4f62 100755 --- a/engine/minigame/surfing_pikachu.asm +++ b/engine/minigame/surfing_pikachu.asm @@ -1689,7 +1689,7 @@ SurfingMinigame_WriteTotal: .Total: db $2b,$2c,$25,$28,$2d ; Total - + DidPlayerGetAHighScore: ld hl, wSurfingMinigameHiScore + 1 ld a, [wSurfingMinigameTotalScore + 1] diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 0b421d89..11852ae4 100755 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -254,7 +254,7 @@ CopyrightTextString: TitleScreen_PlayPikachuPCM: callfar PlayPikachuSoundClip ret - + DoTitleScreenFunction: call .CheckTimer ld a, [wTitleScreenScene] @@ -268,7 +268,7 @@ DoTitleScreenFunction: ld l, a jp hl - + .Jumptable: dw .Nop dw .BlinkHalf @@ -282,13 +282,13 @@ DoTitleScreenFunction: dw .BlinkWait dw .BlinkOpen dw .GoBackToStart - + .GoBackToStart: xor a ld [wTitleScreenScene], a .Nop ret - + .BlinkOpen: ld e, 0 jr .LoadBlinkFrame @@ -316,7 +316,7 @@ DoTitleScreenFunction: ld hl, wTitleScreenScene inc [hl] ret - + .CheckTimer: ld hl, wTitleScreenTimer ld a, [hl] diff --git a/engine/pikachu/pikachu_movement.asm b/engine/pikachu/pikachu_movement.asm index 6b912e61..91c16999 100755 --- a/engine/pikachu/pikachu_movement.asm +++ b/engine/pikachu/pikachu_movement.asm @@ -866,7 +866,7 @@ LoadPikachuShadowOAMData: push bc push de push hl - + ld bc, wOAMBuffer + 4 * 36 ld a, [wPikaSpriteY] ld e, a diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 52230099..54d7b4de 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -436,7 +436,7 @@ _MoveMon:: cp PARTY_TO_DAYCARE ld de, wDayCareMonOT jr z, .findOTsrc - dec a + dec a ld hl, wPartyMonOT ld a, [wPartyCount] jr nz, .addOToffset diff --git a/wram.asm b/wram.asm index 5ff2cebe..35b5f61f 100755 --- a/wram.asm +++ b/wram.asm @@ -2755,8 +2755,8 @@ wExpressionNumber:: ds 1 wPikaPicAnimNumber:: ds 1 - -wPikachuMovementScriptBank:: ds 1 + +wPikachuMovementScriptBank:: ds 1 wPikachuMovementScriptAddress:: dw wPikachuMovementFlags:: ; bit 6 - spawn shadow @@ -2818,11 +2818,11 @@ wd475:: ds 1 wd47a:: ds 1 ds 24 - + wd492:: ds 1 - + ds 1 - + wSurfingMinigameHiScore:: ds 2 ; 4-digit BCD little-endian ds 1 @@ -3401,7 +3401,7 @@ wGrassMons:: wSerialEnemyDataBlock:: ds 9 -wEnemyPartyCount:: ds 1 +wEnemyPartyCount:: ds 1 wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; Overload enemy party data -- cgit v1.3.1-sl0p