diff options
Diffstat (limited to 'main.asm')
-rwxr-xr-x | main.asm | 5970 |
1 files changed, 709 insertions, 5261 deletions
@@ -1,3 +1,4 @@ +INCLUDE "charmap.asm" INCLUDE "constants.asm" NPC_SPRITES_1 EQU $4 @@ -11,4730 +12,137 @@ PICS_3 EQU $B PICS_4 EQU $C PICS_5 EQU $D - INCLUDE "home.asm" -SECTION "bank1",ROMX,BANK[$1] +SECTION "bank01",ROMX,BANK[$01] INCLUDE "data/facing.asm" -ResetStatusAndHalveMoneyOnBlackout:: -; Reset player status on blackout. - xor a - ld [wBattleResult], a - ld [wWalkBikeSurfState], a - ld [wIsInBattle], a - ld [wMapPalOffset], a - ld [wNPCMovementScriptFunctionNum], a - ld [hJoyHeld], a - ld [wNPCMovementScriptPointerTableNum], a - ld [wFlags_0xcd60], a - - ld [hMoney], a - ld [hMoney + 1], a - ld [hMoney + 2], a - call HasEnoughMoney - jr c, .lostmoney ; never happens - - ; Halve the player's money. - ld a, [wPlayerMoney] - ld [hMoney], a - ld a, [wPlayerMoney + 1] - ld [hMoney + 1], a - ld a, [wPlayerMoney + 2] - ld [hMoney + 2], a - xor a - ld [hDivideBCDDivisor], a - ld [hDivideBCDDivisor + 1], a - ld a, 2 - ld [hDivideBCDDivisor + 2], a - predef DivideBCDPredef3 - ld a, [hDivideBCDQuotient] - ld [wPlayerMoney], a - ld a, [hDivideBCDQuotient + 1] - ld [wPlayerMoney + 1], a - ld a, [hDivideBCDQuotient + 2] - ld [wPlayerMoney + 2], a - -.lostmoney - ld hl, wd732 - set 2, [hl] - res 3, [hl] - set 6, [hl] - ld a, %11111111 - ld [wJoyIgnore], a - predef_jump HealParty - - -MewPicFront:: INCBIN "pic/bmon/mew.pic" -MewPicBack:: INCBIN "pic/monback/mewb.pic" -INCLUDE "data/baseStats/mew.asm" - INCLUDE "engine/battle/safari_zone.asm" INCLUDE "engine/titlescreen.asm" - -NintenText: db "NINTEN@" -SonyText: db "SONY@" - - -LoadMonData_: -; Load monster [wWhichPokemon] from list [wMonDataLocation]: -; 0: partymon -; 1: enemymon -; 2: boxmon -; 3: daycaremon -; Return monster id at wcf91 and its data at wLoadedMon. -; Also load base stats at wMonHeader for convenience. - - ld a, [wDayCareMonSpecies] - ld [wcf91], a - ld a, [wMonDataLocation] - cp DAYCARE_DATA - jr z, .GetMonHeader - - ld a, [wWhichPokemon] - ld e, a - callab GetMonSpecies - -.GetMonHeader - ld a, [wcf91] - ld [wd0b5], a ; input for GetMonHeader - call GetMonHeader - - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 - ld a, [wMonDataLocation] - cp ENEMY_PARTY_DATA - jr c, .getMonEntry - - ld hl, wEnemyMons - jr z, .getMonEntry - - cp 2 - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 - jr z, .getMonEntry - - ld hl, wDayCareMon - jr .copyMonData - -.getMonEntry - ld a, [wWhichPokemon] - call AddNTimes - -.copyMonData - ld de, wLoadedMon - ld bc, wPartyMon2 - wPartyMon1 - jp CopyData - +INCLUDE "engine/load_mon_data.asm" INCLUDE "data/item_prices.asm" INCLUDE "text/item_names.asm" - -UnusedNames: - db "かみなりバッヂ@" - db "かいがらバッヂ@" - db "おじぞうバッヂ@" - db "はやぶさバッヂ@" - db "ひんやりバッヂ@" - db "なかよしバッヂ@" - db "バラバッヂ@" - db "ひのたまバッヂ@" - db "ゴールドバッヂ@" - db "たまご@" - db "ひよこ@" - db "ブロンズ@" - db "シルバー@" - db "ゴールド@" - db "プチキャプテン@" - db "キャプテン@" - db "プチマスター@" - db "マスター@" - db "エクセレント" +INCLUDE "text/unused_names.asm" INCLUDE "engine/overworld/oam.asm" -INCLUDE "engine/oam_dma.asm" - -PrintWaitingText: - coord hl, 3, 10 - ld b, $1 - ld c, $b - ld a, [wIsInBattle] - and a - jr z, .asm_4c17 - call TextBoxBorder - jr .asm_4c1a -.asm_4c17 - call CableClub_TextBoxBorder -.asm_4c1a - coord hl, 4, 11 - ld de, WaitingText - call PlaceString - ld c, 50 - jp DelayFrames - -WaitingText: - db "Waiting...!@" - - -_UpdateSprites: - ld h, $c1 - inc h - ld a, $e ; wSpriteStateData2 + $0e -.spriteLoop - ld l, a - sub $e - ld c, a - ld [H_CURRENTSPRITEOFFSET], a - ld a, [hl] - and a - jr z, .skipSprite ; tests $c2Xe - push hl - push de - push bc - call .updateCurrentSprite - pop bc - pop de - pop hl -.skipSprite - ld a, l - add $10 ; move to next sprite - cp $e ; test for overflow (back at $0e) - jr nz, .spriteLoop - ret -.updateCurrentSprite ; 4c54 (1:4c54) - cp $1 - jp nz, UpdateNonPlayerSprite - jp UpdatePlayerSprite - -UpdateNonPlayerSprite: - dec a - swap a - ld [$ff93], a ; $10 * sprite# - ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? - ld b, a - ld a, [H_CURRENTSPRITEOFFSET] - cp b - jr nz, .unequal - jp DoScriptedNPCMovement -.unequal - jp UpdateNPCSprite - -; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET) -; is going to collide with another sprite by looping over the other sprites. -; The current sprite's offset will be labelled with i (e.g. $c1i0). -; The loop sprite's offset will labelled with j (e.g. $c1j0). -; -; Note that the Y coordinate of the sprite (in [$c1k4]) is one of the following -; 9 values when the sprite is aligned with the grid: $fc, $0c, $1c, $2c, ..., $7c. -; The reason that 4 is added below to the coordinate is to make it align with a -; multiple of $10 to make comparisons easier. -DetectCollisionBetweenSprites: - nop - - ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add wSpriteStateData1 % $100 - ld l, a - - ld a, [hl] ; a = [$c1i0] (picture) (0 if slot is unused) - and a ; is this sprite slot slot used? - ret z ; return if not used - - ld a, l - add 3 - ld l, a - - ld a, [hli] ; a = [$c1i3] (delta Y) (-1, 0, or 1) - call SetSpriteCollisionValues - - ld a, [hli] ; a = [$C1i4] (Y screen coordinate) - add 4 ; align with multiple of $10 - -; The effect of the following 3 lines is to -; add 7 to a if moving south or -; subtract 7 from a if moving north. - add b - and $f0 - or c - - ld [$ff90], a ; store Y coordinate adjusted for direction of movement - - ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) - call SetSpriteCollisionValues - ld a, [hl] ; a = [$C1i6] (X screen coordinate) - -; The effect of the following 3 lines is to -; add 7 to a if moving east or -; subtract 7 from a if moving west. - add b - and $f0 - or c - - ld [$ff91], a ; store X coordinate adjusted for direction of movement - - ld a, l - add 7 - ld l, a - - xor a - ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? - ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) - - ld a, [$ff91] - ld [hld], a ; [$c1ib] = adjusted X coordinate - ld a, [$ff90] - ld [hl], a ; [$c1ia] = adjusted Y coordinate - - xor a ; zero the loop counter - -.loop - ld [$ff8f], a ; store loop counter - swap a - ld e, a - ld a, [H_CURRENTSPRITEOFFSET] - cp e ; does the loop sprite match the current sprite? - jp z, .next ; go to the next sprite if they match - - ld d, h - ld a, [de] ; a = [$c1j0] (picture) (0 if slot is unused) - and a ; is this sprite slot slot used? - jp z, .next ; go the next sprite if not used - - inc e - inc e - ld a, [de] ; a = [$c1j2] ($ff means the sprite is offscreen) - inc a - jp z, .next ; go the next sprite if offscreen - - ld a, [H_CURRENTSPRITEOFFSET] - add 10 - ld l, a - - inc e - ld a, [de] ; a = [$c1j3] (delta Y) - call SetSpriteCollisionValues - - inc e - ld a, [de] ; a = [$C1j4] (Y screen coordinate) - add 4 ; align with multiple of $10 - -; The effect of the following 3 lines is to -; add 7 to a if moving south or -; subtract 7 from a if moving north. - add b - and $f0 - or c - - sub [hl] ; subtract the adjusted Y coordinate of sprite i ([$c1ia]) from that of sprite j - -; calculate the absolute value of the difference to get the distance - jr nc, .noCarry1 - cpl - inc a -.noCarry1 - ld [$ff90], a ; store the distance between the two sprites' adjusted Y values - -; Use the carry flag set by the above subtraction to determine which sprite's -; Y coordinate is larger. This information is used later to set [$c1ic], -; which stores which direction the collision occurred in. -; The following 5 lines set the lowest 2 bits of c, which are later shifted left by 2. -; If sprite i's Y is larger, set lowest 2 bits of c to 10. -; If sprite j's Y is larger or both are equal, set lowest 2 bits of c to 01. - push af - rl c - pop af - ccf - rl c - -; If sprite i's delta Y is 0, then b = 7, else b = 9. - ld b, 7 - ld a, [hl] ; a = [$c1ia] (adjusted Y coordinate) - and $f - jr z, .next1 - ld b, 9 - -.next1 - ld a, [$ff90] ; a = distance between adjusted Y coordinates - sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction - ld a, b - ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y - jr c, .checkXDistance - -; If sprite j's delta Y is 0, then b = 7, else b = 9. - ld b, 7 - dec e - ld a, [de] ; a = [$c1j3] (delta Y) - inc e - and a - jr z, .next2 - ld b, 9 - -.next2 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction - sub b ; adjust distance using sprite j's direction - jr z, .checkXDistance - jr nc, .next ; go to next sprite if distance is still positive after both adjustments - -.checkXDistance - inc e - inc l - ld a, [de] ; a = [$c1j5] (delta X) - - push bc - - call SetSpriteCollisionValues - inc e - ld a, [de] ; a = [$c1j6] (X screen coordinate) - -; The effect of the following 3 lines is to -; add 7 to a if moving east or -; subtract 7 from a if moving west. - add b - and $f0 - or c - - pop bc - - sub [hl] ; subtract the adjusted X coordinate of sprite i ([$c1ib]) from that of sprite j - -; calculate the absolute value of the difference to get the distance - jr nc, .noCarry2 - cpl - inc a -.noCarry2 - ld [$ff91], a ; store the distance between the two sprites' adjusted X values - -; Use the carry flag set by the above subtraction to determine which sprite's -; X coordinate is larger. This information is used later to set [$c1ic], -; which stores which direction the collision occurred in. -; The following 5 lines set the lowest 2 bits of c. -; If sprite i's X is larger, set lowest 2 bits of c to 10. -; If sprite j's X is larger or both are equal, set lowest 2 bits of c to 01. - push af - rl c - pop af - ccf - rl c - -; If sprite i's delta X is 0, then b = 7, else b = 9. - ld b, 7 - ld a, [hl] ; a = [$c1ib] (adjusted X coordinate) - and $f - jr z, .next3 - ld b, 9 - -.next3 - ld a, [$ff91] ; a = distance between adjusted X coordinates - sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction - ld a, b - ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X - jr c, .collision - -; If sprite j's delta X is 0, then b = 7, else b = 9. - ld b, 7 - dec e - ld a, [de] ; a = [$c1j5] (delta X) - inc e - and a - jr z, .next4 - ld b, 9 - -.next4 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction - sub b ; adjust distance using sprite j's direction - jr z, .collision - jr nc, .next ; go to next sprite if distance is still positive after both adjustments - -.collision - ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X - ld b, a - ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y - inc l - -; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. -; (note that normally if delta X isn't 0, then delta Y must be 0 and vice versa) - cp b - jr c, .next5 - ld b, %1100 - jr .next6 -.next5 - ld b, %0011 - -.next6 - ld a, c ; c has 2 bits set (one of bits 0-1 is set for the X axis and one of bits 2-3 for the Y axis) - and b ; we select either the bit in bits 0-1 or bits 2-3 based on the calculation immediately above - or [hl] ; or with existing collision direction bits in [$c1ic] - ld [hl], a ; store new value - ld a, c ; useless code because a is overwritten before being used again - -; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with - inc l - inc l - ld a, [$ff8f] ; a = loop counter - ld de, SpriteCollisionBitTable - add a - add e - ld e, a - jr nc, .noCarry3 - inc d -.noCarry3 - ld a, [de] - or [hl] - ld [hli], a - inc de - ld a, [de] - or [hl] - ld [hl], a - -.next - ld a, [$ff8f] ; a = loop counter - inc a - cp $10 - jp nz, .loop - ret -; takes delta X or delta Y in a -; b = delta X/Y -; c = 0 if delta X/Y is 0 -; c = 7 if delta X/Y is 1 -; c = 9 if delta X/Y is -1 -SetSpriteCollisionValues: - and a - ld b, 0 - ld c, 0 - jr z, .done - ld c, 9 - cp -1 - jr z, .ok - ld c, 7 - ld a, 0 -.ok - ld b, a -.done - ret - -SpriteCollisionBitTable: - db %00000000,%00000001 - db %00000000,%00000010 - db %00000000,%00000100 - db %00000000,%00001000 - db %00000000,%00010000 - db %00000000,%00100000 - db %00000000,%01000000 - db %00000000,%10000000 - db %00000001,%00000000 - db %00000010,%00000000 - db %00000100,%00000000 - db %00001000,%00000000 - db %00010000,%00000000 - db %00100000,%00000000 - db %01000000,%00000000 - db %10000000,%00000000 - -TestBattle: - ret - -.loop - call GBPalNormal - - ; Don't mess around - ; with obedience. - ld a, %10000000 ; EARTHBADGE - ld [wObtainedBadges], a - - ld hl, wFlags_D733 - set BIT_TEST_BATTLE, [hl] - - ; Reset the party. - ld hl, wPartyCount - xor a - ld [hli], a - dec a - ld [hl], a - - ; Give the player a - ; level 20 Rhydon. - ld a, RHYDON - ld [wcf91], a - ld a, 20 - ld [wCurEnemyLVL], a - xor a - ld [wMonDataLocation], a - ld [wCurMap], a - call AddPartyMon - - ; Fight against a - ; level 20 Rhydon. - ld a, RHYDON - ld [wCurOpponent], a - - predef InitOpponent - - ; When the battle ends, - ; do it all again. - ld a, 1 - ld [wUpdateSpritesEnabled], a - ld [H_AUTOBGTRANSFERENABLED], a - jr .loop +INCLUDE "engine/print_waiting_text.asm" +INCLUDE "engine/overworld/map_sprite_functions1.asm" INCLUDE "engine/overworld/item.asm" INCLUDE "engine/overworld/movement.asm" - INCLUDE "engine/cable_club.asm" - -LoadTrainerInfoTextBoxTiles: - ld de, TrainerInfoTextBoxTileGraphics - ld hl, vChars2 + $760 - lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10 - jp CopyVideoData - INCLUDE "engine/menu/main_menu.asm" - INCLUDE "engine/oak_speech.asm" - -SpecialWarpIn: - call LoadSpecialWarpData - predef LoadTilesetHeader - ld hl,wd732 - bit 2,[hl] ; dungeon warp or fly warp? - res 2,[hl] - jr z,.next -; if dungeon warp or fly warp - ld a,[wDestinationMap] - jr .next2 -.next - bit 1,[hl] - jr z,.next3 - call EmptyFunc -.next3 - ld a,0 -.next2 - ld b,a - ld a,[wd72d] - and a - jr nz,.next4 - ld a,b -.next4 - ld hl,wd732 - bit 4,[hl] ; dungeon warp? - ret nz -; if not dungeon warp - ld [wLastMap],a - ret - -; gets the map ID, tile block map view pointer, tileset, and coordinates -LoadSpecialWarpData: - ld a, [wd72d] - cp TRADE_CENTER - jr nz, .notTradeCenter - ld hl, TradeCenterSpec1 - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right - jr z, .copyWarpData - ld hl, TradeCenterSpec2 - jr .copyWarpData -.notTradeCenter - cp COLOSSEUM - jr nz, .notColosseum - ld hl, ColosseumSpec1 - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr z, .copyWarpData - ld hl, ColosseumSpec2 - jr .copyWarpData -.notColosseum - ld a, [wd732] - bit 1, a - jr nz, .notFirstMap - bit 2, a - jr nz, .notFirstMap - ld hl, FirstMapSpec -.copyWarpData - ld de, wCurMap - ld c, $7 -.copyWarpDataLoop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyWarpDataLoop - ld a, [hli] - ld [wCurMapTileset], a - xor a - jr .done -.notFirstMap - ld a, [wLastMap] ; this value is overwritten before it's ever read - ld hl, wd732 - bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)? - jr nz, .usedDunegonWarp - bit 6, [hl] ; return to last pokemon center (or player's house)? - res 6, [hl] - jr z, .otherDestination -; return to last pokemon center or player's house - ld a, [wLastBlackoutMap] - jr .usedFlyWarp -.usedDunegonWarp - ld hl, wd72d - res 4, [hl] - ld a, [wDungeonWarpDestinationMap] - ld b, a - ld [wCurMap], a - ld a, [wWhichDungeonWarp] - ld c, a - ld hl, DungeonWarpList - ld de, 0 - ld a, 6 - ld [wDungeonWarpDataEntrySize], a -.dungeonWarpListLoop - ld a, [hli] - cp b - jr z, .matchedDungeonWarpDestinationMap - inc hl - jr .nextDungeonWarp -.matchedDungeonWarpDestinationMap - ld a, [hli] - cp c - jr z, .matchedDungeonWarpID -.nextDungeonWarp - ld a, [wDungeonWarpDataEntrySize] - add e - ld e, a - jr .dungeonWarpListLoop -.matchedDungeonWarpID - ld hl, DungeonWarpData - add hl, de - jr .copyWarpData2 -.otherDestination - ld a, [wDestinationMap] -.usedFlyWarp - ld b, a - ld [wCurMap], a - ld hl, FlyWarpDataPtr -.flyWarpDataPtrLoop - ld a, [hli] - inc hl - cp b - jr z, .foundFlyWarpMatch - inc hl - inc hl - jr .flyWarpDataPtrLoop -.foundFlyWarpMatch - ld a, [hli] - ld h, [hl] - ld l, a -.copyWarpData2 - ld de, wCurrentTileBlockMapViewPointer - ld c, $6 -.copyWarpDataLoop2 - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyWarpDataLoop2 - xor a ; OVERWORLD - ld [wCurMapTileset], a -.done - ld [wYOffsetSinceLastSpecialWarp], a - ld [wXOffsetSinceLastSpecialWarp], a - ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps - ld [wDestinationWarpID], a - ret +INCLUDE "engine/overworld/special_warps.asm" INCLUDE "data/special_warps.asm" -; This function appears to never be used. -; It is likely a debugging feature to give the player Tsunekazu Ishihara's -; favorite Pokemon. This is indicated by the overpowered Exeggutor, which -; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC -; interview on February 8, 2000. -; "Exeggutor is my favorite. That's because I was always using this character -; while I was debugging the program." -; http://www.ign.com/articles/2000/02/09/abc-news-pokamon-chat-transcript - -SetIshiharaTeam: - ld de, IshiharaTeam -.loop - ld a, [de] - cp $ff - ret z - ld [wcf91], a - inc de - ld a, [de] - ld [wCurEnemyLVL], a - inc de - call AddPartyMon - jr .loop - -IshiharaTeam: - db EXEGGUTOR,90 - db MEW,20 - db JOLTEON,56 - db DUGTRIO,56 - db ARTICUNO,57 - db $FF - -EmptyFunc: - ret +INCLUDE "engine/debug1.asm" INCLUDE "engine/menu/naming_screen.asm" INCLUDE "engine/oak_speech2.asm" -; subtracts the amount the player paid from their money -; sets carry flag if there is enough money and unsets carry flag if not -SubtractAmountPaidFromMoney_: - ld de,wPlayerMoney - ld hl,hMoney ; total price of items - ld c,3 ; length of money in bytes - call StringCmp - ret c - ld de,wPlayerMoney + 2 - ld hl,hMoney + 2 ; total price of items - ld c,3 ; length of money in bytes - predef SubBCDPredef ; subtract total price from money - ld a,MONEY_BOX - ld [wTextBoxID],a - call DisplayTextBoxID ; redraw money text box - and a - ret +INCLUDE "engine/subtract_paid_money.asm" -HandleItemListSwapping: - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jp nz,DisplayListMenuIDLoop ; only rearrange item list menus - push hl - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - inc hl ; hl = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] - add b - add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[hl] - pop hl - inc a - jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - and a ; has the first item to swap already been chosen? - jr nz,.swapItems -; if not, set the currently selected item as the first item - ld a,[wCurrentMenuItem] - inc a - ld b,a - ld a,[wListScrollOffset] ; index of top (visible) menu item within the list - add b - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 - call DelayFrames - jp DisplayListMenuIDLoop -.swapItems - ld a,[wCurrentMenuItem] - inc a - ld b,a - ld a,[wListScrollOffset] - add b - ld b,a - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - cp b ; is the currently selected item the same as the first item to swap? - jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself - dec a - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 - call DelayFrames - push hl - push de - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - inc hl ; hl = beginning of list entries - ld d,h - ld e,l ; de = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] - add b - add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - add a - add e - ld e,a - jr nc,.noCarry - inc d -.noCarry ; de = address of first item to swap - ld a,[de] - ld b,a - ld a,[hli] - cp b - jr z,.swapSameItemType -.swapDifferentItems - ld [$ff95],a ; [$ff95] = second item ID - ld a,[hld] - ld [$ff96],a ; [$ff96] = second item quantity - ld a,[de] - ld [hli],a ; put first item ID in second item slot - inc de - ld a,[de] - ld [hl],a ; put first item quantity in second item slot - ld a,[$ff96] - ld [de],a ; put second item quantity in first item slot - dec de - ld a,[$ff95] - ld [de],a ; put second item ID in first item slot - xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - pop de - pop hl - jp DisplayListMenuIDLoop -.swapSameItemType - inc de - ld a,[hl] - ld b,a - ld a,[de] - add b ; a = sum of both item quantities - cp a,100 ; is the sum too big for one item slot? - jr c,.combineItemSlots -; swap enough items from the first slot to max out the second slot if they can't be combined - sub a,99 - ld [de],a - ld a,99 - ld [hl],a - jr .done -.combineItemSlots - ld [hl],a ; put the sum in the second item slot - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - dec [hl] ; decrease the number of items - ld a,[hl] - ld [wListCount],a ; update number of items variable - cp a,1 - jr nz,.skipSettingMaxMenuItemID - ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID -.skipSettingMaxMenuItemID - dec de - ld h,d - ld l,e - inc hl - inc hl ; hl = address of item after first item to swap -.moveItemsUpLoop ; erase the first item slot and move up all the following item slots to fill the gap - ld a,[hli] - ld [de],a - inc de - inc a ; reached the $ff terminator? - jr z,.afterMovingItemsUp - ld a,[hli] - ld [de],a - inc de - jr .moveItemsUpLoop -.afterMovingItemsUp - xor a - ld [wListScrollOffset],a - ld [wCurrentMenuItem],a -.done - xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - pop de - pop hl - jp DisplayListMenuIDLoop +INCLUDE "engine/menu/swap_items.asm" INCLUDE "engine/overworld/pokemart.asm" - INCLUDE "engine/learn_move.asm" - INCLUDE "engine/overworld/pokecenter.asm" +INCLUDE "engine/overworld/set_blackout_map.asm" -SetLastBlackoutMap: -; Set the map to return to when -; blacking out or using Teleport or Dig. -; Safari rest houses don't count. - - push hl - ld hl, SafariZoneRestHouses - ld a, [wCurMap] - ld b, a -.loop - ld a, [hli] - cp -1 - jr z, .notresthouse - cp b - jr nz, .loop - jr .done - -.notresthouse - ld a, [wLastMap] - ld [wLastBlackoutMap], a -.done - pop hl - ret - -SafariZoneRestHouses: - db SAFARI_ZONE_REST_HOUSE_2 - db SAFARI_ZONE_REST_HOUSE_3 - db SAFARI_ZONE_REST_HOUSE_4 - db -1 - -; function that performs initialization for DisplayTextID -DisplayTextIDInit: - xor a - ld [wListMenuID],a - ld a,[wAutoTextBoxDrawingControl] - bit 0,a - jr nz,.skipDrawingTextBoxBorder - ld a,[hSpriteIndexOrTextID] ; text ID (or sprite ID) - and a - jr nz,.notStartMenu -; if text ID is 0 (i.e. the start menu) -; Note that the start menu text border is also drawn in the function directly -; below this, so this seems unnecessary. - CheckEvent EVENT_GOT_POKEDEX -; start menu with pokedex - coord hl, 10, 0 - ld b,$0e - ld c,$08 - jr nz,.drawTextBoxBorder -; start menu without pokedex - coord hl, 10, 0 - ld b,$0c - ld c,$08 - jr .drawTextBoxBorder -; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box -.notStartMenu - coord hl, 0, 12 - ld b,$04 - ld c,$12 -.drawTextBoxBorder - call TextBoxBorder -.skipDrawingTextBoxBorder - ld hl,wFontLoaded - set 0,[hl] - ld hl,wFlags_0xcd60 - bit 4,[hl] - res 4,[hl] - jr nz,.skipMovingSprites - call UpdateSprites -.skipMovingSprites -; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite -; this is done because when you talk to an NPC, they turn to look your way -; the original direction they were facing must be restored after the dialogue is over - ld hl,wSpriteStateData1 + $19 - ld c,$0f - ld de,$0010 -.spriteFacingDirectionCopyLoop - ld a,[hl] - inc h - ld [hl],a - dec h - add hl,de - dec c - jr nz,.spriteFacingDirectionCopyLoop -; loop to force all the sprites in the middle of animation to stand still -; (so that they don't like they're frozen mid-step during the dialogue) - ld hl,wSpriteStateData1 + 2 - ld de,$0010 - ld c,e -.spriteStandStillLoop - ld a,[hl] - cp a,$ff ; is the sprite visible? - jr z,.nextSprite -; if it is visible - and a,$fc - ld [hl],a -.nextSprite - add hl,de - dec c - jr nz,.spriteStandStillLoop - ld b,$9c ; window background address - call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM - xor a - ld [hWY],a ; put the window on the screen - call LoadFontTilePatterns - ld a,$01 - ld [H_AUTOBGTRANSFERENABLED],a ; enable continuous WRAM to VRAM transfer each V-blank - ret - -; function that displays the start menu -DrawStartMenu: - CheckEvent EVENT_GOT_POKEDEX -; menu with pokedex - coord hl, 10, 0 - ld b,$0e - ld c,$08 - jr nz,.drawTextBoxBorder -; shorter menu if the player doesn't have the pokedex - coord hl, 10, 0 - ld b,$0c - ld c,$08 -.drawTextBoxBorder - call TextBoxBorder - ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON - ld [wMenuWatchedKeys],a - ld a,$02 - ld [wTopMenuItemY],a ; Y position of first menu choice - ld a,$0b - ld [wTopMenuItemX],a ; X position of first menu choice - ld a,[wBattleAndStartSavedMenuItem] ; remembered menu selection from last time - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - xor a - ld [wMenuWatchMovingOutOfBounds],a - ld hl,wd730 - set 6,[hl] ; no pauses between printing each letter - coord hl, 12, 2 - CheckEvent EVENT_GOT_POKEDEX -; case for not having pokdex - ld a,$06 - jr z,.storeMenuItemCount -; case for having pokedex - ld de,StartMenuPokedexText - call PrintStartMenuItem - ld a,$07 -.storeMenuItemCount - ld [wMaxMenuItem],a ; number of menu items - ld de,StartMenuPokemonText - call PrintStartMenuItem - ld de,StartMenuItemText - call PrintStartMenuItem - ld de,wPlayerName ; player's name - call PrintStartMenuItem - ld a,[wd72e] - bit 6,a ; is the player using the link feature? -; case for not using link feature - ld de,StartMenuSaveText - jr z,.printSaveOrResetText -; case for using link feature - ld de,StartMenuResetText -.printSaveOrResetText - call PrintStartMenuItem - ld de,StartMenuOptionText - call PrintStartMenuItem - ld de,StartMenuExitText - call PlaceString - ld hl,wd730 - res 6,[hl] ; turn pauses between printing letters back on - ret - -StartMenuPokedexText: - db "POKéDEX@" - -StartMenuPokemonText: - db "POKéMON@" - -StartMenuItemText: - db "ITEM@" - -StartMenuSaveText: - db "SAVE@" - -StartMenuResetText: - db "RESET@" - -StartMenuExitText: - db "EXIT@" - -StartMenuOptionText: - db "OPTION@" - -PrintStartMenuItem: - push hl - call PlaceString - pop hl - ld de,SCREEN_WIDTH * 2 - add hl,de - ret - +INCLUDE "engine/menu/text_ids1.asm" INCLUDE "engine/overworld/cable_club_npc.asm" - -; function to draw various text boxes -DisplayTextBoxID_: - ld a,[wTextBoxID] - cp a,TWO_OPTION_MENU - jp z,DisplayTwoOptionMenu - ld c,a - ld hl,TextBoxFunctionTable - ld de,3 - call SearchTextBoxTable - jr c,.functionTableMatch - ld hl,TextBoxCoordTable - ld de,5 - call SearchTextBoxTable - jr c,.coordTableMatch - ld hl,TextBoxTextAndCoordTable - ld de,9 - call SearchTextBoxTable - jr c,.textAndCoordTableMatch -.done - ret -.functionTableMatch - ld a,[hli] - ld h,[hl] - ld l,a ; hl = address of function - ld de,.done - push de - jp [hl] ; jump to the function -.coordTableMatch - call GetTextBoxIDCoords - call GetAddressOfScreenCoords - call TextBoxBorder - ret -.textAndCoordTableMatch - call GetTextBoxIDCoords - push hl - call GetAddressOfScreenCoords - call TextBoxBorder - pop hl - call GetTextBoxIDText - ld a,[wd730] - push af - ld a,[wd730] - set 6,a ; no pauses between printing each letter - ld [wd730],a - call PlaceString - pop af - ld [wd730],a - call UpdateSprites - ret - -; function to search a table terminated with $ff for a byte matching c in increments of de -; sets carry flag if a match is found and clears carry flag if not -SearchTextBoxTable: - dec de -.loop - ld a,[hli] - cp a,$ff - jr z,.notFound - cp c - jr z,.found - add hl,de - jr .loop -.found - scf -.notFound - ret - -; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable -; INPUT: -; hl = address of coordinates -; OUTPUT: -; b = height -; c = width -; d = row of upper left corner -; e = column of upper left corner -GetTextBoxIDCoords: - ld a,[hli] ; column of upper left corner - ld e,a - ld a,[hli] ; row of upper left corner - ld d,a - ld a,[hli] ; column of lower right corner - sub e - dec a - ld c,a ; c = width - ld a,[hli] ; row of lower right corner - sub d - dec a - ld b,a ; b = height - ret - -; function to load a text address and text coordinates from the TextBoxTextAndCoordTable -GetTextBoxIDText: - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a ; de = address of text - push de ; save text address - ld a,[hli] - ld e,a ; column of upper left corner of text - ld a,[hl] - ld d,a ; row of upper left corner of text - call GetAddressOfScreenCoords - pop de ; restore text address - ret - -; function to point hl to the screen coordinates -; INPUT: -; d = row -; e = column -; OUTPUT: -; hl = address of upper left corner of text box -GetAddressOfScreenCoords: - push bc - coord hl, 0, 0 - ld bc,20 -.loop ; loop to add d rows to the base address - ld a,d - and a - jr z,.addedRows - add hl,bc - dec d - jr .loop -.addedRows - pop bc - add hl,de - ret - -; Format: -; 00: text box ID -; 01-02: function address -TextBoxFunctionTable: - dbw MONEY_BOX, DisplayMoneyBox - dbw BUY_SELL_QUIT_MENU, DoBuySellQuitMenu - dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -TextBoxCoordTable: - db MESSAGE_BOX, 0, 12, 19, 17 - db $03, 0, 0, 19, 14 - db $07, 0, 0, 11, 6 - db LIST_MENU_BOX, 4, 2, 19, 12 - db $10, 7, 0, 19, 17 - db MON_SPRITE_POPUP, 6, 4, 14, 13 - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -; 05-06: address of text -; 07: column of beginning of text -; 08: row of beginning of text -; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row] -TextBoxTextAndCoordTable: - db JP_MOCHIMONO_MENU_TEMPLATE - db 0,0,14,17 ; text box coordinates - dw JapaneseMochimonoText - db 3,0 ; text coordinates - - db USE_TOSS_MENU_TEMPLATE - db 13,10,19,14 ; text box coordinates - dw UseTossText - db 15,11 ; text coordinates - - db JP_SAVE_MESSAGE_MENU_TEMPLATE - db 0,0,7,5 ; text box coordinates - dw JapaneseSaveMessageText - db 2,2 ; text coordinates - - db JP_SPEED_OPTIONS_MENU_TEMPLATE - db 0,6,5,10 ; text box coordinates - dw JapaneseSpeedOptionsText - db 2,7 ; text coordinates - - db BATTLE_MENU_TEMPLATE - db 8,12,19,17 ; text box coordinates - dw BattleMenuText - db 10,14 ; text coordinates - - db SAFARI_BATTLE_MENU_TEMPLATE - db 0,12,19,17 ; text box coordinates - dw SafariZoneBattleMenuText - db 2,14 ; text coordinates - - db SWITCH_STATS_CANCEL_MENU_TEMPLATE - db 11,11,19,17 ; text box coordinates - dw SwitchStatsCancelText - db 13,12 ; text coordinates - - db BUY_SELL_QUIT_MENU_TEMPLATE - db 0,0,10,6 ; text box coordinates - dw BuySellQuitText - db 2,1 ; text coordinates - - db MONEY_BOX_TEMPLATE - db 11,0,19,2 ; text box coordinates - dw MoneyText - db 13,0 ; text coordinates - - db JP_AH_MENU_TEMPLATE - db 7,6,11,10 ; text box coordinates - dw JapaneseAhText - db 8,8 ; text coordinates - - db JP_POKEDEX_MENU_TEMPLATE - db 11,8,19,17 ; text box coordinates - dw JapanesePokedexMenu - db 12,10 ; text coordinates - -; note that there is no terminator - -BuySellQuitText: - db "BUY" - next "SELL" - next "QUIT@@" - -UseTossText: - db "USE" - next "TOSS@" - -JapaneseSaveMessageText: - db "きろく" - next "メッセージ@" - -JapaneseSpeedOptionsText: - db "はやい" - next "おそい@" - -MoneyText: - db "MONEY@" - -JapaneseMochimonoText: - db "もちもの@" - -JapaneseMainMenuText: - db "つづきから" - next "さいしょから@" - -BattleMenuText: - db "FIGHT ",$E1,$E2 - next "ITEM RUN@" - -SafariZoneBattleMenuText: - db "BALL× BAIT" - next "THROW ROCK RUN@" - -SwitchStatsCancelText: - db "SWITCH" - next "STATS" - next "CANCEL@" - -JapaneseAhText: - db "アッ!@" - -JapanesePokedexMenu: - db "データをみる" - next "なきごえ" - next "ぶんぷをみる" - next "キャンセル@" - -DisplayMoneyBox: - ld hl, wd730 - set 6, [hl] - ld a, MONEY_BOX_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - coord hl, 13, 1 - ld b, 1 - ld c, 6 - call ClearScreenArea - coord hl, 12, 1 - ld de, wPlayerMoney - ld c, $a3 - call PrintBCDNumber - ld hl, wd730 - res 6, [hl] - ret - -CurrencyString: - db " ¥@" - -DoBuySellQuitMenu: - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - xor a - ld [wChosenMenuItem], a - ld a, BUY_SELL_QUIT_MENU_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $2 - ld [wMaxMenuItem], a - ld a, $1 - ld [wTopMenuItemY], a - ld a, $1 - ld [wTopMenuItemX], a - xor a - ld [wCurrentMenuItem], a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd730] - res 6, a ; turn on the printing delay - ld [wd730], a - call HandleMenuInput - call PlaceUnfilledArrowMenuCursor - bit 0, a ; was A pressed? - jr nz, .pressedA - bit 1, a ; was B pressed? (always true since only A/B are watched) - jr z, .pressedA - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - jr .quit -.pressedA - ld a, CHOSE_MENU_ITEM - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - ld b, a - ld a, [wMaxMenuItem] - cp b - jr z, .quit - ret -.quit - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - scf - ret - -; displays a menu with two options to choose from -; b = Y of upper left corner of text region -; c = X of upper left corner of text region -; hl = address where the text box border should be drawn -DisplayTwoOptionMenu: - push hl - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - -; pointless because both values are overwritten before they are read - xor a - ld [wChosenMenuItem], a - ld [wMenuExitMethod], a - - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $1 - ld [wMaxMenuItem], a - ld a, b - ld [wTopMenuItemY], a - ld a, c - ld [wTopMenuItemX], a - xor a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - push hl - ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] - jr z, .storeCurrentMenuItem - inc a -.storeCurrentMenuItem - ld [wCurrentMenuItem], a - pop hl - push hl - push hl - call TwoOptionMenu_SaveScreenTiles - ld a, [wTwoOptionMenuID] - ld hl, TwoOptionMenuStrings - ld e, a - ld d, $0 - ld a, $5 -.menuStringLoop - add hl, de - dec a - jr nz, .menuStringLoop - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld e, l - ld d, h - pop hl - push de - ld a, [wTwoOptionMenuID] - cp TRADE_CANCEL_MENU - jr nz, .notTradeCancelMenu - call CableClub_TextBoxBorder - jr .afterTextBoxBorder -.notTradeCancelMenu - call TextBoxBorder -.afterTextBoxBorder - call UpdateSprites - pop hl - ld a, [hli] - and a ; put blank line before first menu item? - ld bc, 20 + 2 - jr z, .noBlankLine - ld bc, 2 * 20 + 2 -.noBlankLine - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - pop hl - add hl, bc - call PlaceString - ld hl, wd730 - res 6, [hl] ; turn on the printing delay - ld a, [wTwoOptionMenuID] - cp NO_YES_MENU - jr nz, .notNoYesMenu -; No/Yes menu -; this menu type ignores the B button -; it only seems to be used when confirming the deletion of a save file - xor a - ld [wTwoOptionMenuID], a - ld a, [wFlags_0xcd60] - push af - push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] - set 5, [hl] ; don't play sound when A or B is pressed in menu - pop hl -.noYesMenuInputLoop - call HandleMenuInput - bit 1, a ; A button pressed? - jr nz, .noYesMenuInputLoop ; try again if A was not pressed - pop af - pop hl - ld [wFlags_0xcd60], a - ld a, SFX_PRESS_AB - call PlaySound - jr .pressedAButton -.notNoYesMenu - xor a - ld [wTwoOptionMenuID], a - call HandleMenuInput - pop hl - bit 1, a ; A button pressed? - jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed -.pressedAButton - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - and a - jr nz, .choseSecondMenuItem -; chose first menu item - ld a, CHOSE_FIRST_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - and a - ret -.choseSecondMenuItem - ld a, 1 - ld [wCurrentMenuItem], a - ld [wChosenMenuItem], a - ld a, CHOSE_SECOND_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - scf - ret - -; Some of the wider/taller two option menus will not have the screen areas -; they cover be fully saved/restored by the two functions below. -; The bottom and right edges of the menu may remain after the function returns. - -TwoOptionMenu_SaveScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, $6 - dec b - jr nz, .loop - ret - -TwoOptionMenu_RestoreScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, 6 - dec b - jr nz, .loop - call UpdateSprites - ret - -; Format: -; 00: byte width -; 01: byte height -; 02: byte put blank line before first menu item -; 03: word text pointer -TwoOptionMenuStrings: - db 4,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthWestMenu - db 6,3,0 - dw .SouthEastMenu - db 6,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthEastMenu - db 7,3,0 - dw .TradeCancelMenu - db 7,4,1 - dw .HealCancelMenu - db 4,3,0 - dw .NoYesMenu - -.NoYesMenu ; 7699 (1:3699) - db "NO",$4E,"YES@" -.YesNoMenu ; 76a0 (1:36a0) - db "YES",$4E,"NO@" -.NorthWestMenu ; 76a7 (1:36a7) - db "NORTH",$4E,"WEST@" -.SouthEastMenu ; 76b2 (1:36b2) - db "SOUTH",$4E,"EAST@" -.NorthEastMenu ; 76bd (1:36bd) - db "NORTH",$4E,"EAST@" -.TradeCancelMenu ; 76c8 (1:36c8) - db "TRADE",$4E,"CANCEL@" -.HealCancelMenu ; 76d5 (1:36d5) - db "HEAL",$4E,"CANCEL@" - -DisplayFieldMoveMonMenu: - xor a - ld hl, wFieldMoves - ld [hli], a ; wFieldMoves - ld [hli], a ; wFieldMoves + 1 - ld [hli], a ; wFieldMoves + 2 - ld [hli], a ; wFieldMoves + 3 - ld [hli], a ; wNumFieldMoves - ld [hl], 12 ; wFieldMovesLeftmostXCoord - call GetMonFieldMoves - ld a, [wNumFieldMoves] - and a - jr nz, .fieldMovesExist - -; no field moves - coord hl, 11, 11 - ld b, 5 - ld c, 7 - call TextBoxBorder - call UpdateSprites - ld a, 12 - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 13, 12 - ld de, PokemonMenuEntries - jp PlaceString - -.fieldMovesExist - push af - -; Calculate the text box position and dimensions based on the leftmost X coord -; of the field move names before adjusting for the number of field moves. - coord hl, 0, 11 - ld a, [wFieldMovesLeftmostXCoord] - dec a - ld e, a - ld d, 0 - add hl, de - ld b, 5 - ld a, 18 - sub e - ld c, a - pop af - -; For each field move, move the top of the text box up 2 rows while the leaving -; the bottom of the text box at the bottom of the screen. - ld de, -SCREEN_WIDTH * 2 -.textBoxHeightLoop - add hl, de - inc b - inc b - dec a - jr nz, .textBoxHeightLoop - -; Make space for an extra blank row above the top field move. - ld de, -SCREEN_WIDTH - add hl, de - inc b - - call TextBoxBorder - call UpdateSprites - -; Calculate the position of the first field move name to print. - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, -SCREEN_WIDTH * 2 - ld a, [wNumFieldMoves] -.calcFirstFieldMoveYLoop - add hl, de - dec a - jr nz, .calcFirstFieldMoveYLoop - - xor a - ld [wNumFieldMoves], a - ld de, wFieldMoves -.printNamesLoop - push hl - ld hl, FieldMoveNames - ld a, [de] - and a - jr z, .donePrintingNames - inc de - ld b, a ; index of name -.skipNamesLoop ; skip past names before the name we want - dec b - jr z, .reachedName -.skipNameLoop ; skip past current name - ld a, [hli] - cp "@" - jr nz, .skipNameLoop - jr .skipNamesLoop -.reachedName - ld b, h - ld c, l - pop hl - push de - ld d, b - ld e, c - call PlaceString - ld bc, SCREEN_WIDTH * 2 - add hl, bc - pop de - jr .printNamesLoop - -.donePrintingNames - pop hl - ld a, [wFieldMovesLeftmostXCoord] - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, PokemonMenuEntries - jp PlaceString - -FieldMoveNames: - db "CUT@" - db "FLY@" - db "@" - db "SURF@" - db "STRENGTH@" - db "FLASH@" - db "DIG@" - db "TELEPORT@" - db "SOFTBOILED@" - -PokemonMenuEntries: - db "STATS" - next "SWITCH" - next "CANCEL@" - -GetMonFieldMoves: - ld a, [wWhichPokemon] - ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld d, h - ld e, l - ld c, NUM_MOVES + 1 - ld hl, wFieldMoves -.loop - push hl -.nextMove - dec c - jr z, .done - ld a, [de] ; move ID - and a - jr z, .done - ld b, a - inc de - ld hl, FieldMoveDisplayData -.fieldMoveLoop - ld a, [hli] - cp $ff - jr z, .nextMove ; if the move is not a field move - cp b - jr z, .foundFieldMove - inc hl - inc hl - jr .fieldMoveLoop -.foundFieldMove - ld a, b - ld [wLastFieldMoveID], a - ld a, [hli] ; field move name index - ld b, [hl] ; field move leftmost X coordinate - pop hl - ld [hli], a ; store name index in wFieldMoves - ld a, [wNumFieldMoves] - inc a - ld [wNumFieldMoves], a - ld a, [wFieldMovesLeftmostXCoord] - cp b - jr c, .skipUpdatingLeftmostXCoord - ld a, b - ld [wFieldMovesLeftmostXCoord], a -.skipUpdatingLeftmostXCoord - ld a, [wLastFieldMoveID] - ld b, a - jr .loop -.done - pop hl - ret - -; Format: [Move id], [name index], [leftmost tile] -; Move id = id of move -; Name index = index of name in FieldMoveNames -; Leftmost tile = -1 + tile column in which the first letter of the move's name should be displayed -; "SOFTBOILED" is $08 because it has 4 more letters than "SURF", for example, whose value is $0C -FieldMoveDisplayData: - db CUT, $01, $0C - db FLY, $02, $0C - db $B4, $03, $0C ; unused field move - db SURF, $04, $0C - db STRENGTH, $05, $0A - db FLASH, $06, $0C - db DIG, $07, $0C - db TELEPORT, $08, $0A - db SOFTBOILED, $09, $08 - db $ff ; list terminator - +INCLUDE "engine/menu/text_ids2.asm" INCLUDE "engine/battle/moveEffects/drain_hp_effect.asm" - INCLUDE "engine/menu/players_pc.asm" - -_RemovePokemon: - ld hl, wPartyCount - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7b74 - ld hl, wNumInBox -.asm_7b74 - ld a, [hl] - dec a - ld [hli], a - ld a, [wWhichPokemon] - ld c, a - ld b, $0 - add hl, bc - ld e, l - ld d, h - inc de -.asm_7b81 - ld a, [de] - inc de - ld [hli], a - inc a - jr nz, .asm_7b81 - ld hl, wPartyMonOT - ld d, $5 - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7b97 - ld hl, wBoxMonOT - ld d, $13 -.asm_7b97 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld a, [wWhichPokemon] - cp d - jr nz, .asm_7ba6 - ld [hl], $ff - ret -.asm_7ba6 - ld d, h - ld e, l - ld bc, NAME_LENGTH - add hl, bc - ld bc, wPartyMonNicks - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bb8 - ld bc, wBoxMonNicks -.asm_7bb8 - call CopyDataUntil - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bcd - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 -.asm_7bcd - ld a, [wWhichPokemon] - call AddNTimes - ld d, h - ld e, l - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7be4 - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld bc, wBoxMonOT - jr .asm_7beb -.asm_7be4 - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - ld bc, wPartyMonOT -.asm_7beb - call CopyDataUntil - ld hl, wPartyMonNicks - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bfa - ld hl, wBoxMonNicks -.asm_7bfa - ld bc, NAME_LENGTH - ld a, [wWhichPokemon] - call AddNTimes - ld d, h - ld e, l - ld bc, NAME_LENGTH - add hl, bc - ld bc, wPokedexOwned - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7c15 - ld bc, wBoxMonNicksEnd -.asm_7c15 - jp CopyDataUntil - -_DisplayPokedex: - ld hl, wd730 - set 6, [hl] - predef ShowPokedexData - ld hl, wd730 - res 6, [hl] - call ReloadMapData - ld c, 10 - call DelayFrames - predef IndexToPokedex - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - ld hl, wPokedexSeen - predef FlagActionPredef - ld a, $1 - ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ret +INCLUDE "engine/remove_pokemon.asm" +INCLUDE "engine/display_pokedex.asm" -SECTION "bank3",ROMX,BANK[$3] +SECTION "bank03",ROMX,BANK[$03] INCLUDE "engine/joypad.asm" -INCLUDE "data/map_songs.asm" - -INCLUDE "data/map_header_banks.asm" - -ClearVariablesAfterLoadingMapData: - ld a, SCREEN_HEIGHT_PIXELS - ld [hWY], a - ld [rWY], a - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld [wStepCounter], a - ld [wLoneAttackNo], a - ld [hJoyPressed], a - ld [hJoyReleased], a - ld [hJoyHeld], a - ld [wActionResultOrTookBattleTurn], a - ld [wUnusedD5A3], a - ld hl, wCardKeyDoorY - ld [hli], a - ld [hl], a - ld hl, wWhichTrade - ld bc, wStandingOnWarpPadOrHole - wWhichTrade - call FillMemory - ret - -; only used for setting bit 2 of wd736 upon entering a new map -IsPlayerStandingOnWarp: - ld a, [wNumberOfWarps] - and a - ret z - ld c, a - ld hl, wWarpEntries -.loop - ld a, [wYCoord] - cp [hl] - jr nz, .nextWarp1 - inc hl - ld a, [wXCoord] - cp [hl] - jr nz, .nextWarp2 - inc hl - ld a, [hli] ; target warp - ld [wDestinationWarpID], a - ld a, [hl] ; target map - ld [hWarpDestinationMap], a - ld hl, wd736 - set 2, [hl] ; standing on warp flag - ret -.nextWarp1 - inc hl -.nextWarp2 - inc hl - inc hl - inc hl - dec c - jr nz, .loop - ret - -CheckForceBikeOrSurf: - ld hl, wd732 - bit 5, [hl] - ret nz - ld hl, ForcedBikeOrSurfMaps - ld a, [wYCoord] - ld b, a - ld a, [wXCoord] - ld c, a - ld a, [wCurMap] - ld d, a -.loop - ld a, [hli] - cp $ff - ret z ;if we reach FF then it's not part of the list - cp d ;compare to current map - jr nz, .incorrectMap - ld a, [hli] - cp b ;compare y-coord - jr nz, .incorrectY - ld a, [hli] - cp c ;compare x-coord - jr nz, .loop ; incorrect x-coord, check next item - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_4 - ld a, $2 - ld [wSeafoamIslands4CurScript], a - jr z, .forceSurfing - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_5 - ld a, $2 - ld [wSeafoamIslands5CurScript], a - jr z, .forceSurfing - ;force bike riding - ld hl, wd732 - set 5, [hl] - ld a, $1 - ld [wWalkBikeSurfState], a - ld [wWalkBikeSurfStateCopy], a - jp ForceBikeOrSurf -.incorrectMap - inc hl -.incorrectY - inc hl - jr .loop -.forceSurfing - ld a, $2 - ld [wWalkBikeSurfState], a - ld [wWalkBikeSurfStateCopy], a - jp ForceBikeOrSurf - -INCLUDE "data/force_bike_surf.asm" - -IsPlayerFacingEdgeOfMap: - push hl - push de - push bc - ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction - srl a - ld c, a - ld b, $0 - ld hl, .functionPointerTable - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wYCoord] - ld b, a - ld a, [wXCoord] - ld c, a - ld de, .asm_c41e - push de - jp [hl] -.asm_c41e - pop bc - pop de - pop hl - ret - -.functionPointerTable - dw .facingDown - dw .facingUp - dw .facingLeft - dw .facingRight - -.facingDown - ld a, [wCurMapHeight] - add a - dec a - cp b - jr z, .setCarry - jr .resetCarry - -.facingUp - ld a, b - and a - jr z, .setCarry - jr .resetCarry - -.facingLeft - ld a, c - and a - jr z, .setCarry - jr .resetCarry - -.facingRight - ld a, [wCurMapWidth] - add a - dec a - cp c - jr z, .setCarry - jr .resetCarry -.resetCarry - and a - ret -.setCarry - scf - ret - -IsWarpTileInFrontOfPlayer: - push hl - push de - push bc - call _GetTileAndCoordsInFrontOfPlayer - ld a, [wCurMap] - cp SS_ANNE_5 - jr z, .ssAnne5 - ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction - srl a - ld c, a - ld b, 0 - ld hl, .warpTileListPointers - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wTileInFrontOfPlayer] - ld de, $1 - call IsInArray -.done - pop bc - pop de - pop hl - ret - -.warpTileListPointers: - dw .facingDownWarpTiles - dw .facingUpWarpTiles - dw .facingLeftWarpTiles - dw .facingRightWarpTiles - -.facingDownWarpTiles - db $01,$12,$17,$3D,$04,$18,$33,$FF - -.facingUpWarpTiles - db $01,$5C,$FF - -.facingLeftWarpTiles - db $1A,$4B,$FF - -.facingRightWarpTiles - db $0F,$4E,$FF - -.ssAnne5 - ld a, [wTileInFrontOfPlayer] - cp $15 - jr nz, .notSSAnne5Warp - scf - jr .done -.notSSAnne5Warp - and a - jr .done - -IsPlayerStandingOnDoorTileOrWarpTile: - push hl - push de - push bc - callba IsPlayerStandingOnDoorTile - jr c, .done - ld a, [wCurMapTileset] - add a - ld c, a - ld b, $0 - ld hl, WarpTileIDPointers - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld de, $1 - aCoord 8, 9 - call IsInArray - jr nc, .done - ld hl, wd736 - res 2, [hl] -.done - pop bc - pop de - pop hl - ret - -INCLUDE "data/warp_tile_ids.asm" - -PrintSafariZoneSteps: - ld a, [wCurMap] - cp SAFARI_ZONE_EAST - ret c - cp UNKNOWN_DUNGEON_2 - ret nc - coord hl, 0, 0 - ld b, 3 - ld c, 7 - call TextBoxBorder - coord hl, 1, 1 - ld de, wSafariSteps - lb bc, 2, 3 - call PrintNumber - coord hl, 4, 1 - ld de, SafariSteps - call PlaceString - coord hl, 1, 3 - ld de, SafariBallText - call PlaceString - ld a, [wNumSafariBalls] - cp 10 - jr nc, .asm_c56d - coord hl, 5, 3 - ld a, " " - ld [hl], a -.asm_c56d - coord hl, 6, 3 - ld de, wNumSafariBalls - lb bc, 1, 2 - jp PrintNumber - -SafariSteps: - db "/500@" - -SafariBallText: - db "BALL×× @" - -GetTileAndCoordsInFrontOfPlayer: - call GetPredefRegisters - -_GetTileAndCoordsInFrontOfPlayer: - ld a, [wYCoord] - ld d, a - ld a, [wXCoord] - ld e, a - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - and a ; cp SPRITE_FACING_DOWN - jr nz, .notFacingDown -; facing down - aCoord 8, 11 - inc d - jr .storeTile -.notFacingDown - cp SPRITE_FACING_UP - jr nz, .notFacingUp -; facing up - aCoord 8, 7 - dec d - jr .storeTile -.notFacingUp - cp SPRITE_FACING_LEFT - jr nz, .notFacingLeft -; facing left - aCoord 6, 9 - dec e - jr .storeTile -.notFacingLeft - cp SPRITE_FACING_RIGHT - jr nz, .storeTile -; facing right - aCoord 10, 9 - inc e -.storeTile - ld c, a - ld [wTileInFrontOfPlayer], a - ret - -GetTileTwoStepsInFrontOfPlayer: - xor a - ld [$ffdb], a - ld hl, wYCoord - ld a, [hli] - ld d, a - ld e, [hl] - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - and a ; cp SPRITE_FACING_DOWN - jr nz, .notFacingDown -; facing down - ld hl, $ffdb - set 0, [hl] - aCoord 8, 13 - inc d - jr .storeTile -.notFacingDown - cp SPRITE_FACING_UP - jr nz, .notFacingUp -; facing up - ld hl, $ffdb - set 1, [hl] - aCoord 8, 5 - dec d - jr .storeTile -.notFacingUp - cp SPRITE_FACING_LEFT - jr nz, .notFacingLeft -; facing left - ld hl, $ffdb - set 2, [hl] - aCoord 4, 9 - dec e - jr .storeTile -.notFacingLeft - cp SPRITE_FACING_RIGHT - jr nz, .storeTile -; facing right - ld hl, $ffdb - set 3, [hl] - aCoord 12, 9 - inc e -.storeTile - ld c, a - ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a - ld [wTileInFrontOfPlayer], a - ret - -CheckForCollisionWhenPushingBoulder: - call GetTileTwoStepsInFrontOfPlayer - ld hl, wTileSetCollisionPtr - ld a, [hli] - ld h, [hl] - ld l, a -.loop - ld a, [hli] - cp $ff - jr z, .done ; if the tile two steps ahead is not passable - cp c - jr nz, .loop - ld hl, TilePairCollisionsLand - call CheckForTilePairCollisions2 - ld a, $ff - jr c, .done ; if there is an elevation difference between the current tile and the one two steps ahead - ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] - cp $15 ; stairs tile - ld a, $ff - jr z, .done ; if the tile two steps ahead is stairs - call CheckForBoulderCollisionWithSprites -.done - ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a - ret - -; sets a to $ff if there is a collision and $00 if there is no collision -CheckForBoulderCollisionWithSprites: - ld a, [wBoulderSpriteIndex] - dec a - swap a - ld d, 0 - ld e, a - ld hl, wSpriteStateData2 + $14 - add hl, de - ld a, [hli] ; map Y position - ld [$ffdc], a - ld a, [hl] ; map X position - ld [$ffdd], a - ld a, [wNumSprites] - ld c, a - ld de, $f - ld hl, wSpriteStateData2 + $14 - ld a, [$ffdb] - and $3 ; facing up or down? - jr z, .pushingHorizontallyLoop -.pushingVerticallyLoop - inc hl - ld a, [$ffdd] - cp [hl] - jr nz, .nextSprite1 ; if X coordinates don't match - dec hl - ld a, [hli] - ld b, a - ld a, [$ffdb] - rrca - jr c, .pushingDown -; pushing up - ld a, [$ffdc] - dec a - jr .compareYCoords -.pushingDown - ld a, [$ffdc] - inc a -.compareYCoords - cp b - jr z, .failure -.nextSprite1 - dec c - jr z, .success - add hl, de - jr .pushingVerticallyLoop -.pushingHorizontallyLoop - ld a, [hli] - ld b, a - ld a, [$ffdc] - cp b - jr nz, .nextSprite2 - ld b, [hl] - ld a, [$ffdb] - bit 2, a - jr nz, .pushingLeft -; pushing right - ld a, [$ffdd] - inc a - jr .compareXCoords -.pushingLeft - ld a, [$ffdd] - dec a -.compareXCoords - cp b - jr z, .failure -.nextSprite2 - dec c - jr z, .success - add hl, de - jr .pushingHorizontallyLoop -.failure - ld a, $ff - ret -.success - xor a - ret - -ApplyOutOfBattlePoisonDamage: - ld a, [wd730] - add a - jp c, .noBlackOut ; no black out if joypad states are being simulated - ld a, [wPartyCount] - and a - jp z, .noBlackOut - call IncrementDayCareMonExp - ld a, [wStepCounter] - and $3 ; is the counter a multiple of 4? - jp nz, .noBlackOut ; only apply poison damage every fourth step - ld [wWhichPokemon], a - ld hl, wPartyMon1Status - ld de, wPartySpecies -.applyDamageLoop - ld a, [hl] - and (1 << PSN) - jr z, .nextMon2 ; not poisoned - dec hl - dec hl - ld a, [hld] - ld b, a - ld a, [hli] - or b - jr z, .nextMon ; already fainted -; subtract 1 from HP - ld a, [hl] - dec a - ld [hld], a - inc a - jr nz, .noBorrow -; borrow 1 from upper byte of HP - dec [hl] - inc hl - jr .nextMon -.noBorrow - ld a, [hli] - or [hl] - jr nz, .nextMon ; didn't faint from damage -; the mon fainted from the damage - push hl - inc hl - inc hl - ld [hl], a - ld a, [de] - ld [wd11e], a - push de - ld a, [wWhichPokemon] - ld hl, wPartyMonNicks - call GetPartyMonName - xor a - ld [wJoyIgnore], a - call EnableAutoTextBoxDrawing - ld a, $d0 - ld [hSpriteIndexOrTextID], a - call DisplayTextID - pop de - pop hl -.nextMon - inc hl - inc hl -.nextMon2 - inc de - ld a, [de] - inc a - jr z, .applyDamageLoopDone - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - push hl - ld hl, wWhichPokemon - inc [hl] - pop hl - jr .applyDamageLoop -.applyDamageLoopDone - ld hl, wPartyMon1Status - ld a, [wPartyCount] - ld d, a - ld e, 0 -.countPoisonedLoop - ld a, [hl] - and (1 << PSN) - or e - ld e, a - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - dec d - jr nz, .countPoisonedLoop - ld a, e - and a ; are any party members poisoned? - jr z, .skipPoisonEffectAndSound - ld b, $2 - predef ChangeBGPalColor0_4Frames ; change BG white to dark grey for 4 frames - ld a, SFX_POISONED - call PlaySound -.skipPoisonEffectAndSound - predef AnyPartyAlive - ld a, d - and a - jr nz, .noBlackOut - call EnableAutoTextBoxDrawing - ld a, $d1 - ld [hSpriteIndexOrTextID], a - call DisplayTextID - ld hl, wd72e - set 5, [hl] - ld a, $ff - jr .done -.noBlackOut - xor a -.done - ld [wOutOfBattleBlackout], a - ret - -LoadTilesetHeader: - call GetPredefRegisters - push hl - ld d, 0 - ld a, [wCurMapTileset] - add a - add a - ld b, a - add a - add b ; a = tileset * 12 - jr nc, .noCarry - inc d -.noCarry - ld e, a - ld hl, Tilesets - add hl, de - ld de, wTileSetBank - ld c, $b -.copyTilesetHeaderLoop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyTilesetHeaderLoop - ld a, [hl] - ld [hTilesetType], a - xor a - ld [$ffd8], a - pop hl - ld a, [wCurMapTileset] - push hl - push de - ld hl, DungeonTilesets - ld de, $1 - call IsInArray - pop de - pop hl - jr c, .asm_c797 - ld a, [wCurMapTileset] - ld b, a - ld a, [hPreviousTileset] - cp b - jr z, .done -.asm_c797 - ld a, [wDestinationWarpID] - cp $ff - jr z, .done - call LoadDestinationWarpPosition - ld a, [wYCoord] - and $1 - ld [wYBlockCoord], a - ld a, [wXCoord] - and $1 - ld [wXBlockCoord], a -.done - ret - -INCLUDE "data/dungeon_tilesets.asm" - -INCLUDE "data/tileset_headers.asm" - -IncrementDayCareMonExp: - ld a, [wDayCareInUse] - and a - ret z - ld hl, wDayCareMonExp + 2 - inc [hl] - ret nz - dec hl - inc [hl] - ret nz - dec hl - inc [hl] - ld a, [hl] - cp $50 - ret c - ld a, $50 - ld [hl], a - ret +INCLUDE "engine/overworld/clear_loadmapdata_vars.asm" +INCLUDE "engine/overworld/check_player_state.asm" +INCLUDE "engine/overworld/print_safari_steps.asm" +INCLUDE "engine/overworld/get_coords_tile_in_front_of_player.asm" +INCLUDE "engine/overworld/boulders.asm" +INCLUDE "engine/overworld/step_functions.asm" +INCLUDE "engine/overworld/load_tileset_header.asm" +INCLUDE "engine/overworld/daycare_exp.asm" INCLUDE "data/hide_show_data.asm" -PrintStrengthTxt: - ld hl, wd728 - set 0, [hl] - ld hl, UsedStrengthText - call PrintText - ld hl, CanMoveBouldersText - jp PrintText - -UsedStrengthText: - TX_FAR _UsedStrengthText - TX_ASM - ld a, [wcf91] - call PlayCry - call Delay3 - jp TextScriptEnd - -CanMoveBouldersText: - TX_FAR _CanMoveBouldersText - db "@" - -IsSurfingAllowed: -; Returns whether surfing is allowed in bit 1 of wd728. -; Surfing isn't allowed on the Cycling Road or in the lowest level of the -; Seafoam Islands before the current has been slowed with boulders. - ld hl, wd728 - set 1, [hl] - ld a, [wd732] - bit 5, a - jr nz, .forcedToRideBike - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_5 - ret nz - CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE - ret z - ld hl, CoordsData_cdf7 - call ArePlayerCoordsInArray - ret nc - ld hl, wd728 - res 1, [hl] - ld hl, CurrentTooFastText - jp PrintText -.forcedToRideBike - ld hl, wd728 - res 1, [hl] - ld hl, CyclingIsFunText - jp PrintText - -CoordsData_cdf7: - db $0B,$07,$FF - -CurrentTooFastText: - TX_FAR _CurrentTooFastText - db "@" - -CyclingIsFunText: - TX_FAR _CyclingIsFunText - db "@" - -; function to add an item (in varying quantities) to the player's bag or PC box -; INPUT: -; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID -; [wItemQuantity] = item quantity -; sets carry flag if successful, unsets carry flag if unsuccessful -AddItemToInventory_: - ld a,[wItemQuantity] ; a = item quantity - push af - push bc - push de - push hl - push hl - ld d,PC_ITEM_CAPACITY ; how many items the PC can hold - ld a,wNumBagItems & $FF - cp l - jr nz,.checkIfInventoryFull - ld a,wNumBagItems >> 8 - cp h - jr nz,.checkIfInventoryFull -; if the destination is the bag - ld d,BAG_ITEM_CAPACITY ; how many items the bag can hold -.checkIfInventoryFull - ld a,[hl] - sub d - ld d,a - ld a,[hli] - and a - jr z,.addNewItem -.loop - ld a,[hli] - ld b,a ; b = ID of current item in table - ld a,[wcf91] ; a = ID of item being added - 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 - ld a,[hl] - cp a,$ff ; is it the end of the table? - jr nz,.loop -.addNewItem ; add an item not yet in the inventory - pop hl - ld a,d - and a ; is there room for a new item slot? - jr z,.done -; if there is room - inc [hl] ; increment the number of items in the inventory - ld a,[hl] ; the number of items will be the index of the new item - add a - dec a - ld c,a - ld b,0 - add hl,bc ; hl = address to store the item - ld a,[wcf91] - ld [hli],a ; store item ID - ld a,[wItemQuantity] - ld [hli],a ; store item quantity - ld [hl],$ff ; store terminator - jp .success -.increaseItemQuantity ; increase the quantity of an item already in the inventory - ld a,[wItemQuantity] - ld b,a ; b = quantity to add - ld a,[hl] ; a = existing item quantity - add b ; a = new item quantity - cp a,100 - jp c,.storeNewQuantity ; if the new quantity is less than 100, store it -; if the new quantity is greater than or equal to 100, -; try to max out the current slot and add the rest in a new slot - sub a,99 - ld [wItemQuantity],a ; a = amount left over (to put in the new slot) - ld a,d - and a ; is there room for a new item slot? - jr z,.increaseItemQuantityFailed -; if so, store 99 in the current slot and store the rest in a new slot - ld a,99 - ld [hli],a - jp .loop -.increaseItemQuantityFailed - pop hl - and a - jr .done -.storeNewQuantity - ld [hl],a - pop hl -.success - scf -.done - pop hl - pop de - pop bc - pop bc - ld a,b - ld [wItemQuantity],a ; restore the initial value from when the function was called - ret - -; function to remove an item (in varying quantities) from the player's bag or PC box -; INPUT: -; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wWhichPokemon] = index (within the inventory) of the item to remove -; [wItemQuantity] = quantity to remove -RemoveItemFromInventory_: - push hl - inc hl - ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed - sla a - add l - ld l,a - jr nc,.noCarry - inc h -.noCarry - inc hl - ld a,[wItemQuantity] ; quantity being removed - ld e,a - ld a,[hl] ; a = current quantity - sub e - ld [hld],a ; store new quantity - ld [wMaxItemQuantity],a - and a - jr nz,.skipMovingUpSlots -; if the remaining quantity is 0, -; remove the emptied item slot and move up all the following item slots -.moveSlotsUp - ld e,l - ld d,h - inc de - inc de ; de = address of the slot following the emptied one -.loop ; loop to move up the following slots - ld a,[de] - inc de - ld [hli],a - cp a,$ff - jr nz,.loop -; update menu info - xor a - ld [wListScrollOffset],a - ld [wCurrentMenuItem],a - ld [wBagSavedMenuItem],a - ld [wSavedListScrollOffset],a - pop hl - ld a,[hl] ; a = number of items in inventory - dec a ; decrement the number of items - ld [hl],a ; store new number of items - ld [wListCount],a - cp a,2 - jr c,.done - ld [wMaxMenuItem],a - jr .done -.skipMovingUpSlots - pop hl -.done - ret - -; wild pokemon data: from 4EB8 to 55C7 - -LoadWildData: - ld hl,WildDataPointers - ld a,[wCurMap] - - ; get wild data for current map - ld c,a - ld b,0 - add hl,bc - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a ; hl now points to wild data for current map - ld a,[hli] - ld [wGrassRate],a - and a - jr z,.NoGrassData ; if no grass data, skip to surfing data - push hl - ld de,wGrassMons ; otherwise, load grass data - ld bc,$0014 - call CopyData - pop hl - ld bc,$0014 - add hl,bc -.NoGrassData - ld a,[hli] - ld [wWaterRate],a - and a - ret z ; if no water data, we're done - ld de,wWaterMons ; otherwise, load surfing data - ld bc,$0014 - jp CopyData - -INCLUDE "data/wild_mons.asm" +INCLUDE "engine/overworld/load_wild_data.asm" INCLUDE "engine/items/items.asm" -DrawBadges: -; Draw 4x2 gym leader faces, with the faces replaced by -; badges if they are owned. Used in the player status screen. - -; In Japanese versions, names are displayed above faces. -; Instead of removing relevant code, the name graphics were erased. - -; Tile ids for face/badge graphics. - ld de, wBadgeOrFaceTiles - ld hl, .FaceBadgeTiles - ld bc, 8 - call CopyData - -; Booleans for each badge. - ld hl, wTempObtainedBadgesBooleans - ld bc, 8 - xor a - call FillMemory - -; Alter these based on owned badges. - ld de, wTempObtainedBadgesBooleans - ld hl, wBadgeOrFaceTiles - ld a, [wObtainedBadges] - ld b, a - ld c, 8 -.CheckBadge - srl b - jr nc, .NextBadge - ld a, [hl] - add 4 ; Badge graphics are after each face - ld [hl], a - ld a, 1 - ld [de], a -.NextBadge - inc hl - inc de - dec c - jr nz, .CheckBadge - -; Draw two rows of badges. - ld hl, wBadgeNumberTile - ld a, $d8 ; [1] - ld [hli], a - ld [hl], $60 ; First name - - coord hl, 2, 11 - ld de, wTempObtainedBadgesBooleans - call .DrawBadgeRow - - coord hl, 2, 14 - ld de, wTempObtainedBadgesBooleans + 4 -; call .DrawBadgeRow -; ret - -.DrawBadgeRow ; ea4c (3:6a4c) -; Draw 4 badges. - - ld c, 4 -.DrawBadge - push de - push hl - -; Badge no. - ld a, [wBadgeNumberTile] - ld [hli], a - inc a - ld [wBadgeNumberTile], a - -; Names aren't printed if the badge is owned. - ld a, [de] - and a - ld a, [wBadgeNameTile] - jr nz, .SkipName - call .PlaceTiles - jr .PlaceBadge - -.SkipName - inc a - inc a - inc hl - -.PlaceBadge - ld [wBadgeNameTile], a - ld de, SCREEN_WIDTH - 1 - add hl, de - ld a, [wBadgeOrFaceTiles] - call .PlaceTiles - add hl, de - call .PlaceTiles - -; Shift badge array back one byte. - push bc - ld hl, wBadgeOrFaceTiles + 1 - ld de, wBadgeOrFaceTiles - ld bc, 8 - call CopyData - pop bc - - pop hl - ld de, 4 - add hl, de - - pop de - inc de - dec c - jr nz, .DrawBadge - ret - -.PlaceTiles - ld [hli], a - inc a - ld [hl], a - inc a - ret - -.FaceBadgeTiles - db $20, $28, $30, $38, $40, $48, $50, $58 - -GymLeaderFaceAndBadgeTileGraphics: - INCBIN "gfx/badges.2bpp" - -; replaces a tile block with the one specified in [wNewTileBlockID] -; and redraws the map view if necessary -; b = Y -; c = X -ReplaceTileBlock: - call GetPredefRegisters - ld hl, wOverworldMap - ld a, [wCurMapWidth] - add $6 - ld e, a - ld d, $0 - add hl, de - add hl, de - add hl, de - ld e, $3 - add hl, de - ld e, a - ld a, b - and a - jr z, .addX -; add width * Y -.addWidthYTimesLoop - add hl, de - dec b - jr nz, .addWidthYTimesLoop -.addX - add hl, bc ; add X - ld a, [wNewTileBlockID] - ld [hl], a - ld a, [wCurrentTileBlockMapViewPointer] - ld c, a - ld a, [wCurrentTileBlockMapViewPointer + 1] - ld b, a - call CompareHLWithBC - ret c ; return if the replaced tile block is below the map view in memory - push hl - ld l, e - ld h, $0 - ld e, $6 - ld d, h - add hl, hl - add hl, hl - add hl, de - add hl, bc - pop bc - call CompareHLWithBC - ret c ; return if the replaced tile block is above the map view in memory - -RedrawMapView: - ld a, [wIsInBattle] - inc a - ret z - ld a, [H_AUTOBGTRANSFERENABLED] - push af - ld a, [hTilesetType] - push af - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld [hTilesetType], a ; no flower/water BG tile animations - call LoadCurrentMapView - call RunDefaultPaletteCommand - ld hl, wMapViewVRAMPointer - ld a, [hli] - ld h, [hl] - ld l, a - ld de, -2 * 32 - add hl, de - ld a, h - and $3 - or $98 - ld a, l - ld [wBuffer], a - ld a, h - ld [wBuffer + 1], a ; this copy of the address is not used - ld a, 2 - ld [$ffbe], a - ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) -.redrawRowLoop - push bc - push hl - push hl - ld hl, wTileMap - 2 * SCREEN_WIDTH - ld de, SCREEN_WIDTH - ld a, [$ffbe] -.calcWRAMAddrLoop - add hl, de - dec a - jr nz, .calcWRAMAddrLoop - call CopyToRedrawRowOrColumnSrcTiles - pop hl - ld de, $20 - ld a, [$ffbe] - ld c, a -.calcVRAMAddrLoop - add hl, de - ld a, h - and $3 - or $98 - dec c - jr nz, .calcVRAMAddrLoop - ld [hRedrawRowOrColumnDest + 1], a - ld a, l - ld [hRedrawRowOrColumnDest], a - ld a, REDRAW_ROW - ld [hRedrawRowOrColumnMode], a - call DelayFrame - ld hl, $ffbe - inc [hl] - inc [hl] - pop hl - pop bc - dec c - jr nz, .redrawRowLoop - pop af - ld [hTilesetType], a - pop af - ld [H_AUTOBGTRANSFERENABLED], a - ret - -CompareHLWithBC: - ld a, h - sub b - ret nz - ld a, l - sub c - ret +INCLUDE "engine/draw_badges.asm" +INCLUDE "engine/overworld/replace_tile_block.asm" INCLUDE "engine/overworld/cut.asm" +INCLUDE "engine/overworld/missable_objects.asm" +INCLUDE "engine/overworld/try_pushing_boulder.asm" -MarkTownVisitedAndLoadMissableObjects: - ld a, [wCurMap] - cp ROUTE_1 - jr nc, .notInTown - ld c, a - ld b, FLAG_SET - ld hl, wTownVisitedFlag ; mark town as visited (for flying) - predef FlagActionPredef -.notInTown - ld hl, MapHSPointers - ld a, [wCurMap] - ld b, $0 - ld c, a - add hl, bc - add hl, bc - ld a, [hli] ; load missable objects pointer in hl - ld h, [hl] - ; fall through - -LoadMissableObjects: - ld l, a - push hl - ld de, MapHS00 ; calculate difference between out pointer and the base pointer - ld a, l - sub e - jr nc, .asm_f13c - dec h -.asm_f13c - ld l, a - ld a, h - sub d - ld h, a - ld a, h - ld [H_DIVIDEND], a - ld a, l - ld [H_DIVIDEND+1], a - xor a - ld [H_DIVIDEND+2], a - ld [H_DIVIDEND+3], a - ld a, $3 - ld [H_DIVISOR], a - ld b, $2 - call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [wCurMap] - ld b, a - ld a, [H_DIVIDEND+3] - ld c, a ; store global offset in c - ld de, wMissableObjectList - pop hl -.writeMissableObjectsListLoop - ld a, [hli] - cp $ff - jr z, .done ; end of list - cp b - jr nz, .done ; not for current map anymore - ld a, [hli] - inc hl - ld [de], a ; write (map-local) sprite ID - inc de - ld a, c - inc c - ld [de], a ; write (global) missable object index - inc de - jr .writeMissableObjectsListLoop -.done - ld a, $ff - ld [de], a ; write sentinel - ret - -InitializeMissableObjectsFlags: - ld hl, wMissableObjectFlags - ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags - xor a - call FillMemory ; clear missable objects flags - ld hl, MapHS00 - xor a - ld [wMissableObjectCounter], a -.missableObjectsLoop - ld a, [hli] - cp $ff ; end of list - ret z - push hl - inc hl - ld a, [hl] - cp Hide - jr nz, .skip - ld hl, wMissableObjectFlags - ld a, [wMissableObjectCounter] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set flag if Item is hidden -.skip - ld hl, wMissableObjectCounter - inc [hl] - pop hl - inc hl - inc hl - jr .missableObjectsLoop - -; tests if current sprite is a missable object that is hidden/has been removed -IsObjectHidden: - ld a, [H_CURRENTSPRITEOFFSET] - swap a - ld b, a - ld hl, wMissableObjectList -.loop - ld a, [hli] - cp $ff - jr z, .notHidden ; not missable -> not hidden - cp b - ld a, [hli] - jr nz, .loop - ld c, a - ld b, FLAG_TEST - ld hl, wMissableObjectFlags - call MissableObjectFlagAction - ld a, c - and a - jr nz, .hidden -.notHidden - xor a -.hidden - ld [$ffe5], a - ret +INCLUDE "engine/add_party_mon.asm" +INCLUDE "engine/move_mon.asm" +INCLUDE "engine/flag_action_predef.asm" +INCLUDE "engine/heal_party.asm" +INCLUDE "engine/bcd.asm" -; adds missable object (items, leg. pokemon, etc.) to the map -; [wMissableObjectIndex]: index of the missable object to be added (global index) -ShowObject: -ShowObject2: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_RESET - call MissableObjectFlagAction ; reset "removed" flag - jp UpdateSprites - -; removes missable object (items, leg. pokemon, etc.) from the map -; [wMissableObjectIndex]: index of the missable object to be removed (global index) -HideObject: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set "removed" flag - jp UpdateSprites - -MissableObjectFlagAction: -; identical to FlagAction - - push hl - push de - push bc - - ; bit - ld a, c - ld d, a - and 7 - ld e, a - - ; byte - ld a, d - srl a - srl a - srl a - add l - ld l, a - jr nc, .ok - inc h -.ok - - ; d = 1 << e (bitmask) - inc e - ld d, 1 -.shift - dec e - jr z, .shifted - sla d - jr .shift -.shifted - - ld a, b - and a - jr z, .reset - cp 2 - jr z, .read - -.set - ld a, [hl] - ld b, a - ld a, d - or b - ld [hl], a - jr .done - -.reset - ld a, [hl] - ld b, a - ld a, d - xor $ff - and b - ld [hl], a - jr .done - -.read - ld a, [hl] - ld b, a - ld a, d - and b - -.done - pop bc - pop de - pop hl - ld c, a - ret +INCLUDE "engine/init_player_data.asm" -TryPushingBoulder: - ld a, [wd728] - bit 0, a ; using Strength? - ret z - ld a, [wFlags_0xcd60] - bit 1, a ; has boulder dust animation from previous push played yet? - ret nz - xor a - ld [hSpriteIndexOrTextID], a - call IsSpriteInFrontOfPlayer - ld a, [hSpriteIndexOrTextID] - ld [wBoulderSpriteIndex], a - and a - jp z, ResetBoulderPushFlags - ld hl, wSpriteStateData1 + 1 - ld d, $0 - ld a, [hSpriteIndexOrTextID] - swap a - ld e, a - add hl, de - res 7, [hl] - call GetSpriteMovementByte2Pointer - ld a, [hl] - cp BOULDER_MOVEMENT_BYTE_2 - jp nz, ResetBoulderPushFlags - ld hl, wFlags_0xcd60 - bit 6, [hl] - set 6, [hl] ; indicate that the player has tried pushing - ret z ; the player must try pushing twice before the boulder will move - ld a, [hJoyHeld] - and D_RIGHT | D_LEFT | D_UP | D_DOWN - ret z - predef CheckForCollisionWhenPushingBoulder - ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] - and a ; was there a collision? - jp nz, ResetBoulderPushFlags - ld a, [hJoyHeld] - ld b, a - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - cp SPRITE_FACING_UP - jr z, .pushBoulderUp - cp SPRITE_FACING_LEFT - jr z, .pushBoulderLeft - cp SPRITE_FACING_RIGHT - jr z, .pushBoulderRight -.pushBoulderDown - bit 7, b - ret z - ld de, PushBoulderDownMovementData - jr .done -.pushBoulderUp - bit 6, b - ret z - ld de, PushBoulderUpMovementData - jr .done -.pushBoulderLeft - bit 5, b - ret z - ld de, PushBoulderLeftMovementData - jr .done -.pushBoulderRight - bit 4, b - ret z - ld de, PushBoulderRightMovementData -.done - call MoveSprite - ld a, SFX_PUSH_BOULDER - call PlaySound - ld hl, wFlags_0xcd60 - set 1, [hl] - ret +INCLUDE "engine/get_bag_item_quantity.asm" -PushBoulderUpMovementData: - db NPC_MOVEMENT_UP,$FF - -PushBoulderDownMovementData: - db NPC_MOVEMENT_DOWN,$FF - -PushBoulderLeftMovementData: - db NPC_MOVEMENT_LEFT,$FF - -PushBoulderRightMovementData: - db NPC_MOVEMENT_RIGHT,$FF - -DoBoulderDustAnimation: - ld a, [wd730] - bit 0, a - ret nz - callab AnimateBoulderDust - call DiscardButtonPresses - ld [wJoyIgnore], a - call ResetBoulderPushFlags - set 7, [hl] - ld a, [wBoulderSpriteIndex] - ld [H_SPRITEINDEX], a - call GetSpriteMovementByte2Pointer - ld [hl], $10 - ld a, SFX_CUT - jp PlaySound - -ResetBoulderPushFlags: - ld hl, wFlags_0xcd60 - res 1, [hl] - res 6, [hl] - ret - -_AddPartyMon: -; Adds a new mon to the player's or enemy's party. -; [wMonDataLocation] is used in an unusual way in this function. -; If the lower nybble is 0, the mon is added to the player's party, else the enemy's. -; If the entire value is 0, then the player is allowed to name the mon. - ld de, wPartyCount - ld a, [wMonDataLocation] - and $f - jr z, .next - ld de, wEnemyPartyCount -.next - ld a, [de] - inc a - cp PARTY_LENGTH + 1 - ret nc ; return if the party is already full - ld [de], a - ld a, [de] - ld [hNewPartyLength], a - add e - ld e, a - jr nc, .noCarry - inc d -.noCarry - ld a, [wcf91] - ld [de], a ; write species of new mon in party list - inc de - ld a, $ff ; terminator - ld [de], a - ld hl, wPartyMonOT - ld a, [wMonDataLocation] - and $f - jr z, .next2 - ld hl, wEnemyMonOT -.next2 - ld a, [hNewPartyLength] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wPlayerName - ld bc, NAME_LENGTH - call CopyData - ld a, [wMonDataLocation] - and a - jr nz, .skipNaming - ld hl, wPartyMonNicks - ld a, [hNewPartyLength] - dec a - call SkipFixedLengthTextEntries - ld a, NAME_MON_SCREEN - ld [wNamingScreenType], a - predef AskName -.skipNaming - ld hl, wPartyMons - ld a, [wMonDataLocation] - and $f - jr z, .next3 - ld hl, wEnemyMons -.next3 - ld a, [hNewPartyLength] - dec a - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld e, l - ld d, h - push hl - ld a, [wcf91] - ld [wd0b5], a - call GetMonHeader - ld hl, wMonHeader - ld a, [hli] - ld [de], a ; species - inc de - pop hl - push hl - ld a, [wMonDataLocation] - and $f - ld a, $98 ; set enemy trainer mon IVs to fixed average values - ld b, $88 - jr nz, .next4 - -; If the mon is being added to the player's party, update the pokedex. - ld a, [wcf91] - ld [wd11e], a - push de - predef IndexToPokedex - pop de - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_TEST - ld hl, wPokedexOwned - call FlagAction - ld a, c ; whether the mon was already flagged as owned - ld [wUnusedD153], a ; not read - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - push bc - call FlagAction - pop bc - ld hl, wPokedexSeen - call FlagAction - - pop hl - push hl - - ld a, [wIsInBattle] - and a ; is this a wild mon caught in battle? - jr nz, .copyEnemyMonData - -; Not wild. - call Random ; generate random IVs - ld b, a - call Random - -.next4 - push bc - ld bc, wPartyMon1DVs - wPartyMon1 - add hl, bc - pop bc - ld [hli], a - ld [hl], b ; write IVs - ld bc, (wPartyMon1HPExp - 1) - (wPartyMon1DVs + 1) - add hl, bc - ld a, 1 - ld c, a - xor a - ld b, a - call CalcStat ; calc HP stat (set cur Hp to max HP) - ld a, [H_MULTIPLICAND+1] - ld [de], a - inc de - ld a, [H_MULTIPLICAND+2] - ld [de], a - inc de - xor a - ld [de], a ; box level - inc de - ld [de], a ; status ailments - inc de - jr .copyMonTypesAndMoves -.copyEnemyMonData - ld bc, wEnemyMon1DVs - wEnemyMon1 - add hl, bc - ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon - ld [hli], a - ld a, [wEnemyMonDVs + 1] - ld [hl], a - ld a, [wEnemyMonHP] ; copy HP from cur enemy mon - ld [de], a - inc de - ld a, [wEnemyMonHP+1] - ld [de], a - inc de - xor a - ld [de], a ; box level - inc de - ld a, [wEnemyMonStatus] ; copy status ailments from cur enemy mon - ld [de], a - inc de -.copyMonTypesAndMoves - ld hl, wMonHTypes - ld a, [hli] ; type 1 - ld [de], a - inc de - ld a, [hli] ; type 2 - ld [de], a - inc de - ld a, [hli] ; catch rate (held item in gen 2) - ld [de], a - ld hl, wMonHMoves - ld a, [hli] - inc de - push de - ld [de], a - ld a, [hli] - inc de - ld [de], a - ld a, [hli] - inc de - ld [de], a - ld a, [hli] - inc de - ld [de], a - push de - dec de - dec de - dec de - xor a - ld [wLearningMovesFromDayCare], a - predef WriteMonMoves - pop de - ld a, [wPlayerID] ; set trainer ID to player ID - inc de - ld [de], a - ld a, [wPlayerID + 1] - inc de - ld [de], a - push de - ld a, [wCurEnemyLVL] - ld d, a - callab CalcExperience - pop de - inc de - ld a, [hExperience] ; write experience - ld [de], a - inc de - ld a, [hExperience + 1] - ld [de], a - inc de - ld a, [hExperience + 2] - ld [de], a - xor a - ld b, NUM_STATS * 2 -.writeEVsLoop ; set all EVs to 0 - inc de - ld [de], a - dec b - jr nz, .writeEVsLoop - inc de - inc de - pop hl - call AddPartyMon_WriteMovePP - inc de - ld a, [wCurEnemyLVL] - ld [de], a - inc de - ld a, [wIsInBattle] - dec a - jr nz, .calcFreshStats - ld hl, wEnemyMonMaxHP - ld bc, $a - call CopyData ; copy stats of cur enemy mon - pop hl - jr .done -.calcFreshStats - pop hl - ld bc, wPartyMon1HPExp - 1 - wPartyMon1 - add hl, bc - ld b, $0 - call CalcStats ; calculate fresh set of stats -.done - scf - ret - -LoadMovePPs: - call GetPredefRegisters - ; fallthrough -AddPartyMon_WriteMovePP: - ld b, NUM_MOVES -.pploop - ld a, [hli] ; read move ID - and a - jr z, .empty - dec a - push hl - push de - push bc - ld hl, Moves - ld bc, MoveEnd - Moves - call AddNTimes - ld de, wcd6d - ld a, BANK(Moves) - call FarCopyData - pop bc - pop de - pop hl - ld a, [wcd6d + 5] ; PP is byte 5 of move data -.empty - inc de - ld [de], a - dec b - jr nz, .pploop ; there are still moves to read - ret +INCLUDE "engine/overworld/npc_pathfinding.asm" -; adds enemy mon [wcf91] (at position [wWhichPokemon] in enemy list) to own party -; used in the cable club trade center -_AddEnemyMonToPlayerParty: - ld hl, wPartyCount - ld a, [hl] - cp PARTY_LENGTH - scf - ret z ; party full, return failure - inc a - ld [hl], a ; add 1 to party members - ld c, a - ld b, $0 - add hl, bc - ld a, [wcf91] - ld [hli], a ; add mon as last list entry - ld [hl], $ff ; write new sentinel - ld hl, wPartyMons - ld a, [wPartyCount] - dec a - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld e, l - ld d, h - ld hl, wLoadedMon - call CopyData ; write new mon's data (from wLoadedMon) - ld hl, wPartyMonOT - ld a, [wPartyCount] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wEnemyMonOT - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld bc, NAME_LENGTH - call CopyData ; write new mon's OT name (from an enemy mon) - ld hl, wPartyMonNicks - ld a, [wPartyCount] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wEnemyMonNicks - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld bc, NAME_LENGTH - call CopyData ; write new mon's nickname (from an enemy mon) - ld a, [wcf91] - ld [wd11e], a - predef IndexToPokedex - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - ld hl, wPokedexOwned - push bc - call FlagAction ; add to owned pokemon - pop bc - ld hl, wPokedexSeen - call FlagAction ; add to seen pokemon - and a - ret ; return success - -_MoveMon: - ld a, [wMoveMonType] - and a - jr z, .checkPartyMonSlots - cp DAYCARE_TO_PARTY - jr z, .checkPartyMonSlots - cp PARTY_TO_DAYCARE - ld hl, wDayCareMon - jr z, .asm_f575 - ld hl, wNumInBox - ld a, [hl] - cp MONS_PER_BOX - jr nz, .partyOrBoxNotFull - jr .boxFull -.checkPartyMonSlots - ld hl, wPartyCount - ld a, [hl] - cp PARTY_LENGTH - jr nz, .partyOrBoxNotFull -.boxFull - scf - ret -.partyOrBoxNotFull - inc a - ld [hl], a ; increment number of mons in party/box - ld c, a - ld b, 0 - add hl, bc - 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, [wMoveMonType] - dec a - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c - ld a, [wPartyCount] - jr nz, .skipToNewMonEntry - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 - ld a, [wNumInBox] -.skipToNewMonEntry - dec a - call AddNTimes -.asm_f575 - push hl - ld e, l - ld d, h - ld a, [wMoveMonType] - and a - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 - jr z, .asm_f591 - cp DAYCARE_TO_PARTY - ld hl, wDayCareMon - jr z, .asm_f597 - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c -.asm_f591 - ld a, [wWhichPokemon] - call AddNTimes -.asm_f597 - push hl - push de - ld bc, wBoxMon2 - wBoxMon1 - call CopyData - pop de - pop hl - ld a, [wMoveMonType] - and a - jr z, .asm_f5b4 - cp DAYCARE_TO_PARTY - jr z, .asm_f5b4 - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld a, [hl] - inc de - inc de - inc de - ld [de], a -.asm_f5b4 - ld a, [wMoveMonType] - cp PARTY_TO_DAYCARE - ld de, wDayCareMonOT - jr z, .asm_f5d3 - dec a - ld hl, wPartyMonOT - ld a, [wPartyCount] - jr nz, .asm_f5cd - ld hl, wBoxMonOT - ld a, [wNumInBox] -.asm_f5cd - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l -.asm_f5d3 - ld hl, wBoxMonOT - ld a, [wMoveMonType] - and a - jr z, .asm_f5e6 - ld hl, wDayCareMonOT - cp DAYCARE_TO_PARTY - jr z, .asm_f5ec - ld hl, wPartyMonOT -.asm_f5e6 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries -.asm_f5ec - ld bc, NAME_LENGTH - call CopyData - ld a, [wMoveMonType] - cp PARTY_TO_DAYCARE - ld de, wDayCareMonName - jr z, .asm_f611 - dec a - ld hl, wPartyMonNicks - ld a, [wPartyCount] - jr nz, .asm_f60b - ld hl, wBoxMonNicks - ld a, [wNumInBox] -.asm_f60b - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l -.asm_f611 - ld hl, wBoxMonNicks - ld a, [wMoveMonType] - and a - jr z, .asm_f624 - ld hl, wDayCareMonName - cp DAYCARE_TO_PARTY - jr z, .asm_f62a - ld hl, wPartyMonNicks -.asm_f624 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries -.asm_f62a - ld bc, NAME_LENGTH - call CopyData - pop hl - ld a, [wMoveMonType] - cp PARTY_TO_BOX - jr z, .asm_f664 - cp PARTY_TO_DAYCARE - jr z, .asm_f664 - push hl - srl a - add $2 - ld [wMonDataLocation], a - call LoadMonData - callba CalcLevelFromExperience - ld a, d - ld [wCurEnemyLVL], a - pop hl - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld [hli], a - ld d, h - ld e, l - ld bc, -18 - add hl, bc - ld b, $1 - call CalcStats -.asm_f664 - and a - ret - - -FlagActionPredef: - call GetPredefRegisters - -FlagAction: -; Perform action b on bit c -; in the bitfield at hl. -; 0: reset -; 1: set -; 2: read -; Return the result in c. - - push hl - push de - push bc - - ; bit - ld a, c - ld d, a - and 7 - ld e, a - - ; byte - ld a, d - srl a - srl a - srl a - add l - ld l, a - jr nc, .ok - inc h -.ok - - ; d = 1 << e (bitmask) - inc e - ld d, 1 -.shift - dec e - jr z, .shifted - sla d - jr .shift -.shifted - - ld a, b - and a - jr z, .reset - cp 2 - jr z, .read - -.set - ld b, [hl] - ld a, d - or b - ld [hl], a - jr .done - -.reset - ld b, [hl] - ld a, d - xor $ff - and b - ld [hl], a - jr .done - -.read - ld b, [hl] - ld a, d - and b -.done - pop bc - pop de - pop hl - ld c, a - ret - - -HealParty: -; Restore HP and PP. - - ld hl, wPartySpecies - ld de, wPartyMon1HP -.healmon - ld a, [hli] - cp $ff - jr z, .done - - push hl - push de - - ld hl, wPartyMon1Status - wPartyMon1HP - add hl, de - xor a - ld [hl], a - - push de - ld b, NUM_MOVES ; A Pokémon has 4 moves -.pp - ld hl, wPartyMon1Moves - wPartyMon1HP - add hl, de - - ld a, [hl] - and a - jr z, .nextmove - - dec a - ld hl, wPartyMon1PP - wPartyMon1HP - add hl, de - - push hl - push de - push bc - - ld hl, Moves - ld bc, MoveEnd - Moves - call AddNTimes - ld de, wcd6d - ld a, BANK(Moves) - call FarCopyData - ld a, [wcd6d + 5] ; PP is byte 5 of move data - - pop bc - pop de - pop hl - - inc de - push bc - ld b, a - ld a, [hl] - and $c0 - add b - ld [hl], a - pop bc - -.nextmove - dec b - jr nz, .pp - pop de - - ld hl, wPartyMon1MaxHP - wPartyMon1HP - add hl, de - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - - pop de - pop hl - - push hl - ld bc, wPartyMon2 - wPartyMon1 - ld h, d - ld l, e - add hl, bc - ld d, h - ld e, l - pop hl - jr .healmon - -.done - xor a - ld [wWhichPokemon], a - ld [wd11e], a - - ld a, [wPartyCount] - ld b, a -.ppup - push bc - call RestoreBonusPP - pop bc - ld hl, wWhichPokemon - inc [hl] - dec b - jr nz, .ppup - ret - - -DivideBCDPredef:: -DivideBCDPredef2:: -DivideBCDPredef3:: -DivideBCDPredef4:: - call GetPredefRegisters - -DivideBCD:: - xor a - ld [$ffa5], a - ld [$ffa6], a - ld [$ffa7], a - ld d, $1 -.asm_f72a - ld a, [$ffa2] - and $f0 - jr nz, .asm_f75b - inc d - ld a, [$ffa2] - swap a - and $f0 - ld b, a - ld a, [$ffa3] - swap a - ld [$ffa3], a - and $f - or b - ld [$ffa2], a - ld a, [$ffa3] - and $f0 - ld b, a - ld a, [$ffa4] - swap a - ld [$ffa4], a - and $f - or b - ld [$ffa3], a - ld a, [$ffa4] - and $f0 - ld [$ffa4], a - jr .asm_f72a -.asm_f75b - push de - push de - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa5], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa5] - or b - ld [$ffa5], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa6], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa6] - or b - ld [$ffa6], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa7], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa7] - or b - ld [$ffa7], a -.asm_f7bc - ld a, [$ffa5] - ld [$ffa2], a - ld a, [$ffa6] - ld [$ffa3], a - ld a, [$ffa7] - ld [$ffa4], a - pop de - ld a, $6 - sub d - and a - ret z -.asm_f7ce - push af - call DivideBCD_f7d7 - pop af - dec a - jr nz, .asm_f7ce - ret - -DivideBCD_f7d7: - ld a, [$ffa4] - swap a - and $f - ld b, a - ld a, [$ffa3] - swap a - ld [$ffa3], a - and $f0 - or b - ld [$ffa4], a - ld a, [$ffa3] - and $f - ld b, a - ld a, [$ffa2] - swap a - ld [$ffa2], a - and $f0 - or b - ld [$ffa3], a - ld a, [$ffa2] - and $f - ld [$ffa2], a - ret - -DivideBCD_f800: - ld bc, $3 -.asm_f803 - ld de, $ff9f - ld hl, $ffa2 - push bc - call StringCmp - pop bc - ret c - inc b - ld de, $ffa1 - ld hl, $ffa4 - push bc - call SubBCD - pop bc - jr .asm_f803 - - -AddBCDPredef:: - call GetPredefRegisters - -AddBCD:: - and a - ld b, c -.add - ld a, [de] - adc [hl] - daa - ld [de], a - dec de - dec hl - dec c - jr nz, .add - jr nc, .done - ld a, $99 - inc de -.fill - ld [de], a - inc de - dec b - jr nz, .fill -.done - ret - - -SubBCDPredef:: - call GetPredefRegisters - -SubBCD:: - and a - ld b, c -.sub - ld a, [de] - sbc [hl] - daa - ld [de], a - dec de - dec hl - dec c - jr nz, .sub - jr nc, .done - ld a, $00 - inc de -.fill - ld [de], a - inc de - dec b - jr nz, .fill - scf -.done - ret - - -InitPlayerData: -InitPlayerData2: - - call Random - ld a, [hRandomSub] - ld [wPlayerID], a - - call Random - ld a, [hRandomAdd] - ld [wPlayerID + 1], a - - ld a, $ff - ld [wUnusedD71B], a - - ld hl, wPartyCount - call InitializeEmptyList - ld hl, wNumInBox - call InitializeEmptyList - ld hl, wNumBagItems - call InitializeEmptyList - ld hl, wNumBoxItems - call InitializeEmptyList - -START_MONEY EQU $3000 - ld hl, wPlayerMoney + 1 - ld a, START_MONEY / $100 - ld [hld], a - xor a - ld [hli], a - inc hl - ld [hl], a - - ld [wMonDataLocation], a - - ld hl, wObtainedBadges - ld [hli], a - - ld [hl], a - - ld hl, wPlayerCoins - ld [hli], a - ld [hl], a - - ld hl, wGameProgressFlags - ld bc, wGameProgressFlagsEnd - wGameProgressFlags - call FillMemory ; clear all game progress flags - - jp InitializeMissableObjectsFlags - -InitializeEmptyList: - xor a ; count - ld [hli], a - dec a ; terminator - ld [hl], a - ret - - -GetQuantityOfItemInBag: -; In: b = item ID -; Out: b = how many of that item are in the bag - call GetPredefRegisters - ld hl, wNumBagItems -.loop - inc hl - ld a, [hli] - cp $ff - jr z, .notInBag - cp b - jr nz, .loop - ld a, [hl] - ld b, a - ret -.notInBag - ld b, 0 - ret - -FindPathToPlayer: - xor a - ld hl, hFindPathNumSteps - ld [hli], a ; hFindPathNumSteps - ld [hli], a ; hFindPathFlags - ld [hli], a ; hFindPathYProgress - ld [hl], a ; hFindPathXProgress - ld hl, wNPCMovementDirections2 - ld de, $0 -.loop - ld a, [hFindPathYProgress] - ld b, a - ld a, [hNPCPlayerYDistance] ; Y distance in steps - call CalcDifference - ld d, a - and a - jr nz, .asm_f8da - ld a, [hFindPathFlags] - set 0, a ; current end of path matches the player's Y coordinate - ld [hFindPathFlags], a -.asm_f8da - ld a, [hFindPathXProgress] - ld b, a - ld a, [hNPCPlayerXDistance] ; X distance in steps - call CalcDifference - ld e, a - and a - jr nz, .asm_f8ec - ld a, [hFindPathFlags] - set 1, a ; current end of path matches the player's X coordinate - ld [hFindPathFlags], a -.asm_f8ec - ld a, [hFindPathFlags] - cp $3 ; has the end of the path reached the player's position? - jr z, .done -; Compare whether the X distance between the player and the current of the path -; is greater or if the Y distance is. Then, try to reduce whichever is greater. - ld a, e - cp d - jr c, .yDistanceGreater -; x distance is greater - ld a, [hNPCPlayerRelativePosFlags] - bit 1, a - jr nz, .playerIsLeftOfNPC - ld d, NPC_MOVEMENT_RIGHT - jr .next1 -.playerIsLeftOfNPC - ld d, NPC_MOVEMENT_LEFT -.next1 - ld a, [hFindPathXProgress] - add 1 - ld [hFindPathXProgress], a - jr .storeDirection -.yDistanceGreater - ld a, [hNPCPlayerRelativePosFlags] - bit 0, a - jr nz, .playerIsAboveNPC - ld d, NPC_MOVEMENT_DOWN - jr .next2 -.playerIsAboveNPC - ld d, NPC_MOVEMENT_UP -.next2 - ld a, [hFindPathYProgress] - add 1 - ld [hFindPathYProgress], a -.storeDirection - ld a, d - ld [hli], a - ld a, [hFindPathNumSteps] - inc a - ld [hFindPathNumSteps], a - jp .loop -.done - ld [hl], $ff - ret - -CalcPositionOfPlayerRelativeToNPC: - xor a - ld [hNPCPlayerRelativePosFlags], a - ld a, [wSpriteStateData1 + 4] ; player's sprite screen Y position in pixels - ld d, a - ld a, [wSpriteStateData1 + 6] ; player's sprite screen X position in pixels - ld e, a - ld hl, wSpriteStateData1 - ld a, [hNPCSpriteOffset] - add l - add $4 - ld l, a - jr nc, .noCarry - inc h -.noCarry - ld a, d - ld b, a - ld a, [hli] ; NPC sprite screen Y position in pixels - call CalcDifference - jr nc, .NPCSouthOfOrAlignedWithPlayer -.NPCNorthOfPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - set 0, [hl] - pop hl - jr .divideYDistance -.NPCSouthOfOrAlignedWithPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - res 0, [hl] - pop hl -.divideYDistance - push hl - ld hl, hDividend2 - ld [hli], a - ld a, 16 - ld [hli], a - call DivideBytes ; divide Y absolute distance by 16 - ld a, [hl] ; quotient - ld [hNPCPlayerYDistance], a - pop hl - inc hl - ld b, e - ld a, [hl] ; NPC sprite screen X position in pixels - call CalcDifference - jr nc, .NPCEastOfOrAlignedWithPlayer -.NPCWestOfPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - set 1, [hl] - pop hl - jr .divideXDistance -.NPCEastOfOrAlignedWithPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - res 1, [hl] - pop hl -.divideXDistance - ld [hDividend2], a - ld a, 16 - ld [hDivisor2], a - call DivideBytes ; divide X absolute distance by 16 - ld a, [hQuotient2] - ld [hNPCPlayerXDistance], a - ld a, [hNPCPlayerRelativePosPerspective] - and a - ret z - ld a, [hNPCPlayerRelativePosFlags] - cpl - and $3 - ld [hNPCPlayerRelativePosFlags], a - ret +INCLUDE "engine/hp_bar.asm" +INCLUDE "engine/hidden_object_functions3.asm" -ConvertNPCMovementDirectionsToJoypadMasks: - ld a, [hNPCMovementDirections2Index] - ld [wNPCMovementDirections2Index], a - dec a - ld de, wSimulatedJoypadStatesEnd - ld hl, wNPCMovementDirections2 - add l - ld l, a - jr nc, .loop - inc h -.loop - ld a, [hld] - call ConvertNPCMovementDirectionToJoypadMask - ld [de], a - inc de - ld a, [hNPCMovementDirections2Index] - dec a - ld [hNPCMovementDirections2Index], a - jr nz, .loop - ret -ConvertNPCMovementDirectionToJoypadMask: - push hl - ld b, a - ld hl, NPCMovementDirectionsToJoypadMasksTable -.loop - ld a, [hli] - cp $ff - jr z, .done - cp b - jr z, .loadJoypadMask - inc hl - jr .loop -.loadJoypadMask - ld a, [hl] -.done - pop hl - ret +SECTION "Graphics", ROMX, BANK[GFX] -NPCMovementDirectionsToJoypadMasksTable: - db NPC_MOVEMENT_UP, D_UP - db NPC_MOVEMENT_DOWN, D_DOWN - db NPC_MOVEMENT_LEFT, D_LEFT - db NPC_MOVEMENT_RIGHT, D_RIGHT - db $ff +PokemonLogoJapanGraphics: INCBIN "gfx/pokemon_logo_japan.2bpp" +FontGraphics: INCBIN "gfx/font.1bpp" +FontGraphicsEnd: +ABTiles: INCBIN "gfx/AB.2bpp" +HpBarAndStatusGraphics: INCBIN "gfx/hp_bar_and_status.2bpp" +HpBarAndStatusGraphicsEnd: +BattleHudTiles1: INCBIN "gfx/battle_hud1.1bpp" +BattleHudTiles1End: +BattleHudTiles2: INCBIN "gfx/battle_hud2.1bpp" +BattleHudTiles3: INCBIN "gfx/battle_hud3.1bpp" +BattleHudTiles3End: +NintendoCopyrightLogoGraphics: INCBIN "gfx/copyright.2bpp" +GamefreakLogoGraphics: INCBIN "gfx/gamefreak.2bpp" +GamefreakLogoGraphicsEnd: +NineTile: INCBIN "gfx/9_tile.2bpp" +TextBoxGraphics: INCBIN "gfx/text_box.2bpp" +TextBoxGraphicsEnd: +PokedexTileGraphics: INCBIN "gfx/pokedex.2bpp" +PokedexTileGraphicsEnd: +WorldMapTileGraphics: INCBIN "gfx/town_map.2bpp" +WorldMapTileGraphicsEnd: +PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp" -; unreferenced - ret +INCLUDE "engine/menu/status_screen.asm" +INCLUDE "engine/menu/party_menu.asm" -INCLUDE "engine/hp_bar.asm" +RedPicFront: INCBIN "pic/ytrainer/red.pic" +ShrinkPic1: INCBIN "pic/trainer/shrink1.pic" +ShrinkPic2: INCBIN "pic/trainer/shrink2.pic" -INCLUDE "engine/hidden_object_functions3.asm" +INCLUDE "engine/menu/start_sub_menus.asm" +INCLUDE "engine/items/tms.asm" SECTION "NPC Sprites 1", ROMX, BANK[NPC_SPRITES_1] @@ -4766,58 +174,20 @@ ClipboardSprite: INCBIN "gfx/sprites/clipboard.2bpp" SnorlaxSprite: INCBIN "gfx/sprites/snorlax.2bpp" OldAmberSprite: INCBIN "gfx/sprites/old_amber.2bpp" LyingOldManSprite: INCBIN "gfx/sprites/lying_old_man.2bpp" +QuestionMarkSprite: INCBIN "gfx/sprites/question_mark.2bpp" - -SECTION "Graphics", ROMX, BANK[GFX] - -PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp" -FontGraphics: INCBIN "gfx/font.1bpp" -FontGraphicsEnd: -ABTiles: INCBIN "gfx/AB.2bpp" -HpBarAndStatusGraphics: INCBIN "gfx/hp_bar_and_status.2bpp" -HpBarAndStatusGraphicsEnd: -BattleHudTiles1: INCBIN "gfx/battle_hud1.1bpp" -BattleHudTiles1End: -BattleHudTiles2: INCBIN "gfx/battle_hud2.1bpp" -BattleHudTiles3: INCBIN "gfx/battle_hud3.1bpp" -BattleHudTiles3End: -NintendoCopyrightLogoGraphics: INCBIN "gfx/copyright.2bpp" -GamefreakLogoGraphics: INCBIN "gfx/gamefreak.2bpp" -GamefreakLogoGraphicsEnd: -TextBoxGraphics: INCBIN "gfx/text_box.2bpp" -TextBoxGraphicsEnd: -PokedexTileGraphics: INCBIN "gfx/pokedex.2bpp" -PokedexTileGraphicsEnd: -WorldMapTileGraphics: INCBIN "gfx/town_map.2bpp" -WorldMapTileGraphicsEnd: -PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp" -PlayerCharacterTitleGraphicsEnd: - - -SECTION "Battle (bank 4)", ROMX, BANK[$4] - -INCLUDE "engine/overworld/is_player_just_outside_map.asm" -INCLUDE "engine/menu/status_screen.asm" -INCLUDE "engine/menu/party_menu.asm" - -RedPicFront:: INCBIN "pic/trainer/red.pic" -ShrinkPic1:: INCBIN "pic/trainer/shrink1.pic" -ShrinkPic2:: INCBIN "pic/trainer/shrink2.pic" - -INCLUDE "engine/turn_sprite.asm" -INCLUDE "engine/menu/start_sub_menus.asm" -INCLUDE "engine/items/tms.asm" INCLUDE "engine/battle/end_of_battle.asm" INCLUDE "engine/battle/wild_encounters.asm" INCLUDE "engine/battle/moveEffects/recoil_effect.asm" INCLUDE "engine/battle/moveEffects/conversion_effect.asm" INCLUDE "engine/battle/moveEffects/haze_effect.asm" -INCLUDE "engine/battle/get_trainer_name.asm" -INCLUDE "engine/random.asm" SECTION "NPC Sprites 2", ROMX, BANK[NPC_SPRITES_2] +INCLUDE "engine/load_pokedex_tiles.asm" +INCLUDE "engine/overworld/map_sprites.asm" + RedCyclingSprite: INCBIN "gfx/sprites/cycling.2bpp" RedSprite: INCBIN "gfx/sprites/red.2bpp" BlueSprite: INCBIN "gfx/sprites/blue.2bpp" @@ -4859,18 +229,11 @@ BrunoSprite: INCBIN "gfx/sprites/bruno.2bpp" LoreleiSprite: INCBIN "gfx/sprites/lorelei.2bpp" SeelSprite: INCBIN "gfx/sprites/seel.2bpp" - -SECTION "Battle (bank 5)", ROMX, BANK[$5] - -INCLUDE "engine/load_pokedex_tiles.asm" -INCLUDE "engine/overworld/map_sprites.asm" -INCLUDE "engine/overworld/emotion_bubbles.asm" -INCLUDE "engine/evolve_trade.asm" INCLUDE "engine/battle/moveEffects/substitute_effect.asm" INCLUDE "engine/menu/pc.asm" -SECTION "bank6",ROMX,BANK[$6] +SECTION "bank06",ROMX,BANK[$06] INCLUDE "data/mapHeaders/celadoncity.asm" INCLUDE "data/mapObjects/celadoncity.asm" @@ -4890,17 +253,15 @@ PewterCityBlocks: INCBIN "maps/pewtercity.blk" INCLUDE "data/mapHeaders/ceruleancity.asm" INCLUDE "data/mapObjects/ceruleancity.asm" -CeruleanCityBlocks: INCBIN "maps/ceruleancity.blk" +CeruleanCityBlocks: INCBIN "maps/ceruleancity.blk" ; 18836 INCLUDE "data/mapHeaders/vermilioncity.asm" INCLUDE "data/mapObjects/vermilioncity.asm" VermilionCityBlocks: INCBIN "maps/vermilioncity.blk" - INCLUDE "data/mapHeaders/fuchsiacity.asm" INCLUDE "data/mapObjects/fuchsiacity.asm" FuchsiaCityBlocks: INCBIN "maps/fuchsiacity.blk" -INCLUDE "engine/play_time.asm" INCLUDE "scripts/pallettown.asm" INCLUDE "scripts/viridiancity.asm" @@ -4945,7 +306,7 @@ INCLUDE "engine/overworld/doors.asm" INCLUDE "engine/overworld/ledges.asm" -SECTION "bank7",ROMX,BANK[$7] +SECTION "bank07",ROMX,BANK[$07] INCLUDE "data/mapHeaders/cinnabarisland.asm" INCLUDE "data/mapObjects/cinnabarisland.asm" @@ -4953,41 +314,32 @@ CinnabarIslandBlocks: INCBIN "maps/cinnabarisland.blk" INCLUDE "data/mapHeaders/route1.asm" INCLUDE "data/mapObjects/route1.asm" -Route1Blocks: INCBIN "maps/route1.blk" +Route1Blocks: INCBIN "maps/route1.blk" ; 1c0fc UndergroundPathEntranceRoute8Blocks: INCBIN "maps/undergroundpathentranceroute8.blk" - OaksLabBlocks: INCBIN "maps/oakslab.blk" - -Route16HouseBlocks: +ViridianHouseBlocks: Route2HouseBlocks: -SaffronHouse1Blocks: -SaffronHouse2Blocks: +PewterHouse1Blocks: +PewterHouse2Blocks: +CeruleanHouse1Blocks: VermilionHouse1Blocks: -NameRaterBlocks: LavenderHouse1Blocks: LavenderHouse2Blocks: -CeruleanHouse1Blocks: -PewterHouse1Blocks: -PewterHouse2Blocks: -ViridianHouseBlocks: INCBIN "maps/viridianhouse.blk" - -CeladonMansion5Blocks: -SchoolBlocks: INCBIN "maps/school.blk" - +SaffronHouse1Blocks: +SaffronHouse2Blocks: +Route16HouseBlocks: +NameRaterBlocks: INCBIN "maps/viridianhouse.blk" +SchoolBlocks: +CeladonMansion5Blocks: INCBIN "maps/school.blk" CeruleanHouseTrashedBlocks: INCBIN "maps/ceruleanhousetrashed.blk" - -DiglettsCaveEntranceRoute11Blocks: -DiglettsCaveRoute2Blocks: INCBIN "maps/diglettscaveroute2.blk" - -INCLUDE "text/monster_names.asm" +DiglettsCaveRoute2Blocks: +DiglettsCaveEntranceRoute11Blocks: INCBIN "maps/diglettscaveroute2.blk" INCLUDE "engine/clear_save.asm" - INCLUDE "engine/predefs7.asm" INCLUDE "scripts/cinnabarisland.asm" - INCLUDE "scripts/route1.asm" INCLUDE "data/mapHeaders/oakslab.asm" @@ -4997,7 +349,8 @@ INCLUDE "data/mapObjects/oakslab.asm" INCLUDE "data/mapHeaders/viridianmart.asm" INCLUDE "scripts/viridianmart.asm" INCLUDE "data/mapObjects/viridianmart.asm" -ViridianMartBlocks: INCBIN "maps/viridianmart.blk" +ViridianMartBlocks: +CeladonMartBlocks: INCBIN "maps/viridianmart.blk" INCLUDE "data/mapHeaders/school.asm" INCLUDE "scripts/school.asm" @@ -5077,22 +430,22 @@ INCLUDE "data/mapObjects/route2house.asm" INCLUDE "data/mapHeaders/route5gate.asm" INCLUDE "scripts/route5gate.asm" INCLUDE "data/mapObjects/route5gate.asm" -Route5GateBlocks: INCBIN "maps/route5gate.blk" +Route5GateBlocks: INCBIN "maps/route5gate.blk" ; 1d92f INCLUDE "data/mapHeaders/route6gate.asm" INCLUDE "scripts/route6gate.asm" INCLUDE "data/mapObjects/route6gate.asm" -Route6GateBlocks: INCBIN "maps/route6gate.blk" +Route6GateBlocks: INCBIN "maps/route6gate.blk" ; 1d9f2 INCLUDE "data/mapHeaders/route7gate.asm" INCLUDE "scripts/route7gate.asm" INCLUDE "data/mapObjects/route7gate.asm" -Route7GateBlocks: INCBIN "maps/route7gate.blk" +Route7GateBlocks: INCBIN "maps/route7gate.blk" ; 1dab9 INCLUDE "data/mapHeaders/route8gate.asm" INCLUDE "scripts/route8gate.asm" INCLUDE "data/mapObjects/route8gate.asm" -Route8GateBlocks: INCBIN "maps/route8gate.blk" +Route8GateBlocks: INCBIN "maps/route8gate.blk" ; 1dab9 INCLUDE "data/mapHeaders/undergroundpathentranceroute8.asm" INCLUDE "scripts/undergroundpathentranceroute8.asm" @@ -5128,384 +481,362 @@ INCLUDE "engine/hidden_object_functions7.asm" SECTION "Pics 1", ROMX, BANK[PICS_1] -RhydonPicFront:: INCBIN "pic/bmon/rhydon.pic" -RhydonPicBack:: INCBIN "pic/monback/rhydonb.pic" -KangaskhanPicFront:: INCBIN "pic/bmon/kangaskhan.pic" -KangaskhanPicBack:: INCBIN "pic/monback/kangaskhanb.pic" -NidoranMPicFront:: INCBIN "pic/bmon/nidoranm.pic" -NidoranMPicBack:: INCBIN "pic/monback/nidoranmb.pic" -ClefairyPicFront:: INCBIN "pic/bmon/clefairy.pic" -ClefairyPicBack:: INCBIN "pic/monback/clefairyb.pic" -SpearowPicFront:: INCBIN "pic/bmon/spearow.pic" -SpearowPicBack:: INCBIN "pic/monback/spearowb.pic" -VoltorbPicFront:: INCBIN "pic/bmon/voltorb.pic" -VoltorbPicBack:: INCBIN "pic/monback/voltorbb.pic" -NidokingPicFront:: INCBIN "pic/bmon/nidoking.pic" -NidokingPicBack:: INCBIN "pic/monback/nidokingb.pic" -SlowbroPicFront:: INCBIN "pic/bmon/slowbro.pic" -SlowbroPicBack:: INCBIN "pic/monback/slowbrob.pic" -IvysaurPicFront:: INCBIN "pic/bmon/ivysaur.pic" -IvysaurPicBack:: INCBIN "pic/monback/ivysaurb.pic" -ExeggutorPicFront:: INCBIN "pic/bmon/exeggutor.pic" -ExeggutorPicBack:: INCBIN "pic/monback/exeggutorb.pic" -LickitungPicFront:: INCBIN "pic/bmon/lickitung.pic" -LickitungPicBack:: INCBIN "pic/monback/lickitungb.pic" -ExeggcutePicFront:: INCBIN "pic/bmon/exeggcute.pic" -ExeggcutePicBack:: INCBIN "pic/monback/exeggcuteb.pic" -GrimerPicFront:: INCBIN "pic/bmon/grimer.pic" -GrimerPicBack:: INCBIN "pic/monback/grimerb.pic" -GengarPicFront:: INCBIN "pic/bmon/gengar.pic" -GengarPicBack:: INCBIN "pic/monback/gengarb.pic" -NidoranFPicFront:: INCBIN "pic/bmon/nidoranf.pic" -NidoranFPicBack:: INCBIN "pic/monback/nidoranfb.pic" -NidoqueenPicFront:: INCBIN "pic/bmon/nidoqueen.pic" -NidoqueenPicBack:: INCBIN "pic/monback/nidoqueenb.pic" -CubonePicFront:: INCBIN "pic/bmon/cubone.pic" -CubonePicBack:: INCBIN "pic/monback/cuboneb.pic" -RhyhornPicFront:: INCBIN "pic/bmon/rhyhorn.pic" -RhyhornPicBack:: INCBIN "pic/monback/rhyhornb.pic" -LaprasPicFront:: INCBIN "pic/bmon/lapras.pic" -LaprasPicBack:: INCBIN "pic/monback/laprasb.pic" -ArcaninePicFront:: INCBIN "pic/bmon/arcanine.pic" -ArcaninePicBack:: INCBIN "pic/monback/arcanineb.pic" -GyaradosPicFront:: INCBIN "pic/bmon/gyarados.pic" -GyaradosPicBack:: INCBIN "pic/monback/gyaradosb.pic" -ShellderPicFront:: INCBIN "pic/bmon/shellder.pic" -ShellderPicBack:: INCBIN "pic/monback/shellderb.pic" -TentacoolPicFront:: INCBIN "pic/bmon/tentacool.pic" -TentacoolPicBack:: INCBIN "pic/monback/tentacoolb.pic" -GastlyPicFront:: INCBIN "pic/bmon/gastly.pic" -GastlyPicBack:: INCBIN "pic/monback/gastlyb.pic" -ScytherPicFront:: INCBIN "pic/bmon/scyther.pic" -ScytherPicBack:: INCBIN "pic/monback/scytherb.pic" -StaryuPicFront:: INCBIN "pic/bmon/staryu.pic" -StaryuPicBack:: INCBIN "pic/monback/staryub.pic" -BlastoisePicFront:: INCBIN "pic/bmon/blastoise.pic" -BlastoisePicBack:: INCBIN "pic/monback/blastoiseb.pic" -PinsirPicFront:: INCBIN "pic/bmon/pinsir.pic" -PinsirPicBack:: INCBIN "pic/monback/pinsirb.pic" -TangelaPicFront:: INCBIN "pic/bmon/tangela.pic" -TangelaPicBack:: INCBIN "pic/monback/tangelab.pic" - - -SECTION "Battle (bank 9)", ROMX, BANK[$9] +RhydonPicFront: INCBIN "pic/ymon/rhydon.pic" +RhydonPicBack: INCBIN "pic/monback/rhydonb.pic" +KangaskhanPicFront: INCBIN "pic/ymon/kangaskhan.pic" +KangaskhanPicBack: INCBIN "pic/monback/kangaskhanb.pic" +NidoranMPicFront: INCBIN "pic/ymon/nidoranm.pic" +NidoranMPicBack: INCBIN "pic/monback/nidoranmb.pic" +ClefairyPicFront: INCBIN "pic/ymon/clefairy.pic" +ClefairyPicBack: INCBIN "pic/monback/clefairyb.pic" +SpearowPicFront: INCBIN "pic/ymon/spearow.pic" +SpearowPicBack: INCBIN "pic/monback/spearowb.pic" +VoltorbPicFront: INCBIN "pic/ymon/voltorb.pic" +VoltorbPicBack: INCBIN "pic/monback/voltorbb.pic" +NidokingPicFront: INCBIN "pic/ymon/nidoking.pic" +NidokingPicBack: INCBIN "pic/monback/nidokingb.pic" +SlowbroPicFront: INCBIN "pic/ymon/slowbro.pic" +SlowbroPicBack: INCBIN "pic/monback/slowbrob.pic" +IvysaurPicFront: INCBIN "pic/ymon/ivysaur.pic" +IvysaurPicBack: INCBIN "pic/monback/ivysaurb.pic" +ExeggutorPicFront: INCBIN "pic/ymon/exeggutor.pic" +ExeggutorPicBack: INCBIN "pic/monback/exeggutorb.pic" +LickitungPicFront: INCBIN "pic/ymon/lickitung.pic" +LickitungPicBack: INCBIN "pic/monback/lickitungb.pic" +ExeggcutePicFront: INCBIN "pic/ymon/exeggcute.pic" +ExeggcutePicBack: INCBIN "pic/monback/exeggcuteb.pic" +GrimerPicFront: INCBIN "pic/ymon/grimer.pic" +GrimerPicBack: INCBIN "pic/monback/grimerb.pic" +GengarPicFront: INCBIN "pic/ymon/gengar.pic" +GengarPicBack: INCBIN "pic/monback/gengarb.pic" +NidoranFPicFront: INCBIN "pic/ymon/nidoranf.pic" +NidoranFPicBack: INCBIN "pic/monback/nidoranfb.pic" +NidoqueenPicFront: INCBIN "pic/ymon/nidoqueen.pic" +NidoqueenPicBack: INCBIN "pic/monback/nidoqueenb.pic" +CubonePicFront: INCBIN "pic/ymon/cubone.pic" +CubonePicBack: INCBIN "pic/monback/cuboneb.pic" +RhyhornPicFront: INCBIN "pic/ymon/rhyhorn.pic" +RhyhornPicBack: INCBIN "pic/monback/rhyhornb.pic" +LaprasPicFront: INCBIN "pic/ymon/lapras.pic" +LaprasPicBack: INCBIN "pic/monback/laprasb.pic" +ArcaninePicFront: INCBIN "pic/ymon/arcanine.pic" +ArcaninePicBack: INCBIN "pic/monback/arcanineb.pic" +MewPicFront: INCBIN "pic/ymon/mew.pic" +MewPicBack: INCBIN "pic/monback/mewb.pic" +GyaradosPicFront: INCBIN "pic/ymon/gyarados.pic" +GyaradosPicBack: INCBIN "pic/monback/gyaradosb.pic" +ShellderPicFront: INCBIN "pic/ymon/shellder.pic" +ShellderPicBack: INCBIN "pic/monback/shellderb.pic" +TentacoolPicFront: INCBIN "pic/ymon/tentacool.pic" +TentacoolPicBack: INCBIN "pic/monback/tentacoolb.pic" +GastlyPicFront: INCBIN "pic/ymon/gastly.pic" +GastlyPicBack: INCBIN "pic/monback/gastlyb.pic" +ScytherPicFront: INCBIN "pic/ymon/scyther.pic" +ScytherPicBack: INCBIN "pic/monback/scytherb.pic" +StaryuPicFront: INCBIN "pic/ymon/staryu.pic" +StaryuPicBack: INCBIN "pic/monback/staryub.pic" +BlastoisePicFront: INCBIN "pic/ymon/blastoise.pic" +BlastoisePicBack: INCBIN "pic/monback/blastoiseb.pic" +PinsirPicFront: INCBIN "pic/ymon/pinsir.pic" +PinsirPicBack: INCBIN "pic/monback/pinsirb.pic" +TangelaPicFront: INCBIN "pic/ymon/tangela.pic" +TangelaPicBack: INCBIN "pic/monback/tangelab.pic" + INCLUDE "engine/battle/print_type.asm" INCLUDE "engine/battle/save_trainer_name.asm" -INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm" SECTION "Pics 2", ROMX, BANK[PICS_2] -GrowlithePicFront:: INCBIN "pic/bmon/growlithe.pic" -GrowlithePicBack:: INCBIN "pic/monback/growlitheb.pic" -OnixPicFront:: INCBIN "pic/bmon/onix.pic" -OnixPicBack:: INCBIN "pic/monback/onixb.pic" -FearowPicFront:: INCBIN "pic/bmon/fearow.pic" -FearowPicBack:: INCBIN "pic/monback/fearowb.pic" -PidgeyPicFront:: INCBIN "pic/bmon/pidgey.pic" -PidgeyPicBack:: INCBIN "pic/monback/pidgeyb.pic" -SlowpokePicFront:: INCBIN "pic/bmon/slowpoke.pic" -SlowpokePicBack:: INCBIN "pic/monback/slowpokeb.pic" -KadabraPicFront:: INCBIN "pic/bmon/kadabra.pic" -KadabraPicBack:: INCBIN "pic/monback/kadabrab.pic" -GravelerPicFront:: INCBIN "pic/bmon/graveler.pic" -GravelerPicBack:: INCBIN "pic/monback/gravelerb.pic" -ChanseyPicFront:: INCBIN "pic/bmon/chansey.pic" -ChanseyPicBack:: INCBIN "pic/monback/chanseyb.pic" -MachokePicFront:: INCBIN "pic/bmon/machoke.pic" -MachokePicBack:: INCBIN "pic/monback/machokeb.pic" -MrMimePicFront:: INCBIN "pic/bmon/mr.mime.pic" -MrMimePicBack:: INCBIN "pic/monback/mr.mimeb.pic" -HitmonleePicFront:: INCBIN "pic/bmon/hitmonlee.pic" -HitmonleePicBack:: INCBIN "pic/monback/hitmonleeb.pic" -HitmonchanPicFront:: INCBIN "pic/bmon/hitmonchan.pic" -HitmonchanPicBack:: INCBIN "pic/monback/hitmonchanb.pic" -ArbokPicFront:: INCBIN "pic/bmon/arbok.pic" -ArbokPicBack:: INCBIN "pic/monback/arbokb.pic" -ParasectPicFront:: INCBIN "pic/bmon/parasect.pic" -ParasectPicBack:: INCBIN "pic/monback/parasectb.pic" -PsyduckPicFront:: INCBIN "pic/bmon/psyduck.pic" -PsyduckPicBack:: INCBIN "pic/monback/psyduckb.pic" -DrowzeePicFront:: INCBIN "pic/bmon/drowzee.pic" -DrowzeePicBack:: INCBIN "pic/monback/drowzeeb.pic" -GolemPicFront:: INCBIN "pic/bmon/golem.pic" -GolemPicBack:: INCBIN "pic/monback/golemb.pic" -MagmarPicFront:: INCBIN "pic/bmon/magmar.pic" -MagmarPicBack:: INCBIN "pic/monback/magmarb.pic" -ElectabuzzPicFront:: INCBIN "pic/bmon/electabuzz.pic" -ElectabuzzPicBack:: INCBIN "pic/monback/electabuzzb.pic" -MagnetonPicFront:: INCBIN "pic/bmon/magneton.pic" -MagnetonPicBack:: INCBIN "pic/monback/magnetonb.pic" -KoffingPicFront:: INCBIN "pic/bmon/koffing.pic" -KoffingPicBack:: INCBIN "pic/monback/koffingb.pic" -MankeyPicFront:: INCBIN "pic/bmon/mankey.pic" -MankeyPicBack:: INCBIN "pic/monback/mankeyb.pic" -SeelPicFront:: INCBIN "pic/bmon/seel.pic" -SeelPicBack:: INCBIN "pic/monback/seelb.pic" -DiglettPicFront:: INCBIN "pic/bmon/diglett.pic" -DiglettPicBack:: INCBIN "pic/monback/diglettb.pic" -TaurosPicFront:: INCBIN "pic/bmon/tauros.pic" -TaurosPicBack:: INCBIN "pic/monback/taurosb.pic" -FarfetchdPicFront:: INCBIN "pic/bmon/farfetchd.pic" -FarfetchdPicBack:: INCBIN "pic/monback/farfetchdb.pic" -VenonatPicFront:: INCBIN "pic/bmon/venonat.pic" -VenonatPicBack:: INCBIN "pic/monback/venonatb.pic" -DragonitePicFront:: INCBIN "pic/bmon/dragonite.pic" -DragonitePicBack:: INCBIN "pic/monback/dragoniteb.pic" -DoduoPicFront:: INCBIN "pic/bmon/doduo.pic" -DoduoPicBack:: INCBIN "pic/monback/doduob.pic" -PoliwagPicFront:: INCBIN "pic/bmon/poliwag.pic" -PoliwagPicBack:: INCBIN "pic/monback/poliwagb.pic" -JynxPicFront:: INCBIN "pic/bmon/jynx.pic" -JynxPicBack:: INCBIN "pic/monback/jynxb.pic" -MoltresPicFront:: INCBIN "pic/bmon/moltres.pic" -MoltresPicBack:: INCBIN "pic/monback/moltresb.pic" - - -SECTION "Battle (bank A)", ROMX, BANK[$A] +GrowlithePicFront: INCBIN "pic/ymon/growlithe.pic" +GrowlithePicBack: INCBIN "pic/monback/growlitheb.pic" +OnixPicFront: INCBIN "pic/ymon/onix.pic" +OnixPicBack: INCBIN "pic/monback/onixb.pic" +FearowPicFront: INCBIN "pic/ymon/fearow.pic" +FearowPicBack: INCBIN "pic/monback/fearowb.pic" +PidgeyPicFront: INCBIN "pic/ymon/pidgey.pic" +PidgeyPicBack: INCBIN "pic/monback/pidgeyb.pic" +SlowpokePicFront: INCBIN "pic/ymon/slowpoke.pic" +SlowpokePicBack: INCBIN "pic/monback/slowpokeb.pic" +KadabraPicFront: INCBIN "pic/ymon/kadabra.pic" +KadabraPicBack: INCBIN "pic/monback/kadabrab.pic" +GravelerPicFront: INCBIN "pic/ymon/graveler.pic" +GravelerPicBack: INCBIN "pic/monback/gravelerb.pic" +ChanseyPicFront: INCBIN "pic/ymon/chansey.pic" +ChanseyPicBack: INCBIN "pic/monback/chanseyb.pic" +MachokePicFront: INCBIN "pic/ymon/machoke.pic" +MachokePicBack: INCBIN "pic/monback/machokeb.pic" +MrMimePicFront: INCBIN "pic/ymon/mr.mime.pic" +MrMimePicBack: INCBIN "pic/monback/mr.mimeb.pic" +HitmonleePicFront: INCBIN "pic/ymon/hitmonlee.pic" +HitmonleePicBack: INCBIN "pic/monback/hitmonleeb.pic" +HitmonchanPicFront: INCBIN "pic/ymon/hitmonchan.pic" +HitmonchanPicBack: INCBIN "pic/monback/hitmonchanb.pic" +ArbokPicFront: INCBIN "pic/ymon/arbok.pic" +ArbokPicBack: INCBIN "pic/monback/arbokb.pic" +ParasectPicFront: INCBIN "pic/ymon/parasect.pic" +ParasectPicBack: INCBIN "pic/monback/parasectb.pic" +PsyduckPicFront: INCBIN "pic/ymon/psyduck.pic" +PsyduckPicBack: INCBIN "pic/monback/psyduckb.pic" +DrowzeePicFront: INCBIN "pic/ymon/drowzee.pic" +DrowzeePicBack: INCBIN "pic/monback/drowzeeb.pic" +GolemPicFront: INCBIN "pic/ymon/golem.pic" +GolemPicBack: INCBIN "pic/monback/golemb.pic" +MagmarPicFront: INCBIN "pic/ymon/magmar.pic" +MagmarPicBack: INCBIN "pic/monback/magmarb.pic" +ElectabuzzPicFront: INCBIN "pic/ymon/electabuzz.pic" +ElectabuzzPicBack: INCBIN "pic/monback/electabuzzb.pic" +MagnetonPicFront: INCBIN "pic/ymon/magneton.pic" +MagnetonPicBack: INCBIN "pic/monback/magnetonb.pic" +KoffingPicFront: INCBIN "pic/ymon/koffing.pic" +KoffingPicBack: INCBIN "pic/monback/koffingb.pic" +MankeyPicFront: INCBIN "pic/ymon/mankey.pic" +MankeyPicBack: INCBIN "pic/monback/mankeyb.pic" +SeelPicFront: INCBIN "pic/ymon/seel.pic" +SeelPicBack: INCBIN "pic/monback/seelb.pic" +DiglettPicFront: INCBIN "pic/ymon/diglett.pic" +DiglettPicBack: INCBIN "pic/monback/diglettb.pic" +TaurosPicFront: INCBIN "pic/ymon/tauros.pic" +TaurosPicBack: INCBIN "pic/monback/taurosb.pic" +FarfetchdPicFront: INCBIN "pic/ymon/farfetchd.pic" +FarfetchdPicBack: INCBIN "pic/monback/farfetchdb.pic" +VenonatPicFront: INCBIN "pic/ymon/venonat.pic" +VenonatPicBack: INCBIN "pic/monback/venonatb.pic" +DragonitePicFront: INCBIN "pic/ymon/dragonite.pic" +DragonitePicBack: INCBIN "pic/monback/dragoniteb.pic" +DoduoPicFront: INCBIN "pic/ymon/doduo.pic" +DoduoPicBack: INCBIN "pic/monback/doduob.pic" +PoliwagPicFront: INCBIN "pic/ymon/poliwag.pic" +PoliwagPicBack: INCBIN "pic/monback/poliwagb.pic" +JynxPicFront: INCBIN "pic/ymon/jynx.pic" +JynxPicBack: INCBIN "pic/monback/jynxb.pic" +MoltresPicFront: INCBIN "pic/ymon/moltres.pic" +MoltresPicBack: INCBIN "pic/monback/moltresb.pic" + +INCLUDE "engine/predefsA.asm" INCLUDE "engine/battle/moveEffects/leech_seed_effect.asm" SECTION "Pics 3", ROMX, BANK[PICS_3] -ArticunoPicFront:: INCBIN "pic/bmon/articuno.pic" -ArticunoPicBack:: INCBIN "pic/monback/articunob.pic" -ZapdosPicFront:: INCBIN "pic/bmon/zapdos.pic" -ZapdosPicBack:: INCBIN "pic/monback/zapdosb.pic" -DittoPicFront:: INCBIN "pic/bmon/ditto.pic" -DittoPicBack:: INCBIN "pic/monback/dittob.pic" -MeowthPicFront:: INCBIN "pic/bmon/meowth.pic" -MeowthPicBack:: INCBIN "pic/monback/meowthb.pic" -KrabbyPicFront:: INCBIN "pic/bmon/krabby.pic" -KrabbyPicBack:: INCBIN "pic/monback/krabbyb.pic" -VulpixPicFront:: INCBIN "pic/bmon/vulpix.pic" -VulpixPicBack:: INCBIN "pic/monback/vulpixb.pic" -NinetalesPicFront:: INCBIN "pic/bmon/ninetales.pic" -NinetalesPicBack:: INCBIN "pic/monback/ninetalesb.pic" -PikachuPicFront:: INCBIN "pic/bmon/pikachu.pic" -PikachuPicBack:: INCBIN "pic/monback/pikachub.pic" -RaichuPicFront:: INCBIN "pic/bmon/raichu.pic" -RaichuPicBack:: INCBIN "pic/monback/raichub.pic" -DratiniPicFront:: INCBIN "pic/bmon/dratini.pic" -DratiniPicBack:: INCBIN "pic/monback/dratinib.pic" -DragonairPicFront:: INCBIN "pic/bmon/dragonair.pic" -DragonairPicBack:: INCBIN "pic/monback/dragonairb.pic" -KabutoPicFront:: INCBIN "pic/bmon/kabuto.pic" -KabutoPicBack:: INCBIN "pic/monback/kabutob.pic" -KabutopsPicFront:: INCBIN "pic/bmon/kabutops.pic" -KabutopsPicBack:: INCBIN "pic/monback/kabutopsb.pic" -HorseaPicFront:: INCBIN "pic/bmon/horsea.pic" -HorseaPicBack:: INCBIN "pic/monback/horseab.pic" -SeadraPicFront:: INCBIN "pic/bmon/seadra.pic" -SeadraPicBack:: INCBIN "pic/monback/seadrab.pic" -SandshrewPicFront:: INCBIN "pic/bmon/sandshrew.pic" -SandshrewPicBack:: INCBIN "pic/monback/sandshrewb.pic" -SandslashPicFront:: INCBIN "pic/bmon/sandslash.pic" -SandslashPicBack:: INCBIN "pic/monback/sandslashb.pic" -OmanytePicFront:: INCBIN "pic/bmon/omanyte.pic" -OmanytePicBack:: INCBIN "pic/monback/omanyteb.pic" -OmastarPicFront:: INCBIN "pic/bmon/omastar.pic" -OmastarPicBack:: INCBIN "pic/monback/omastarb.pic" -JigglypuffPicFront:: INCBIN "pic/bmon/jigglypuff.pic" -JigglypuffPicBack:: INCBIN "pic/monback/jigglypuffb.pic" -WigglytuffPicFront:: INCBIN "pic/bmon/wigglytuff.pic" -WigglytuffPicBack:: INCBIN "pic/monback/wigglytuffb.pic" -EeveePicFront:: INCBIN "pic/bmon/eevee.pic" -EeveePicBack:: INCBIN "pic/monback/eeveeb.pic" -FlareonPicFront:: INCBIN "pic/bmon/flareon.pic" -FlareonPicBack:: INCBIN "pic/monback/flareonb.pic" -JolteonPicFront:: INCBIN "pic/bmon/jolteon.pic" -JolteonPicBack:: INCBIN "pic/monback/jolteonb.pic" -VaporeonPicFront:: INCBIN "pic/bmon/vaporeon.pic" -VaporeonPicBack:: INCBIN "pic/monback/vaporeonb.pic" -MachopPicFront:: INCBIN "pic/bmon/machop.pic" -MachopPicBack:: INCBIN "pic/monback/machopb.pic" -ZubatPicFront:: INCBIN "pic/bmon/zubat.pic" -ZubatPicBack:: INCBIN "pic/monback/zubatb.pic" -EkansPicFront:: INCBIN "pic/bmon/ekans.pic" -EkansPicBack:: INCBIN "pic/monback/ekansb.pic" -ParasPicFront:: INCBIN "pic/bmon/paras.pic" -ParasPicBack:: INCBIN "pic/monback/parasb.pic" -PoliwhirlPicFront:: INCBIN "pic/bmon/poliwhirl.pic" -PoliwhirlPicBack:: INCBIN "pic/monback/poliwhirlb.pic" -PoliwrathPicFront:: INCBIN "pic/bmon/poliwrath.pic" -PoliwrathPicBack:: INCBIN "pic/monback/poliwrathb.pic" -WeedlePicFront:: INCBIN "pic/bmon/weedle.pic" -WeedlePicBack:: INCBIN "pic/monback/weedleb.pic" -KakunaPicFront:: INCBIN "pic/bmon/kakuna.pic" -KakunaPicBack:: INCBIN "pic/monback/kakunab.pic" -BeedrillPicFront:: INCBIN "pic/bmon/beedrill.pic" -BeedrillPicBack:: INCBIN "pic/monback/beedrillb.pic" - -FossilKabutopsPic:: INCBIN "pic/bmon/fossilkabutops.pic" - - -SECTION "Battle (bank B)", ROMX, BANK[$B] +ArticunoPicFront: INCBIN "pic/ymon/articuno.pic" +ArticunoPicBack: INCBIN "pic/monback/articunob.pic" +ZapdosPicFront: INCBIN "pic/ymon/zapdos.pic" +ZapdosPicBack: INCBIN "pic/monback/zapdosb.pic" +DittoPicFront: INCBIN "pic/ymon/ditto.pic" +DittoPicBack: INCBIN "pic/monback/dittob.pic" +MeowthPicFront: INCBIN "pic/ymon/meowth.pic" +MeowthPicBack: INCBIN "pic/monback/meowthb.pic" +KrabbyPicFront: INCBIN "pic/ymon/krabby.pic" +KrabbyPicBack: INCBIN "pic/monback/krabbyb.pic" +VulpixPicFront: INCBIN "pic/ymon/vulpix.pic" +VulpixPicBack: INCBIN "pic/monback/vulpixb.pic" +NinetalesPicFront: INCBIN "pic/ymon/ninetales.pic" +NinetalesPicBack: INCBIN "pic/monback/ninetalesb.pic" +PikachuPicFront: INCBIN "pic/ymon/pikachu.pic" +PikachuPicBack: INCBIN "pic/monback/pikachub.pic" +RaichuPicFront: INCBIN "pic/ymon/raichu.pic" +RaichuPicBack: INCBIN "pic/monback/raichub.pic" +DratiniPicFront: INCBIN "pic/ymon/dratini.pic" +DratiniPicBack: INCBIN "pic/monback/dratinib.pic" +DragonairPicFront: INCBIN "pic/ymon/dragonair.pic" +DragonairPicBack: INCBIN "pic/monback/dragonairb.pic" +KabutoPicFront: INCBIN "pic/ymon/kabuto.pic" +KabutoPicBack: INCBIN "pic/monback/kabutob.pic" +KabutopsPicFront: INCBIN "pic/ymon/kabutops.pic" +KabutopsPicBack: INCBIN "pic/monback/kabutopsb.pic" +HorseaPicFront: INCBIN "pic/ymon/horsea.pic" +HorseaPicBack: INCBIN "pic/monback/horseab.pic" +SeadraPicFront: INCBIN "pic/ymon/seadra.pic" +SeadraPicBack: INCBIN "pic/monback/seadrab.pic" +SandshrewPicFront: INCBIN "pic/ymon/sandshrew.pic" +SandshrewPicBack: INCBIN "pic/monback/sandshrewb.pic" +SandslashPicFront: INCBIN "pic/ymon/sandslash.pic" +SandslashPicBack: INCBIN "pic/monback/sandslashb.pic" +OmanytePicFront: INCBIN "pic/ymon/omanyte.pic" +OmanytePicBack: INCBIN "pic/monback/omanyteb.pic" +OmastarPicFront: INCBIN "pic/ymon/omastar.pic" +OmastarPicBack: INCBIN "pic/monback/omastarb.pic" +JigglypuffPicFront: INCBIN "pic/ymon/jigglypuff.pic" +JigglypuffPicBack: INCBIN "pic/monback/jigglypuffb.pic" +WigglytuffPicFront: INCBIN "pic/ymon/wigglytuff.pic" +WigglytuffPicBack: INCBIN "pic/monback/wigglytuffb.pic" +EeveePicFront: INCBIN "pic/ymon/eevee.pic" +EeveePicBack: INCBIN "pic/monback/eeveeb.pic" +FlareonPicFront: INCBIN "pic/ymon/flareon.pic" +FlareonPicBack: INCBIN "pic/monback/flareonb.pic" +JolteonPicFront: INCBIN "pic/ymon/jolteon.pic" +JolteonPicBack: INCBIN "pic/monback/jolteonb.pic" +VaporeonPicFront: INCBIN "pic/ymon/vaporeon.pic" +VaporeonPicBack: INCBIN "pic/monback/vaporeonb.pic" +MachopPicFront: INCBIN "pic/ymon/machop.pic" +MachopPicBack: INCBIN "pic/monback/machopb.pic" +ZubatPicFront: INCBIN "pic/ymon/zubat.pic" +ZubatPicBack: INCBIN "pic/monback/zubatb.pic" +EkansPicFront: INCBIN "pic/ymon/ekans.pic" +EkansPicBack: INCBIN "pic/monback/ekansb.pic" +ParasPicFront: INCBIN "pic/ymon/paras.pic" +ParasPicBack: INCBIN "pic/monback/parasb.pic" +PoliwhirlPicFront: INCBIN "pic/ymon/poliwhirl.pic" +PoliwhirlPicBack: INCBIN "pic/monback/poliwhirlb.pic" +PoliwrathPicFront: INCBIN "pic/ymon/poliwrath.pic" +PoliwrathPicBack: INCBIN "pic/monback/poliwrathb.pic" +WeedlePicFront: INCBIN "pic/ymon/weedle.pic" +WeedlePicBack: INCBIN "pic/monback/weedleb.pic" +KakunaPicFront: INCBIN "pic/ymon/kakuna.pic" +KakunaPicBack: INCBIN "pic/monback/kakunab.pic" +BeedrillPicFront: INCBIN "pic/ymon/beedrill.pic" +BeedrillPicBack: INCBIN "pic/monback/beedrillb.pic" + +FossilKabutopsPic: INCBIN "pic/ymon/fossilkabutops.pic" INCLUDE "engine/battle/display_effectiveness.asm" +INCLUDE "engine/items/tmhm.asm" -TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" -TrainerInfoTextBoxTileGraphicsEnd: -BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" -CircleTile: INCBIN "gfx/circle_tile.2bpp" -BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" +Func_2fd6a: + callab IsThisPartymonStarterPikachu_Party + ret nc + ld a, $3 + ld [wPikachuSpawnState], a + ret -INCLUDE "engine/items/tmhm.asm" INCLUDE "engine/battle/scale_sprites.asm" -INCLUDE "engine/battle/moveEffects/pay_day_effect.asm" INCLUDE "engine/game_corner_slots2.asm" SECTION "Pics 4", ROMX, BANK[PICS_4] -DodrioPicFront:: INCBIN "pic/bmon/dodrio.pic" -DodrioPicBack:: INCBIN "pic/monback/dodriob.pic" -PrimeapePicFront:: INCBIN "pic/bmon/primeape.pic" -PrimeapePicBack:: INCBIN "pic/monback/primeapeb.pic" -DugtrioPicFront:: INCBIN "pic/bmon/dugtrio.pic" -DugtrioPicBack:: INCBIN "pic/monback/dugtriob.pic" -VenomothPicFront:: INCBIN "pic/bmon/venomoth.pic" -VenomothPicBack:: INCBIN "pic/monback/venomothb.pic" -DewgongPicFront:: INCBIN "pic/bmon/dewgong.pic" -DewgongPicBack:: INCBIN "pic/monback/dewgongb.pic" -CaterpiePicFront:: INCBIN "pic/bmon/caterpie.pic" -CaterpiePicBack:: INCBIN "pic/monback/caterpieb.pic" -MetapodPicFront:: INCBIN "pic/bmon/metapod.pic" -MetapodPicBack:: INCBIN "pic/monback/metapodb.pic" -ButterfreePicFront:: INCBIN "pic/bmon/butterfree.pic" -ButterfreePicBack:: INCBIN "pic/monback/butterfreeb.pic" -MachampPicFront:: INCBIN "pic/bmon/machamp.pic" -MachampPicBack:: INCBIN "pic/monback/machampb.pic" -GolduckPicFront:: INCBIN "pic/bmon/golduck.pic" -GolduckPicBack:: INCBIN "pic/monback/golduckb.pic" -HypnoPicFront:: INCBIN "pic/bmon/hypno.pic" -HypnoPicBack:: INCBIN "pic/monback/hypnob.pic" -GolbatPicFront:: INCBIN "pic/bmon/golbat.pic" -GolbatPicBack:: INCBIN "pic/monback/golbatb.pic" -MewtwoPicFront:: INCBIN "pic/bmon/mewtwo.pic" -MewtwoPicBack:: INCBIN "pic/monback/mewtwob.pic" -SnorlaxPicFront:: INCBIN "pic/bmon/snorlax.pic" -SnorlaxPicBack:: INCBIN "pic/monback/snorlaxb.pic" -MagikarpPicFront:: INCBIN "pic/bmon/magikarp.pic" -MagikarpPicBack:: INCBIN "pic/monback/magikarpb.pic" -MukPicFront:: INCBIN "pic/bmon/muk.pic" -MukPicBack:: INCBIN "pic/monback/mukb.pic" -KinglerPicFront:: INCBIN "pic/bmon/kingler.pic" -KinglerPicBack:: INCBIN "pic/monback/kinglerb.pic" -CloysterPicFront:: INCBIN "pic/bmon/cloyster.pic" -CloysterPicBack:: INCBIN "pic/monback/cloysterb.pic" -ElectrodePicFront:: INCBIN "pic/bmon/electrode.pic" -ElectrodePicBack:: INCBIN "pic/monback/electrodeb.pic" -ClefablePicFront:: INCBIN "pic/bmon/clefable.pic" -ClefablePicBack:: INCBIN "pic/monback/clefableb.pic" -WeezingPicFront:: INCBIN "pic/bmon/weezing.pic" -WeezingPicBack:: INCBIN "pic/monback/weezingb.pic" -PersianPicFront:: INCBIN "pic/bmon/persian.pic" -PersianPicBack:: INCBIN "pic/monback/persianb.pic" -MarowakPicFront:: INCBIN "pic/bmon/marowak.pic" -MarowakPicBack:: INCBIN "pic/monback/marowakb.pic" -HaunterPicFront:: INCBIN "pic/bmon/haunter.pic" -HaunterPicBack:: INCBIN "pic/monback/haunterb.pic" -AbraPicFront:: INCBIN "pic/bmon/abra.pic" -AbraPicBack:: INCBIN "pic/monback/abrab.pic" -AlakazamPicFront:: INCBIN "pic/bmon/alakazam.pic" -AlakazamPicBack:: INCBIN "pic/monback/alakazamb.pic" -PidgeottoPicFront:: INCBIN "pic/bmon/pidgeotto.pic" -PidgeottoPicBack:: INCBIN "pic/monback/pidgeottob.pic" -PidgeotPicFront:: INCBIN "pic/bmon/pidgeot.pic" -PidgeotPicBack:: INCBIN "pic/monback/pidgeotb.pic" -StarmiePicFront:: INCBIN "pic/bmon/starmie.pic" -StarmiePicBack:: INCBIN "pic/monback/starmieb.pic" - -RedPicBack:: INCBIN "pic/trainer/redb.pic" -OldManPic:: INCBIN "pic/trainer/oldman.pic" - - -SECTION "Battle (bank C)", ROMX, BANK[$C] -INCLUDE "engine/battle/moveEffects/mist_effect.asm" -INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm" +DodrioPicFront: INCBIN "pic/ymon/dodrio.pic" +DodrioPicBack: INCBIN "pic/monback/dodriob.pic" +PrimeapePicFront: INCBIN "pic/ymon/primeape.pic" +PrimeapePicBack: INCBIN "pic/monback/primeapeb.pic" +DugtrioPicFront: INCBIN "pic/ymon/dugtrio.pic" +DugtrioPicBack: INCBIN "pic/monback/dugtriob.pic" +VenomothPicFront: INCBIN "pic/ymon/venomoth.pic" +VenomothPicBack: INCBIN "pic/monback/venomothb.pic" +DewgongPicFront: INCBIN "pic/ymon/dewgong.pic" +DewgongPicBack: INCBIN "pic/monback/dewgongb.pic" +CaterpiePicFront: INCBIN "pic/ymon/caterpie.pic" +CaterpiePicBack: INCBIN "pic/monback/caterpieb.pic" +MetapodPicFront: INCBIN "pic/ymon/metapod.pic" +MetapodPicBack: INCBIN "pic/monback/metapodb.pic" +ButterfreePicFront: INCBIN "pic/ymon/butterfree.pic" +ButterfreePicBack: INCBIN "pic/monback/butterfreeb.pic" +MachampPicFront: INCBIN "pic/ymon/machamp.pic" +MachampPicBack: INCBIN "pic/monback/machampb.pic" +GolduckPicFront: INCBIN "pic/ymon/golduck.pic" +GolduckPicBack: INCBIN "pic/monback/golduckb.pic" +HypnoPicFront: INCBIN "pic/ymon/hypno.pic" +HypnoPicBack: INCBIN "pic/monback/hypnob.pic" +GolbatPicFront: INCBIN "pic/ymon/golbat.pic" +GolbatPicBack: INCBIN "pic/monback/golbatb.pic" +MewtwoPicFront: INCBIN "pic/ymon/mewtwo.pic" +MewtwoPicBack: INCBIN "pic/monback/mewtwob.pic" +SnorlaxPicFront: INCBIN "pic/ymon/snorlax.pic" +SnorlaxPicBack: INCBIN "pic/monback/snorlaxb.pic" +MagikarpPicFront: INCBIN "pic/ymon/magikarp.pic" +MagikarpPicBack: INCBIN "pic/monback/magikarpb.pic" +MukPicFront: INCBIN "pic/ymon/muk.pic" +MukPicBack: INCBIN "pic/monback/mukb.pic" +KinglerPicFront: INCBIN "pic/ymon/kingler.pic" +KinglerPicBack: INCBIN "pic/monback/kinglerb.pic" +CloysterPicFront: INCBIN "pic/ymon/cloyster.pic" +CloysterPicBack: INCBIN "pic/monback/cloysterb.pic" +ElectrodePicFront: INCBIN "pic/ymon/electrode.pic" +ElectrodePicBack: INCBIN "pic/monback/electrodeb.pic" +ClefablePicFront: INCBIN "pic/ymon/clefable.pic" +ClefablePicBack: INCBIN "pic/monback/clefableb.pic" +WeezingPicFront: INCBIN "pic/ymon/weezing.pic" +WeezingPicBack: INCBIN "pic/monback/weezingb.pic" +PersianPicFront: INCBIN "pic/ymon/persian.pic" +PersianPicBack: INCBIN "pic/monback/persianb.pic" +MarowakPicFront: INCBIN "pic/ymon/marowak.pic" +MarowakPicBack: INCBIN "pic/monback/marowakb.pic" +HaunterPicFront: INCBIN "pic/ymon/haunter.pic" +HaunterPicBack: INCBIN "pic/monback/haunterb.pic" +AbraPicFront: INCBIN "pic/ymon/abra.pic" +AbraPicBack: INCBIN "pic/monback/abrab.pic" +AlakazamPicFront: INCBIN "pic/ymon/alakazam.pic" +AlakazamPicBack: INCBIN "pic/monback/alakazamb.pic" +PidgeottoPicFront: INCBIN "pic/ymon/pidgeotto.pic" +PidgeottoPicBack: INCBIN "pic/monback/pidgeottob.pic" +PidgeotPicFront: INCBIN "pic/ymon/pidgeot.pic" +PidgeotPicBack: INCBIN "pic/monback/pidgeotb.pic" +StarmiePicFront: INCBIN "pic/ymon/starmie.pic" +StarmiePicBack: INCBIN "pic/monback/starmieb.pic" SECTION "Pics 5", ROMX, BANK[PICS_5] -BulbasaurPicFront:: INCBIN "pic/bmon/bulbasaur.pic" -BulbasaurPicBack:: INCBIN "pic/monback/bulbasaurb.pic" -VenusaurPicFront:: INCBIN "pic/bmon/venusaur.pic" -VenusaurPicBack:: INCBIN "pic/monback/venusaurb.pic" -TentacruelPicFront:: INCBIN "pic/bmon/tentacruel.pic" -TentacruelPicBack:: INCBIN "pic/monback/tentacruelb.pic" -GoldeenPicFront:: INCBIN "pic/bmon/goldeen.pic" -GoldeenPicBack:: INCBIN "pic/monback/goldeenb.pic" -SeakingPicFront:: INCBIN "pic/bmon/seaking.pic" -SeakingPicBack:: INCBIN "pic/monback/seakingb.pic" -PonytaPicFront:: INCBIN "pic/bmon/ponyta.pic" -RapidashPicFront:: INCBIN "pic/bmon/rapidash.pic" -PonytaPicBack:: INCBIN "pic/monback/ponytab.pic" -RapidashPicBack:: INCBIN "pic/monback/rapidashb.pic" -RattataPicFront:: INCBIN "pic/bmon/rattata.pic" -RattataPicBack:: INCBIN "pic/monback/rattatab.pic" -RaticatePicFront:: INCBIN "pic/bmon/raticate.pic" -RaticatePicBack:: INCBIN "pic/monback/raticateb.pic" -NidorinoPicFront:: INCBIN "pic/bmon/nidorino.pic" -NidorinoPicBack:: INCBIN "pic/monback/nidorinob.pic" -NidorinaPicFront:: INCBIN "pic/bmon/nidorina.pic" -NidorinaPicBack:: INCBIN "pic/monback/nidorinab.pic" -GeodudePicFront:: INCBIN "pic/bmon/geodude.pic" -GeodudePicBack:: INCBIN "pic/monback/geodudeb.pic" -PorygonPicFront:: INCBIN "pic/bmon/porygon.pic" -PorygonPicBack:: INCBIN "pic/monback/porygonb.pic" -AerodactylPicFront:: INCBIN "pic/bmon/aerodactyl.pic" -AerodactylPicBack:: INCBIN "pic/monback/aerodactylb.pic" -MagnemitePicFront:: INCBIN "pic/bmon/magnemite.pic" -MagnemitePicBack:: INCBIN "pic/monback/magnemiteb.pic" -CharmanderPicFront:: INCBIN "pic/bmon/charmander.pic" -CharmanderPicBack:: INCBIN "pic/monback/charmanderb.pic" -SquirtlePicFront:: INCBIN "pic/bmon/squirtle.pic" -SquirtlePicBack:: INCBIN "pic/monback/squirtleb.pic" -CharmeleonPicFront:: INCBIN "pic/bmon/charmeleon.pic" -CharmeleonPicBack:: INCBIN "pic/monback/charmeleonb.pic" -WartortlePicFront:: INCBIN "pic/bmon/wartortle.pic" -WartortlePicBack:: INCBIN "pic/monback/wartortleb.pic" -CharizardPicFront:: INCBIN "pic/bmon/charizard.pic" -CharizardPicBack:: INCBIN "pic/monback/charizardb.pic" -FossilAerodactylPic:: INCBIN "pic/bmon/fossilaerodactyl.pic" -GhostPic:: INCBIN "pic/other/ghost.pic" -OddishPicFront:: INCBIN "pic/bmon/oddish.pic" -OddishPicBack:: INCBIN "pic/monback/oddishb.pic" -GloomPicFront:: INCBIN "pic/bmon/gloom.pic" -GloomPicBack:: INCBIN "pic/monback/gloomb.pic" -VileplumePicFront:: INCBIN "pic/bmon/vileplume.pic" -VileplumePicBack:: INCBIN "pic/monback/vileplumeb.pic" -BellsproutPicFront:: INCBIN "pic/bmon/bellsprout.pic" -BellsproutPicBack:: INCBIN "pic/monback/bellsproutb.pic" -WeepinbellPicFront:: INCBIN "pic/bmon/weepinbell.pic" -WeepinbellPicBack:: INCBIN "pic/monback/weepinbellb.pic" -VictreebelPicFront:: INCBIN "pic/bmon/victreebel.pic" -VictreebelPicBack:: INCBIN "pic/monback/victreebelb.pic" - - -SECTION "Battle (bank D)", ROMX, BANK[$D] +BulbasaurPicFront: INCBIN "pic/ymon/bulbasaur.pic" +BulbasaurPicBack: INCBIN "pic/monback/bulbasaurb.pic" +VenusaurPicFront: INCBIN "pic/ymon/venusaur.pic" +VenusaurPicBack: INCBIN "pic/monback/venusaurb.pic" +TentacruelPicFront: INCBIN "pic/ymon/tentacruel.pic" +TentacruelPicBack: INCBIN "pic/monback/tentacruelb.pic" +GoldeenPicFront: INCBIN "pic/ymon/goldeen.pic" +GoldeenPicBack: INCBIN "pic/monback/goldeenb.pic" +SeakingPicFront: INCBIN "pic/ymon/seaking.pic" +SeakingPicBack: INCBIN "pic/monback/seakingb.pic" +PonytaPicFront: INCBIN "pic/ymon/ponyta.pic" +RapidashPicFront: INCBIN "pic/ymon/rapidash.pic" +PonytaPicBack: INCBIN "pic/monback/ponytab.pic" +RapidashPicBack: INCBIN "pic/monback/rapidashb.pic" +RattataPicFront: INCBIN "pic/ymon/rattata.pic" +RattataPicBack: INCBIN "pic/monback/rattatab.pic" +RaticatePicFront: INCBIN "pic/ymon/raticate.pic" +RaticatePicBack: INCBIN "pic/monback/raticateb.pic" +NidorinoPicFront: INCBIN "pic/ymon/nidorino.pic" +NidorinoPicBack: INCBIN "pic/monback/nidorinob.pic" +NidorinaPicFront: INCBIN "pic/ymon/nidorina.pic" +NidorinaPicBack: INCBIN "pic/monback/nidorinab.pic" +GeodudePicFront: INCBIN "pic/ymon/geodude.pic" +GeodudePicBack: INCBIN "pic/monback/geodudeb.pic" +PorygonPicFront: INCBIN "pic/ymon/porygon.pic" +PorygonPicBack: INCBIN "pic/monback/porygonb.pic" +AerodactylPicFront: INCBIN "pic/ymon/aerodactyl.pic" +AerodactylPicBack: INCBIN "pic/monback/aerodactylb.pic" +MagnemitePicFront: INCBIN "pic/ymon/magnemite.pic" +MagnemitePicBack: INCBIN "pic/monback/magnemiteb.pic" +CharmanderPicFront: INCBIN "pic/ymon/charmander.pic" +CharmanderPicBack: INCBIN "pic/monback/charmanderb.pic" +SquirtlePicFront: INCBIN "pic/ymon/squirtle.pic" +SquirtlePicBack: INCBIN "pic/monback/squirtleb.pic" +CharmeleonPicFront: INCBIN "pic/ymon/charmeleon.pic" +CharmeleonPicBack: INCBIN "pic/monback/charmeleonb.pic" +WartortlePicFront: INCBIN "pic/ymon/wartortle.pic" +WartortlePicBack: INCBIN "pic/monback/wartortleb.pic" +CharizardPicFront: INCBIN "pic/ymon/charizard.pic" +CharizardPicBack: INCBIN "pic/monback/charizardb.pic" +FossilAerodactylPic: INCBIN "pic/ymon/fossilaerodactyl.pic" +GhostPic: INCBIN "pic/other/ghost.pic" +OddishPicFront: INCBIN "pic/ymon/oddish.pic" +OddishPicBack: INCBIN "pic/monback/oddishb.pic" +GloomPicFront: INCBIN "pic/ymon/gloom.pic" +GloomPicBack: INCBIN "pic/monback/gloomb.pic" +VileplumePicFront: INCBIN "pic/ymon/vileplume.pic" +VileplumePicBack: INCBIN "pic/monback/vileplumeb.pic" +BellsproutPicFront: INCBIN "pic/ymon/bellsprout.pic" +BellsproutPicBack: INCBIN "pic/monback/bellsproutb.pic" +WeepinbellPicFront: INCBIN "pic/ymon/weepinbell.pic" +WeepinbellPicBack: INCBIN "pic/monback/weepinbellb.pic" +VictreebelPicFront: INCBIN "pic/ymon/victreebel.pic" +VictreebelPicBack: INCBIN "pic/monback/victreebelb.pic" INCLUDE "engine/titlescreen2.asm" -INCLUDE "engine/battle/link_battle_versus_text.asm" INCLUDE "engine/slot_machine.asm" -INCLUDE "engine/overworld/pewter_guys.asm" -INCLUDE "engine/multiply_divide.asm" INCLUDE "engine/game_corner_slots.asm" -SECTION "bankE",ROMX,BANK[$E] +SECTION "bank0E",ROMX,BANK[$0E] INCLUDE "data/moves.asm" BaseStats: INCLUDE "data/base_stats.asm" INCLUDE "data/cries.asm" -INCLUDE "engine/battle/unused_stats_functions.asm" -INCLUDE "engine/battle/scroll_draw_trainer_pic.asm" INCLUDE "engine/battle/trainer_ai.asm" INCLUDE "engine/battle/draw_hud_pokeball_gfx.asm" -TradingAnimationGraphics: - INCBIN "gfx/game_boy.norepeat.2bpp" +TradingAnimationGraphics: INCBIN "gfx/game_boy.norepeat.2bpp" INCBIN "gfx/link_cable.2bpp" TradingAnimationGraphicsEnd: @@ -5515,12 +846,9 @@ TradingAnimationGraphics2: TradingAnimationGraphics2End: INCLUDE "engine/evos_moves.asm" -INCLUDE "engine/battle/moveEffects/heal_effect.asm" -INCLUDE "engine/battle/moveEffects/transform_effect.asm" -INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm" -SECTION "bankF",ROMX,BANK[$F] +SECTION "bank0F",ROMX,BANK[$0F] INCLUDE "engine/battle/core.asm" @@ -5528,9 +856,11 @@ INCLUDE "engine/battle/core.asm" SECTION "bank10",ROMX,BANK[$10] INCLUDE "engine/menu/pokedex.asm" +INCLUDE "engine/overworld/emotion_bubbles.asm" INCLUDE "engine/trade.asm" INCLUDE "engine/intro.asm" INCLUDE "engine/trade2.asm" +INCLUDE "engine/menu/options.asm" SECTION "bank11",ROMX,BANK[$11] @@ -5538,9 +868,7 @@ SECTION "bank11",ROMX,BANK[$11] INCLUDE "data/mapHeaders/lavendertown.asm" INCLUDE "data/mapObjects/lavendertown.asm" LavenderTownBlocks: INCBIN "maps/lavendertown.blk" - ViridianPokecenterBlocks: INCBIN "maps/viridianpokecenter.blk" - SafariZoneRestHouse1Blocks: SafariZoneRestHouse2Blocks: SafariZoneRestHouse3Blocks: @@ -5554,6 +882,11 @@ INCLUDE "data/mapHeaders/viridianpokecenter.asm" INCLUDE "scripts/viridianpokecenter.asm" INCLUDE "data/mapObjects/viridianpokecenter.asm" +INCLUDE "data/mapHeaders/celadonmart1.asm" +INCLUDE "scripts/celadonmart1.asm" +INCLUDE "data/mapObjects/celadonmart1.asm" +CeladonMart1Blocks: INCBIN "maps/celadonmart1.blk" + INCLUDE "data/mapHeaders/mansion1.asm" INCLUDE "scripts/mansion1.asm" INCLUDE "data/mapObjects/mansion1.asm" @@ -5675,31 +1008,25 @@ INCLUDE "scripts/seafoamislands5.asm" INCLUDE "data/mapObjects/seafoamislands5.asm" SeafoamIslands5Blocks: INCBIN "maps/seafoamislands5.blk" -INCLUDE "engine/overworld/hidden_objects.asm" +INCLUDE "engine/overworld/dungeon_warps.asm" SECTION "bank12",ROMX,BANK[$12] INCLUDE "data/mapHeaders/route7.asm" INCLUDE "data/mapObjects/route7.asm" -Route7Blocks: INCBIN "maps/route7.blk" - -CeladonPokecenterBlocks: +Route7Blocks: INCBIN "maps/route7.blk" ; 48051 +MtMoonPokecenterBlocks: RockTunnelPokecenterBlocks: -MtMoonPokecenterBlocks: INCBIN "maps/mtmoonpokecenter.blk" - -Route18GateBlocks: +CeladonPokecenterBlocks: INCBIN "maps/mtmoonpokecenter.blk" +Route11GateBlocks: Route15GateBlocks: -Route11GateBlocks: INCBIN "maps/route11gate.blk" - -Route18GateUpstairsBlocks: -Route16GateUpstairsBlocks: +Route18GateBlocks: INCBIN "maps/route11gate.blk" +Route11GateUpstairsBlocks: Route12GateUpstairsBlocks: Route15GateUpstairsBlocks: -Route11GateUpstairsBlocks: INCBIN "maps/route11gateupstairs.blk" - -INCLUDE "engine/predefs12.asm" - +Route16GateUpstairsBlocks: +Route18GateUpstairsBlocks: INCBIN "maps/route11gateupstairs.blk" INCLUDE "scripts/route7.asm" INCLUDE "data/mapHeaders/redshouse1f.asm" @@ -5845,6 +1172,7 @@ INCLUDE "data/mapHeaders/mtmoon3.asm" INCLUDE "scripts/mtmoon3.asm" INCLUDE "data/mapObjects/mtmoon3.asm" MtMoon3Blocks: INCBIN "maps/mtmoon3.blk" +INCLUDE "scripts/mtmoon3_2.asm" INCLUDE "data/mapHeaders/safarizonewest.asm" INCLUDE "scripts/safarizonewest.asm" @@ -5859,75 +1187,75 @@ SafariZoneSecretHouseBlocks: INCBIN "maps/safarizonesecrethouse.blk" SECTION "bank13",ROMX,BANK[$13] -TrainerPics:: -YoungsterPic:: INCBIN "pic/trainer/youngster.pic" -BugCatcherPic:: INCBIN "pic/trainer/bugcatcher.pic" -LassPic:: INCBIN "pic/trainer/lass.pic" -SailorPic:: INCBIN "pic/trainer/sailor.pic" -JrTrainerMPic:: INCBIN "pic/trainer/jr.trainerm.pic" -JrTrainerFPic:: INCBIN "pic/trainer/jr.trainerf.pic" -PokemaniacPic:: INCBIN "pic/trainer/pokemaniac.pic" -SuperNerdPic:: INCBIN "pic/trainer/supernerd.pic" -HikerPic:: INCBIN "pic/trainer/hiker.pic" -BikerPic:: INCBIN "pic/trainer/biker.pic" -BurglarPic:: INCBIN "pic/trainer/burglar.pic" -EngineerPic:: INCBIN "pic/trainer/engineer.pic" -FisherPic:: INCBIN "pic/trainer/fisher.pic" -SwimmerPic:: INCBIN "pic/trainer/swimmer.pic" -CueBallPic:: INCBIN "pic/trainer/cueball.pic" -GamblerPic:: INCBIN "pic/trainer/gambler.pic" -BeautyPic:: INCBIN "pic/trainer/beauty.pic" -PsychicPic:: INCBIN "pic/trainer/psychic.pic" -RockerPic:: INCBIN "pic/trainer/rocker.pic" -JugglerPic:: INCBIN "pic/trainer/juggler.pic" -TamerPic:: INCBIN "pic/trainer/tamer.pic" -BirdKeeperPic:: INCBIN "pic/trainer/birdkeeper.pic" -BlackbeltPic:: INCBIN "pic/trainer/blackbelt.pic" -Rival1Pic:: INCBIN "pic/trainer/rival1.pic" -ProfOakPic:: INCBIN "pic/trainer/prof.oak.pic" -ChiefPic:: -ScientistPic:: INCBIN "pic/trainer/scientist.pic" -GiovanniPic:: INCBIN "pic/trainer/giovanni.pic" -RocketPic:: INCBIN "pic/trainer/rocket.pic" -CooltrainerMPic:: INCBIN "pic/trainer/cooltrainerm.pic" -CooltrainerFPic:: INCBIN "pic/trainer/cooltrainerf.pic" -BrunoPic:: INCBIN "pic/trainer/bruno.pic" -BrockPic:: INCBIN "pic/trainer/brock.pic" -MistyPic:: INCBIN "pic/trainer/misty.pic" -LtSurgePic:: INCBIN "pic/trainer/lt.surge.pic" -ErikaPic:: INCBIN "pic/trainer/erika.pic" -KogaPic:: INCBIN "pic/trainer/koga.pic" -BlainePic:: INCBIN "pic/trainer/blaine.pic" -SabrinaPic:: INCBIN "pic/trainer/sabrina.pic" -GentlemanPic:: INCBIN "pic/trainer/gentleman.pic" -Rival2Pic:: INCBIN "pic/trainer/rival2.pic" -Rival3Pic:: INCBIN "pic/trainer/rival3.pic" -LoreleiPic:: INCBIN "pic/trainer/lorelei.pic" -ChannelerPic:: INCBIN "pic/trainer/channeler.pic" -AgathaPic:: INCBIN "pic/trainer/agatha.pic" -LancePic:: INCBIN "pic/trainer/lance.pic" +TrainerPics: +YoungsterPic: INCBIN "pic/trainer/youngster.pic" +BugCatcherPic: INCBIN "pic/trainer/bugcatcher.pic" +LassPic: INCBIN "pic/trainer/lass.pic" +SailorPic: INCBIN "pic/trainer/sailor.pic" +JrTrainerMPic: INCBIN "pic/trainer/jr.trainerm.pic" +JrTrainerFPic: INCBIN "pic/trainer/jr.trainerf.pic" +PokemaniacPic: INCBIN "pic/trainer/pokemaniac.pic" +SuperNerdPic: INCBIN "pic/trainer/supernerd.pic" +HikerPic: INCBIN "pic/trainer/hiker.pic" +BikerPic: INCBIN "pic/trainer/biker.pic" +BurglarPic: INCBIN "pic/trainer/burglar.pic" +EngineerPic: INCBIN "pic/trainer/engineer.pic" +FisherPic: INCBIN "pic/trainer/fisher.pic" +SwimmerPic: INCBIN "pic/trainer/swimmer.pic" +CueBallPic: INCBIN "pic/trainer/cueball.pic" +GamblerPic: INCBIN "pic/trainer/gambler.pic" +BeautyPic: INCBIN "pic/trainer/beauty.pic" +PsychicPic: INCBIN "pic/trainer/psychic.pic" +RockerPic: INCBIN "pic/trainer/rocker.pic" +JugglerPic: INCBIN "pic/trainer/juggler.pic" +TamerPic: INCBIN "pic/trainer/tamer.pic" +BirdKeeperPic: INCBIN "pic/trainer/birdkeeper.pic" +BlackbeltPic: INCBIN "pic/trainer/blackbelt.pic" +Rival1Pic: INCBIN "pic/ytrainer/rival1.pic" +ProfOakPic: INCBIN "pic/trainer/prof.oak.pic" +ChiefPic: +ScientistPic: INCBIN "pic/trainer/scientist.pic" +GiovanniPic: INCBIN "pic/trainer/giovanni.pic" +RocketPic: INCBIN "pic/trainer/rocket.pic" +CooltrainerMPic: INCBIN "pic/trainer/cooltrainerm.pic" +CooltrainerFPic: INCBIN "pic/trainer/cooltrainerf.pic" +BrunoPic: INCBIN "pic/trainer/bruno.pic" +BrockPic: INCBIN "pic/ytrainer/brock.pic" +MistyPic: INCBIN "pic/ytrainer/misty.pic" +LtSurgePic: INCBIN "pic/trainer/lt.surge.pic" +ErikaPic: INCBIN "pic/ytrainer/erika.pic" +KogaPic: INCBIN "pic/trainer/koga.pic" +BlainePic: INCBIN "pic/trainer/blaine.pic" +SabrinaPic: INCBIN "pic/trainer/sabrina.pic" +GentlemanPic: INCBIN "pic/trainer/gentleman.pic" +Rival2Pic: INCBIN "pic/ytrainer/rival2.pic" +Rival3Pic: INCBIN "pic/ytrainer/rival3.pic" +LoreleiPic: INCBIN "pic/trainer/lorelei.pic" +ChannelerPic: INCBIN "pic/trainer/channeler.pic" +AgathaPic: INCBIN "pic/trainer/agatha.pic" +LancePic: INCBIN "pic/trainer/lance.pic" +JessieJamesPic: INCBIN "pic/ytrainer/jessiejames.pic" + +; 4fe79 (13:7e79) INCLUDE "data/mapHeaders/tradecenter.asm" INCLUDE "scripts/tradecenter.asm" INCLUDE "data/mapObjects/tradecenter.asm" TradeCenterBlocks: INCBIN "maps/tradecenter.blk" +; 4fee6 (13:7ee6) + INCLUDE "data/mapHeaders/colosseum.asm" INCLUDE "scripts/colosseum.asm" INCLUDE "data/mapObjects/colosseum.asm" ColosseumBlocks: INCBIN "maps/colosseum.blk" -INCLUDE "engine/give_pokemon.asm" - -INCLUDE "engine/predefs.asm" - SECTION "bank14",ROMX,BANK[$14] INCLUDE "data/mapHeaders/route22.asm" INCLUDE "data/mapObjects/route22.asm" Route22Blocks: INCBIN "maps/route22.blk" - INCLUDE "data/mapHeaders/route20.asm" INCLUDE "data/mapObjects/route20.asm" Route20Blocks: INCBIN "maps/route20.blk" @@ -5938,22 +1266,22 @@ Route23Blocks: INCBIN "maps/route23.blk" INCLUDE "data/mapHeaders/route24.asm" INCLUDE "data/mapObjects/route24.asm" -Route24Blocks: INCBIN "maps/route24.blk" +Route24Blocks: INCBIN "maps/route24.blk" ; 506ed (14:46ed) INCLUDE "data/mapHeaders/route25.asm" INCLUDE "data/mapObjects/route25.asm" -Route25Blocks: INCBIN "maps/route25.blk" +Route25Blocks: INCBIN "maps/route25.blk" ; 50816 (14:4816) +; indigoplateau INCLUDE "data/mapHeaders/indigoplateau.asm" INCLUDE "scripts/indigoplateau.asm" INCLUDE "data/mapObjects/indigoplateau.asm" -IndigoPlateauBlocks: INCBIN "maps/indigoplateau.blk" +IndigoPlateauBlocks: INCBIN "maps/indigoplateau.blk" ; 50950 (14:4950) INCLUDE "data/mapHeaders/saffroncity.asm" INCLUDE "data/mapObjects/saffroncity.asm" -SaffronCityBlocks: INCBIN "maps/saffroncity.blk" +SaffronCityBlocks: INCBIN "maps/saffroncity.blk" ; 50a98 (14:4a98) INCLUDE "scripts/saffroncity.asm" - INCLUDE "scripts/route20.asm" INCLUDE "scripts/route22.asm" INCLUDE "scripts/route23.asm" @@ -5990,9 +1318,6 @@ INCLUDE "scripts/mansion4.asm" INCLUDE "data/mapObjects/mansion4.asm" Mansion4Blocks: INCBIN "maps/mansion4.blk" -INCLUDE "engine/battle/init_battle_variables.asm" -INCLUDE "engine/battle/moveEffects/paralyze_effect.asm" - INCLUDE "engine/overworld/card_key.asm" INCLUDE "engine/menu/prize_menu.asm" @@ -6004,23 +1329,23 @@ SECTION "bank15",ROMX,BANK[$15] INCLUDE "data/mapHeaders/route2.asm" INCLUDE "data/mapObjects/route2.asm" -Route2Blocks: INCBIN "maps/route2.blk" +Route2Blocks: INCBIN "maps/route2.blk" ; 54086 INCLUDE "data/mapHeaders/route3.asm" INCLUDE "data/mapObjects/route3.asm" -Route3Blocks: INCBIN "maps/route3.blk" +Route3Blocks: INCBIN "maps/route3.blk" ; 5425d INCLUDE "data/mapHeaders/route4.asm" INCLUDE "data/mapObjects/route4.asm" -Route4Blocks: INCBIN "maps/route4.blk" +Route4Blocks: INCBIN "maps/route4.blk" ; 543f4 INCLUDE "data/mapHeaders/route5.asm" INCLUDE "data/mapObjects/route5.asm" -Route5Blocks: INCBIN "maps/route5.blk" +Route5Blocks: INCBIN "maps/route5.blk" ; 545da INCLUDE "data/mapHeaders/route9.asm" INCLUDE "data/mapObjects/route9.asm" -Route9Blocks: INCBIN "maps/route9.blk" +Route9Blocks: INCBIN "maps/route9.blk" ; 54706 INCLUDE "data/mapHeaders/route13.asm" INCLUDE "data/mapObjects/route13.asm" @@ -6040,12 +1365,11 @@ Route19Blocks: INCBIN "maps/route19.blk" INCLUDE "data/mapHeaders/route21.asm" INCLUDE "data/mapObjects/route21.asm" -Route21Blocks: INCBIN "maps/route21.blk" +Route21Blocks: INCBIN "maps/route21.blk" ; 5507d +DayCareMBlocks: VermilionHouse2Blocks: -Route12HouseBlocks: -DayCareMBlocks: INCBIN "maps/daycarem.blk" - +Route12HouseBlocks: INCBIN "maps/daycarem.blk" FuchsiaHouse3Blocks: INCBIN "maps/fuchsiahouse3.blk" INCLUDE "engine/battle/experience.asm" @@ -6087,7 +1411,7 @@ INCLUDE "scripts/silphco8.asm" INCLUDE "data/mapObjects/silphco8.asm" SilphCo8Blocks: INCBIN "maps/silphco8.blk" -INCLUDE "engine/menu/diploma.asm" +INCLUDE "engine/menu/diploma_1.asm" INCLUDE "engine/overworld/trainers.asm" @@ -6096,11 +1420,11 @@ SECTION "bank16",ROMX,BANK[$16] INCLUDE "data/mapHeaders/route6.asm" INCLUDE "data/mapObjects/route6.asm" -Route6Blocks: INCBIN "maps/route6.blk" +Route6Blocks: INCBIN "maps/route6.blk" ; 58079 INCLUDE "data/mapHeaders/route8.asm" INCLUDE "data/mapObjects/route8.asm" -Route8Blocks: INCBIN "maps/route8.blk" +Route8Blocks: INCBIN "maps/route8.blk" ; 581c6 INCLUDE "data/mapHeaders/route10.asm" INCLUDE "data/mapObjects/route10.asm" @@ -6108,7 +1432,7 @@ Route10Blocks: INCBIN "maps/route10.blk" INCLUDE "data/mapHeaders/route11.asm" INCLUDE "data/mapObjects/route11.asm" -Route11Blocks: INCBIN "maps/route11.blk" +Route11Blocks: INCBIN "maps/route11.blk" ; 5855f INCLUDE "data/mapHeaders/route12.asm" INCLUDE "data/mapObjects/route12.asm" @@ -6120,18 +1444,18 @@ Route15Blocks: INCBIN "maps/route15.blk" INCLUDE "data/mapHeaders/route16.asm" INCLUDE "data/mapObjects/route16.asm" -Route16Blocks: INCBIN "maps/route16.blk" +Route16Blocks: INCBIN "maps/route16.blk" ; 58b84 INCLUDE "data/mapHeaders/route18.asm" INCLUDE "data/mapObjects/route18.asm" Route18Blocks: INCBIN "maps/route18.blk" - INCBIN "maps/unusedblocks58d7d.blk" - -INCLUDE "engine/battle/common_text.asm" +INCBIN "maps/unusedblocks58d7d.blk" INCLUDE "engine/experience.asm" +INCLUDE "engine/status_ailments.asm" + INCLUDE "engine/overworld/oaks_aide.asm" INCLUDE "scripts/route6.asm" @@ -6146,69 +1470,57 @@ INCLUDE "scripts/route18.asm" INCLUDE "data/mapHeaders/fanclub.asm" INCLUDE "scripts/fanclub.asm" INCLUDE "data/mapObjects/fanclub.asm" -FanClubBlocks: - INCBIN "maps/fanclub.blk" +FanClubBlocks: INCBIN "maps/fanclub.blk" INCLUDE "data/mapHeaders/silphco2.asm" INCLUDE "scripts/silphco2.asm" INCLUDE "data/mapObjects/silphco2.asm" -SilphCo2Blocks: - INCBIN "maps/silphco2.blk" +SilphCo2Blocks: INCBIN "maps/silphco2.blk" INCLUDE "data/mapHeaders/silphco3.asm" INCLUDE "scripts/silphco3.asm" INCLUDE "data/mapObjects/silphco3.asm" -SilphCo3Blocks: - INCBIN "maps/silphco3.blk" +SilphCo3Blocks: INCBIN "maps/silphco3.blk" INCLUDE "data/mapHeaders/silphco10.asm" INCLUDE "scripts/silphco10.asm" INCLUDE "data/mapObjects/silphco10.asm" -SilphCo10Blocks: - INCBIN "maps/silphco10.blk" +SilphCo10Blocks: INCBIN "maps/silphco10.blk" INCLUDE "data/mapHeaders/lance.asm" INCLUDE "scripts/lance.asm" INCLUDE "data/mapObjects/lance.asm" -LanceBlocks: - INCBIN "maps/lance.blk" +LanceBlocks: INCBIN "maps/lance.blk" INCLUDE "data/mapHeaders/halloffameroom.asm" INCLUDE "scripts/halloffameroom.asm" INCLUDE "data/mapObjects/halloffameroom.asm" -HallofFameRoomBlocks: - INCBIN "maps/halloffameroom.blk" +HallofFameRoomBlocks: INCBIN "maps/halloffameroom.blk" INCLUDE "engine/overworld/saffron_guards.asm" SECTION "bank17",ROMX,BANK[$17] -SaffronMartBlocks: -LavenderMartBlocks: CeruleanMartBlocks: -VermilionMartBlocks: INCBIN "maps/vermilionmart.blk" - -CopycatsHouse2FBlocks: -RedsHouse2FBlocks: INCBIN "maps/redshouse2f.blk" - +VermilionMartBlocks: +LavenderMartBlocks: +SaffronMartBlocks: INCBIN "maps/ceruleanmart.blk" +RedsHouse2FBlocks: +CopycatsHouse2FBlocks: INCBIN "maps/redshouse2f.blk" Museum1FBlocks: INCBIN "maps/museum1f.blk" - Museum2FBlocks: INCBIN "maps/museum2f.blk" - -SaffronPokecenterBlocks: +PewterPokecenterBlocks: VermilionPokecenterBlocks: LavenderPokecenterBlocks: -PewterPokecenterBlocks: INCBIN "maps/pewterpokecenter.blk" - -UndergroundPathEntranceRoute7Blocks: -UndergroundPathEntranceRoute7CopyBlocks: +SaffronPokecenterBlocks: INCBIN "maps/pewterpokecenter.blk" +UndergroundPathEntranceRoute5Blocks: UndergroundPathEntranceRoute6Blocks: -UndergroundPathEntranceRoute5Blocks: INCBIN "maps/undergroundpathentranceroute5.blk" - -Route2GateBlocks: +UndergroundPathEntranceRoute7Blocks: +UndergroundPathEntranceRoute7CopyBlocks: INCBIN "maps/undergroundpathentranceroute5.blk" ViridianForestEntranceBlocks: -ViridianForestExitBlocks: INCBIN "maps/viridianforestexit.blk" +ViridianForestExitBlocks: +Route2GateBlocks: INCBIN "maps/viridianforestentrance.blk" INCLUDE "data/mapHeaders/redshouse2f.asm" INCLUDE "scripts/redshouse2f.asm" @@ -6333,6 +1645,8 @@ INCLUDE "scripts/victoryroad1.asm" INCLUDE "data/mapObjects/victoryroad1.asm" VictoryRoad1Blocks: INCBIN "maps/victoryroad1.blk" +INCLUDE "engine/evolution.asm" + INCLUDE "engine/predefs17_2.asm" INCLUDE "engine/hidden_object_functions17.asm" @@ -6340,14 +1654,14 @@ INCLUDE "engine/hidden_object_functions17.asm" SECTION "bank18",ROMX,BANK[$18] -ViridianForestBlocks: INCBIN "maps/viridianforest.blk" +ViridianForestBlocks: INCBIN "maps/viridianforest.blk" UndergroundPathNSBlocks: INCBIN "maps/undergroundpathns.blk" UndergroundPathWEBlocks: INCBIN "maps/undergroundpathwe.blk" - INCBIN "maps/unusedblocks60258.blk" +INCBIN "maps/unusedblocks60258.blk" -SSAnne10Blocks: -SSAnne9Blocks: INCBIN "maps/ssanne9.blk" +SSAnne9Blocks: +SSAnne10Blocks: INCBIN "maps/ssanne9.blk" INCLUDE "data/mapHeaders/pokemontower1.asm" INCLUDE "scripts/pokemontower1.asm" @@ -6379,18 +1693,13 @@ INCLUDE "scripts/pokemontower6.asm" INCLUDE "data/mapObjects/pokemontower6.asm" PokemonTower6Blocks: INCBIN "maps/pokemontower6.blk" - INCBIN "maps/unusedblocks60cef.blk" +INCBIN "maps/unusedblocks60cef.blk" INCLUDE "data/mapHeaders/pokemontower7.asm" INCLUDE "scripts/pokemontower7.asm" INCLUDE "data/mapObjects/pokemontower7.asm" PokemonTower7Blocks: INCBIN "maps/pokemontower7.blk" -INCLUDE "data/mapHeaders/celadonmart1.asm" -INCLUDE "scripts/celadonmart1.asm" -INCLUDE "data/mapObjects/celadonmart1.asm" -CeladonMart1Blocks: INCBIN "maps/celadonmart1.blk" - INCLUDE "engine/overworld/cinnabar_lab.asm" INCLUDE "data/mapHeaders/viridianforest.asm" @@ -6463,20 +1772,18 @@ INCLUDE "engine/hidden_object_functions18.asm" SECTION "bank19",ROMX,BANK[$19] -Overworld_GFX: INCBIN "gfx/tilesets/overworld.t2.2bpp" +Overworld_GFX: INCBIN "gfx/tilesets/overworld.2bpp" Overworld_Block: INCBIN "gfx/blocksets/overworld.bst" - RedsHouse1_GFX: -RedsHouse2_GFX: INCBIN "gfx/tilesets/reds_house.t7.2bpp" +RedsHouse2_GFX: INCBIN "gfx/tilesets/redshouse2.t7.2bpp" RedsHouse1_Block: -RedsHouse2_Block: INCBIN "gfx/blocksets/reds_house.bst" - +RedsHouse2_Block: INCBIN "gfx/blocksets/redshouse2.bst" House_GFX: INCBIN "gfx/tilesets/house.t2.2bpp" House_Block: INCBIN "gfx/blocksets/house.bst" Mansion_GFX: INCBIN "gfx/tilesets/mansion.t2.2bpp" Mansion_Block: INCBIN "gfx/blocksets/mansion.bst" -ShipPort_GFX: INCBIN "gfx/tilesets/ship_port.t2.2bpp" -ShipPort_Block: INCBIN "gfx/blocksets/ship_port.bst" +ShipPort_GFX: INCBIN "gfx/tilesets/shipport.t2.2bpp" +ShipPort_Block: INCBIN "gfx/blocksets/shipport.bst" Interior_GFX: INCBIN "gfx/tilesets/interior.t1.2bpp" Interior_Block: INCBIN "gfx/blocksets/interior.bst" Plateau_GFX: INCBIN "gfx/tilesets/plateau.t10.2bpp" @@ -6485,34 +1792,22 @@ Plateau_Block: INCBIN "gfx/blocksets/plateau.bst" SECTION "bank1A",ROMX,BANK[$1A] -INCLUDE "engine/battle/decrement_pp.asm" - -Version_GFX: -IF DEF(_RED) - INCBIN "gfx/red/redgreenversion.1bpp" ; 10 tiles -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/blueversion.1bpp" ; 8 tiles -ENDC -Version_GFXEnd: +INCBIN "gfx/blueversion.1bpp" ; unused Dojo_GFX: Gym_GFX: INCBIN "gfx/tilesets/gym.2bpp" Dojo_Block: Gym_Block: INCBIN "gfx/blocksets/gym.bst" - Mart_GFX: Pokecenter_GFX: INCBIN "gfx/tilesets/pokecenter.2bpp" Mart_Block: Pokecenter_Block: INCBIN "gfx/blocksets/pokecenter.bst" - ForestGate_GFX: -Museum_GFX: -Gate_GFX: INCBIN "gfx/tilesets/gate.t1.2bpp" +Gate_GFX: +Museum_GFX: INCBIN "gfx/tilesets/museum.t1.2bpp" ForestGate_Block: -Museum_Block: -Gate_Block: INCBIN "gfx/blocksets/gate.bst" - +Gate_Block: +Museum_Block: INCBIN "gfx/blocksets/museum.bst" Forest_GFX: INCBIN "gfx/tilesets/forest.2bpp" Forest_Block: INCBIN "gfx/blocksets/forest.bst" Facility_GFX: INCBIN "gfx/tilesets/facility.2bpp" @@ -6555,23 +1850,14 @@ INCLUDE "engine/save.asm" SECTION "bank1D",ROMX,BANK[$1D] CopycatsHouse1FBlocks: INCBIN "maps/copycatshouse1f.blk" - -CinnabarMartBlocks: -PewterMartBlocks: INCBIN "maps/pewtermart.blk" - +PewterMartBlocks: +CinnabarMartBlocks: INCBIN "maps/pewtermart.blk" FuchsiaHouse1Blocks: INCBIN "maps/fuchsiahouse1.blk" - -CinnabarPokecenterBlocks: -FuchsiaPokecenterBlocks: INCBIN "maps/fuchsiapokecenter.blk" - +FuchsiaPokecenterBlocks: +CinnabarPokecenterBlocks: INCBIN "maps/fuchsiapokecenter.blk" CeruleanHouse2Blocks: INCBIN "maps/ceruleanhouse2.blk" -INCLUDE "engine/HoF_room_pc.asm" - -INCLUDE "engine/status_ailments.asm" - INCLUDE "engine/items/itemfinder.asm" - INCLUDE "scripts/ceruleancity2.asm" INCLUDE "data/mapHeaders/viridiangym.asm" @@ -6608,9 +1894,9 @@ INCLUDE "data/mapObjects/fuchsiahouse2.asm" FuchsiaHouse2Blocks: INCBIN "maps/fuchsiahouse2.blk" INCLUDE "data/mapHeaders/safarizoneentrance.asm" -INCLUDE "scripts/safarizoneentrance.asm" INCLUDE "data/mapObjects/safarizoneentrance.asm" SafariZoneEntranceBlocks: INCBIN "maps/safarizoneentrance.blk" +INCLUDE "scripts/safarizoneentrance.asm" INCLUDE "data/mapHeaders/fuchsiagym.asm" INCLUDE "scripts/fuchsiagym.asm" @@ -6626,6 +1912,7 @@ INCLUDE "data/mapHeaders/cinnabargym.asm" INCLUDE "scripts/cinnabargym.asm" INCLUDE "data/mapObjects/cinnabargym.asm" CinnabarGymBlocks: INCBIN "maps/cinnabargym.blk" +INCLUDE "scripts/cinnabargym2.asm" INCLUDE "data/mapHeaders/lab1.asm" INCLUDE "scripts/lab1.asm" @@ -6681,6 +1968,8 @@ AgathaBlocks: INCBIN "maps/agatha.blk" INCLUDE "engine/menu/league_pc.asm" +INCLUDE "engine/overworld/elevator.asm" + INCLUDE "engine/overworld/hidden_items.asm" @@ -6699,8 +1988,167 @@ RedFishingRodTiles: INCBIN "gfx/red_fishingrod_tiles.2bpp" INCLUDE "data/animations.asm" -INCLUDE "engine/evolution.asm" -INCLUDE "engine/overworld/elevator.asm" +SECTION "bank2f",ROMX[$5000],BANK[$2F] + +INCLUDE "engine/bg_map_attributes.asm" + + +SECTION "bank30",ROMX,BANK[$30] + +; This whole bank is garbage data. +INCBIN "engine/bank30.bin" + + +SECTION "bank39",ROMX,BANK[$39] + +Pic_e4000: ; e4000 +INCBIN "gfx/pikachu/unknown_e4000.pic" +GFX_e40cc: ; e40cc +INCBIN "gfx/pikachu/unknown_e40cc.2bpp" +Pic_e411c: ; e411c +INCBIN "gfx/pikachu/unknown_e411c.pic" +GFX_e41d2: ; e41d2 +INCBIN "gfx/pikachu/unknown_e41d2.2bpp" +Pic_e4272: ; e4272 +INCBIN "gfx/pikachu/unknown_e4272.pic" +GFX_e4323: ; e4323 +INCBIN "gfx/pikachu/unknown_e4323.2bpp" +Pic_e4383: ; e4383 +INCBIN "gfx/pikachu/unknown_e4383.pic" +GFX_e444b: ; e444b +INCBIN "gfx/pikachu/unknown_e444b.2bpp" +Pic_e458b: ; e458b +INCBIN "gfx/pikachu/unknown_e458b.pic" +GFX_e463b: ; e463b +INCBIN "gfx/pikachu/unknown_e463b.2bpp" +Pic_e467b: ; e467b +INCBIN "gfx/pikachu/unknown_e467b.pic" +GFX_e472e: ; e472e +INCBIN "gfx/pikachu/unknown_e472e.2bpp" +Pic_e476e: ; e476e +INCBIN "gfx/pikachu/unknown_e476e.pic" +GFX_e4841: ; e4841 +INCBIN "gfx/pikachu/unknown_e4841.2bpp" +Pic_e49d1: ; e49d1 +INCBIN "gfx/pikachu/unknown_e49d1.pic" +GFX_e4a99: ; e4a99 +INCBIN "gfx/pikachu/unknown_e4a99.2bpp" +Pic_e4b39: ; e4b39 +INCBIN "gfx/pikachu/unknown_e4b39.pic" +GFX_e4bde: ; e4bde +INCBIN "gfx/pikachu/unknown_e4bde.2bpp" +Pic_e4c3e: ; e4c3e +INCBIN "gfx/pikachu/unknown_e4c3e.pic" +GFX_e4ce0: ; e4ce0 +INCBIN "gfx/pikachu/unknown_e4ce0.2bpp" +GFX_e4e70: ; e4e70 +INCBIN "gfx/pikachu/unknown_e4e70.2bpp" +Pic_e5000: ; e5000 +INCBIN "gfx/pikachu/unknown_e5000.pic" +GFX_e50af: ; e50af +INCBIN "gfx/pikachu/unknown_e50af.2bpp" +Pic_e523f: ; e523f +INCBIN "gfx/pikachu/unknown_e523f.pic" +GFX_e52fe: ; e52fe +INCBIN "gfx/pikachu/unknown_e52fe.2bpp" +Pic_e548e: ; e548e +INCBIN "gfx/pikachu/unknown_e548e.pic" +GFX_e5541: ; e5541 +INCBIN "gfx/pikachu/unknown_e5541.2bpp" +Pic_e56d1: ; e56d1 +INCBIN "gfx/pikachu/unknown_e56d1.pic" +GFX_e5794: ; e5794 +INCBIN "gfx/pikachu/unknown_e5794.2bpp" +Pic_e5924: ; e5924 +INCBIN "gfx/pikachu/unknown_e5924.pic" +GFX_e59ed: ; e59ed +INCBIN "gfx/pikachu/unknown_e59ed.2bpp" +Pic_e5b7d: ; e5b7d +INCBIN "gfx/pikachu/unknown_e5b7d.pic" +GFX_e5c4d: ; e5c4d +INCBIN "gfx/pikachu/unknown_e5c4d.2bpp" +Pic_e5ddd: ; e5ddd +INCBIN "gfx/pikachu/unknown_e5ddd.pic" +GFX_e5e90: ; e5e90 +INCBIN "gfx/pikachu/unknown_e5e90.2bpp" +GFX_e6020: ; e6020 +INCBIN "gfx/pikachu/unknown_e6020.2bpp" +GFX_e61b0: ; e61b0 +INCBIN "gfx/pikachu/unknown_e61b0.2bpp" +Pic_e6340: ; e6340 +INCBIN "gfx/pikachu/unknown_e6340.pic" +GFX_e63f7: ; e63f7 +INCBIN "gfx/pikachu/unknown_e63f7.2bpp" +Pic_e6587: ; e6587 +INCBIN "gfx/pikachu/unknown_e6587.pic" +GFX_e6646: ; e6646 +INCBIN "gfx/pikachu/unknown_e6646.2bpp" +Pic_e67d6: ; e67d6 +INCBIN "gfx/pikachu/unknown_e67d6.pic" +GFX_e682f: ; e682f +INCBIN "gfx/pikachu/unknown_e682f.2bpp" +GFX_e69bf: ; e69bf +INCBIN "gfx/pikachu/unknown_e69bf.2bpp" +GFX_e6b4f: ; e6b4f +INCBIN "gfx/pikachu/unknown_e6b4f.2bpp" +GFX_e6cdf: ; e6cdf +INCBIN "gfx/pikachu/unknown_e6cdf.2bpp" +GFX_e6e6f: ; e6e6f +INCBIN "gfx/pikachu/unknown_e6e6f.2bpp" +GFX_e6fff: ; e6fff +INCBIN "gfx/pikachu/unknown_e6fff.2bpp" +GFX_e718f: ; e718f +INCBIN "gfx/pikachu/unknown_e718f.2bpp" +GFX_e731f: ; e731f +INCBIN "gfx/pikachu/unknown_e731f.2bpp" +GFX_e74af: ; e74af +INCBIN "gfx/pikachu/unknown_e74af.2bpp" +GFX_e763f: ; e763f +INCBIN "gfx/pikachu/unknown_e763f.2bpp" +Pic_e77cf: ; e77cf +INCBIN "gfx/pikachu/unknown_e77cf.pic" +GFX_e7863: ; e7863 +INCBIN "gfx/pikachu/unknown_e7863.2bpp" +GFX_e79f3: ; e79f3 +INCBIN "gfx/pikachu/unknown_e79f3.2bpp" +GFX_e7b83: ; e7b83 +INCBIN "gfx/pikachu/unknown_e7b83.2bpp" +GFX_e7d13: ; e7d13 +INCBIN "gfx/pikachu/unknown_e7d13.2bpp" + + +SECTION "bank3A",ROMX,BANK[$3A] + +INCLUDE "text/monster_names.asm" + +INCLUDE "engine/overworld/is_player_just_outside_map.asm" + +INCLUDE "engine/printer.asm" +INCLUDE "engine/diploma_3a.asm" + +SurfingPikachu3Graphics: INCBIN "gfx/surfing_pikachu_3.t1.2bpp" +SurfingPikachu3GraphicsEnd: + +INCLUDE "engine/unknown_ea3ea.asm" + +INCLUDE "engine/overworld/npc_movement_2.asm" + +SECTION "bank3C",ROMX,BANK[$3C] + +INCLUDE "engine/bank3c.asm" + + +SECTION "bank3D",ROMX,BANK[$3D] + +INCLUDE "engine/bank3d.asm" + + +SECTION "bank3E",ROMX,BANK[$3E] + +INCLUDE "engine/bank3e.asm" + + +SECTION "bank3F",ROMX,BANK[$3F] -INCLUDE "engine/items/tm_prices.asm" +INCLUDE "engine/bank3f.asm" |