diff options
Diffstat (limited to 'engine')
52 files changed, 4724 insertions, 1043 deletions
diff --git a/engine/bank3c/main.asm b/engine/bank3c/main.asm new file mode 100644 index 00000000..3c1966ff --- /dev/null +++ b/engine/bank3c/main.asm @@ -0,0 +1,129 @@ +;INCLUDE "engine/bank3c/overworld.asm" +Func_f0000:: ; f0000 (3c:4000) + dr $f0000,$f010c +_AdvancePlayerSprite:: ; f010c (3c:410c) + dr $f010c,$f0274 + +ResetStatusAndHalveMoneyOnBlackout:: ; f0274 (3c:4274) +; Reset player status on blackout. + xor a + ld [wd435],a + xor a ; gamefreak copypasting functions (double xor a) + ld [wBattleResult], a + ld [wWalkBikeSurfState], a + ld [W_ISINBATTLE], a + ld [wMapPalOffset], a + ld [wNPCMovementScriptFunctionNum], a + ld [hJoyHeld], a + ld [wNPCMovementScriptPointerTableNum], a + ld [wFlags_0xcd60], a + + ld [$ff9f], a + ld [$ff9f + 1], a + ld [$ff9f + 2], a + call HasEnoughMoney + jr c, .lostmoney ; never happens + + ; Halve the player's money. + ld a, [wPlayerMoney] + ld [$ff9f], a + ld a, [wPlayerMoney + 1] + ld [$ff9f + 1], a + ld a, [wPlayerMoney + 2] + ld [$ff9f + 2], a + xor a + ld [$ffa2], a + ld [$ffa3], a + ld a, 2 + ld [$ffa4], a + predef DivideBCDPredef3 + ld a, [$ffa2] + ld [wPlayerMoney], a + ld a, [$ffa2 + 1] + ld [wPlayerMoney + 1], a + ld a, [$ffa2 + 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 + +Func_f02da:: ; f02da (3c:42da) + ld a,[W_CURMAP] + cp VERMILION_GYM ; ??? new thing about verm gym? + jr z,.asm_f02ee + ld c,a + ld hl,Pointer_f02fa +.asm_f02e5 + ld a,[hli] + cp c + jr z,.asm_f02f4 + cp a,$ff + jr nz,.asm_f02e5 + ret +.asm_f02ee + ld hl,wd126 + set 6,[hl] + ret +.asm_f02f4 + ld hl,wd126 + set 5,[hl] + ret + +Pointer_f02fa:: ; f02fa (3c:42fa) + db $cf,$d0,$d1,$d2,$d3,$d4 + db $d5,$e9,$ea,$eb,$d6,$d7 + db $d8,$a5,$a6,$87,$c7,$ca + db $c6,$6c,$c2,$71,$f5,$f6 + db $f7,$ff + +BeachHouse_GFX:: ; f0314 (3c:4314) + INCBIN "gfx/tilesets/beachhouse.2bpp" + +BeachHouse_Block:: ; f0914 (3c:4914) + INCBIN "gfx/blocksets/beachhouse.bst" + +Func_f0a54:: ; f0a54 (3c:4a54) + ret + +Func_f0a55:: ; f0a55 (3c:4a55) + ld hl,Pointer_f0a76 ; 3c:4a76 +.loop + ld a,[hli] + cp a,$ff + ret z + ld b,a + ld a,[W_CURMAP] + cp b + jr z,.asm_f0a68 + inc hl + inc hl + inc hl + jr .loop + +.asm_f0a68 + ld a,[hli] + ld c,a + ld b,$0 + ld a,[hli] + ld h,[hl] + ld l,a + ld de,W_MISSABLEOBJECTLIST + call CopyData + ret + +Pointer_f0a76:: ; f0a76 (3c:4a76) + db $27,$07,$7b,$4a,$ff + db $01,$ec,$02,$ed,$03,$ee,$ff + + dr $f0a82,$f220e +BeachHouse_h: ; f220e (3c:620e) +;INCLUDE "data/mapHeaders/beach_house.asm" + dr $f220e,$f25f8 +CheckForHiddenObject:: ; f25f8 (3c:65f8) + dr $f25f8,$f4000
\ No newline at end of file diff --git a/engine/bank3c/overworld.asm b/engine/bank3c/overworld.asm new file mode 100644 index 00000000..778244d6 --- /dev/null +++ b/engine/bank3c/overworld.asm @@ -0,0 +1,242 @@ +_AdvancePlayerSprite:: ; f010c (3c:410c) + ld a,[wSpriteStateData1 + 3] ; delta Y + ld b,a + ld a,[wSpriteStateData1 + 5] ; delta X + ld c,a + ld hl,wWalkCounter ; walking animation counter + dec [hl] + jr nz,.afterUpdateMapCoords +; if it's the end of the animation, update the player's map coordinates + ld a,[W_YCOORD] + add b + ld [W_YCOORD],a + ld a,[W_XCOORD] + add c + ld [W_XCOORD],a +.afterUpdateMapCoords + ld a,[wWalkCounter] ; walking animation counter + cp a,$07 + jp nz,.scrollBackgroundAndSprites +; if this is the first iteration of the animation + ld a,c + cp a,$01 + jr nz,.checkIfMovingWest +; moving east + ld a,[wMapViewVRAMPointer] + ld e,a + and a,$e0 + ld d,a + ld a,e + add a,$02 + and a,$1f + or d + ld [wMapViewVRAMPointer],a + jr .adjustXCoordWithinBlock +.checkIfMovingWest + cp a,$ff + jr nz,.checkIfMovingSouth +; moving west + ld a,[wMapViewVRAMPointer] + ld e,a + and a,$e0 + ld d,a + ld a,e + sub a,$02 + and a,$1f + or d + ld [wMapViewVRAMPointer],a + jr .adjustXCoordWithinBlock +.checkIfMovingSouth + ld a,b + cp a,$01 + jr nz,.checkIfMovingNorth +; moving south + ld a,[wMapViewVRAMPointer] + add a,$40 + ld [wMapViewVRAMPointer],a + jr nc,.adjustXCoordWithinBlock + ld a,[wMapViewVRAMPointer + 1] + inc a + and a,$03 + or a,$98 + ld [wMapViewVRAMPointer + 1],a + jr .adjustXCoordWithinBlock +.checkIfMovingNorth + cp a,$ff + jr nz,.adjustXCoordWithinBlock +; moving north + ld a,[wMapViewVRAMPointer] + sub a,$40 + ld [wMapViewVRAMPointer],a + jr nc,.adjustXCoordWithinBlock + ld a,[wMapViewVRAMPointer + 1] + dec a + and a,$03 + or a,$98 + ld [wMapViewVRAMPointer + 1],a +.adjustXCoordWithinBlock + ld a,c + and a + jr z,.pointlessJump ; mistake? +.pointlessJump + ld hl,W_XBLOCKCOORD + ld a,[hl] + add c + ld [hl],a + cp a,$02 + jr nz,.checkForMoveToWestBlock +; moved into the tile block to the east + xor a + ld [hl],a + ld hl,wXOffsetSinceLastSpecialWarp + inc [hl] + ld de,wCurrentTileBlockMapViewPointer + call MoveTileBlockMapPointerEast + jr .updateMapView +.checkForMoveToWestBlock + cp a,$ff + jr nz,.adjustYCoordWithinBlock +; moved into the tile block to the west + ld a,$01 + ld [hl],a + ld hl,wXOffsetSinceLastSpecialWarp + dec [hl] + ld de,wCurrentTileBlockMapViewPointer + call MoveTileBlockMapPointerWest + jr .updateMapView +.adjustYCoordWithinBlock + ld hl,W_YBLOCKCOORD + ld a,[hl] + add b + ld [hl],a + cp a,$02 + jr nz,.checkForMoveToNorthBlock +; moved into the tile block to the south + xor a + ld [hl],a + ld hl,wYOffsetSinceLastSpecialWarp + inc [hl] + ld de,wCurrentTileBlockMapViewPointer + ld a,[W_CURMAPWIDTH] + call MoveTileBlockMapPointerSouth + jr .updateMapView +.checkForMoveToNorthBlock + cp a,$ff + jr nz,.updateMapView +; moved into the tile block to the north + ld a,$01 + ld [hl],a + ld hl,wYOffsetSinceLastSpecialWarp + dec [hl] + ld de,wCurrentTileBlockMapViewPointer + ld a,[W_CURMAPWIDTH] + call MoveTileBlockMapPointerNorth +.updateMapView + call LoadCurrentMapView + ld a,[wSpriteStateData1 + 3] ; delta Y + cp a,$01 + jr nz,.checkIfMovingNorth2 +; if moving south + call ScheduleSouthRowRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingNorth2 + cp a,$ff + jr nz,.checkIfMovingEast2 +; if moving north + call ScheduleNorthRowRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingEast2 + ld a,[wSpriteStateData1 + 5] ; delta X + cp a,$01 + jr nz,.checkIfMovingWest2 +; if moving east + call ScheduleEastColumnRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingWest2 + cp a,$ff + jr nz,.scrollBackgroundAndSprites +; if moving west + call ScheduleWestColumnRedraw +.scrollBackgroundAndSprites + ld a,[wSpriteStateData1 + 3] ; delta Y + ld b,a + ld a,[wSpriteStateData1 + 5] ; delta X + ld c,a + sla b + sla c + ld a,[hSCY] + add b + ld [hSCY],a ; update background scroll Y + ld a,[hSCX] + add c + ld [hSCX],a ; update background scroll X +; shift all the sprites in the direction opposite of the player's motion +; so that the player appears to move relative to them + ld hl,wSpriteStateData1 + $14 + ld a,[W_NUMSPRITES] ; number of sprites + and a ; are there any sprites? + jr z,.done + ld e,a +.spriteShiftLoop + ld a,[hl] + sub b + ld [hli],a + inc l + ld a,[hl] + sub c + ld [hl],a + ld a,$0e + add l + ld l,a + dec e + jr nz,.spriteShiftLoop +.done + ret + +MoveTileBlockMapPointerEast:: ; 0e65 (0:0e65) + ld a,[de] + add a,$01 + ld [de],a + ret nc + inc de + ld a,[de] + inc a + ld [de],a + ret + +MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f) + ld a,[de] + sub a,$01 + ld [de],a + ret nc + inc de + ld a,[de] + dec a + ld [de],a + ret + +MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79) + add a,$06 + ld b,a + ld a,[de] + add b + ld [de],a + ret nc + inc de + ld a,[de] + inc a + ld [de],a + ret + +MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85) + add a,$06 + ld b,a + ld a,[de] + sub b + ld [de],a + ret nc + inc de + ld a,[de] + dec a + ld [de],a + ret
\ No newline at end of file diff --git a/engine/bank3d/bank3d_battle.asm b/engine/bank3d/bank3d_battle.asm new file mode 100644 index 00000000..ac4cd849 --- /dev/null +++ b/engine/bank3d/bank3d_battle.asm @@ -0,0 +1,292 @@ +InitBattle: ; f5ff2 (3d:5ff2) + ld a, [W_CUROPPONENT] + and a + jr z, asm_f6003 + +InitOpponent: ; f5ff8 (3d:5ff8) + ld a, [W_CUROPPONENT] + ld [wcf91], a + ld [wEnemyMonSpecies2], a + jr asm_f601d +asm_f6003: ; f6003 (3d:6003) + ld a, [wd732] + bit 1, a + jr z, .asm_f600f + ld a, [hJoyHeld] + bit 1, a ; B button pressed? + ret nz +.asm_f600f + ld a, [wNumberOfNoRandomBattleStepsLeft] + and a + ret nz + callab TryDoWildEncounter + ret nz +asm_f601d: ; f601d (f:601d) + ld a, [wMapPalOffset] + push af + ld hl, wd358 + ld a, [hl] + push af + res 1, [hl] + call InitBattleVariables ; 3d:6236 + ld a, [wEnemyMonSpecies2] + sub $c8 + jp c, InitWildBattle + ld [W_TRAINERCLASS], a + call GetTrainerInformation + callab ReadTrainer + callab DoBattleTransitionAndInitBattleVariables + call _LoadTrainerPic ; 3d:615a + xor a + ld [wEnemyMonSpecies2], a + ld [$ffe1], a + dec a + ld [wAICount], a + hlCoord 12, 0 + predef Func_3f0c6 + ld a, $ff + ld [wEnemyMonPartyPos], a + ld a, $2 + ld [W_ISINBATTLE], a + ld a,[W_LONEATTACKNO] + and a + jp z,InitBattle_Common + ld hl,Func_f430a + ld b,BANK(Func_f430a) + ld d,$4 + call Bankswitch ; useless since already in bank3d + jp InitBattle_Common + +InitWildBattle: ; f607c (3d:607c) + ld a, $1 + ld [W_ISINBATTLE], a + callab LoadEnemyMonData + callab DoBattleTransitionAndInitBattleVariables + ld a, [W_CUROPPONENT] + cp MAROWAK + jr z, .isGhost + callab IsGhostBattle + jr nz, .isNoGhost +.isGhost + ld hl, W_MONHSPRITEDIM + ld a, $66 + ld [hli], a ; write sprite dimensions + ld bc, GhostPic + ld a, c + ld [hli], a ; write front sprite pointer + ld [hl], b + ld hl, wEnemyMonNick ; set name to "GHOST" + ld a, "G" + ld [hli], a + ld a, "H" + ld [hli], a + ld a, "O" + ld [hli], a + ld a, "S" + ld [hli], a + ld a, "T" + ld [hli], a + ld [hl], "@" + ld a, [wcf91] + push af + ld a, MON_GHOST + ld [wcf91], a + ld de, vFrontPic + call LoadMonFrontSprite ; load ghost sprite + pop af + ld [wcf91], a + jr .spriteLoaded +.isNoGhost + ld de, vFrontPic + call LoadMonFrontSprite ; load mon sprite +.spriteLoaded + xor a + ld [W_TRAINERCLASS], a + ld [$ffe1], a + hlCoord 12, 0 + predef Func_3f0c6 + +; common code that executes after init battle code specific to trainer or wild battles +InitBattle_Common: ; f60eb (3d:60eb) + ld b, $0 + call GoPAL_SET + callab SlidePlayerAndEnemySilhouettesOnScreen + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld hl, .emptyString + call PrintText + call SaveScreenTilesToBuffer1 + call ClearScreen + ld a, $98 + ld [$ffbd], a + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + ld a, $9c + ld [$ffbd], a + call LoadScreenTilesFromBuffer1 + hlCoord 9, 7 + ld bc, $50a + call ClearScreenArea + hlCoord 1, 0 + ld bc, $40a + call ClearScreenArea + call ClearSprites + ld a, [W_ISINBATTLE] + dec a ; is it a wild battle? + ld hl, DrawEnemyHUDAndHPBar + ld b,BANK(DrawEnemyHUDAndHPBar) + call z, Bankswitch ; draw enemy HUD and HP bar if it's a wild battle + callab StartBattle + callab EndOfBattle + pop af + ld [wd358], a + pop af + ld [wMapPalOffset], a + ld a, [wd0d4] + ld [hTilesetType], a + scf + ret +.emptyString + db "@" + +_LoadTrainerPic: ; f615a (3d:615a) +; wd033-wd034 contain pointer to pic + ld a, [wTrainerPicPointer] ; wd033 + ld e, a + ld a, [wTrainerPicPointer + 1] ; wd034 + ld d, a ; de contains pointer to trainer pic + ld a, [wLinkState] + and a + ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) + jr z, .loadSprite + ld a, Bank(RedPicFront) +.loadSprite + call UncompressSpriteFromDE + ld de, vFrontPic + ld a, $77 + ld c, a + jp LoadUncompressedSpriteData + +LoadMonBackPic: ; f6178 (3d:6178) +; Assumes the monster's attributes have +; been loaded with GetMonHeader. + ld a, [wBattleMonSpecies2] + ld [wcf91], a + hlCoord 1, 5 + ld bc,$708 + call ClearScreenArea + ld hl, W_MONHBACKSPRITE - W_MONHEADER + call UncompressMonSprite + predef ScaleSpriteByTwo + ld de, vBackPic + call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite + ld hl, vSprites + ld de, vBackPic + ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied + ld a, [H_LOADEDROMBANK] + ld b, a + jp CopyVideoData + +Func_f61a6: ; f61a6 (3d:f61a6) + ld a, [wPredefRegisters] + ld h, a + ld a, [wPredefRegisters + 1] + ld l, a + ld a, [$ffe1] + ld [H_DOWNARROWBLINKCNT1], a + ld b, $4c + ld a, [W_ISINBATTLE] + and a + jr z, .asm_f61ef + add b + ld [hl], a + call Delay3 + ld bc, -41 + add hl, bc + ld a, $1 + ld [wcd6c], a + ld bc, $303 + predef Func_79aba + ld c, $4 + call DelayFrames + ld bc, -41 + add hl, bc + xor a + ld [wcd6c], a + ld bc, $505 + predef Func_79aba + ld c, $5 + call DelayFrames + ld bc, -41 + jr .asm_f61f2 +.asm_f61ef + ld bc, -123 +.asm_f61f2 + add hl, bc + ld a, [H_DOWNARROWBLINKCNT1] + add $31 + jr CopyUncompressedPicToHL + +Func_f61f9: ; f61f9 (3d:61f9) + ld a, [wPredefRegisters] + ld h, a + ld a, [wPredefRegisters + 1] + ld l, a + ld a, [$ffe1] +CopyUncompressedPicToHL: ; f6203 (3d:6203) + ld bc, $707 + ld de, $14 + push af + ld a, [W_SPRITEFLIPPED] + and a + jr nz, .asm_f6220 + pop af +.asm_f6211 + push bc + push hl +.asm_f6213 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .asm_f6213 + pop hl + inc hl + pop bc + dec b + jr nz, .asm_f6211 + ret + +.asm_f6220 + push bc + ld b, $0 + dec c + add hl, bc + pop bc + pop af +.asm_f6227 + push bc + push hl +.asm_f6229 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .asm_f6229 + pop hl + dec hl + pop bc + dec b + jr nz, .asm_f6227 + ret + +INCLUDE "engine/battle/init_battle_variables.asm" +INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm" +INCLUDE "engine/battle/moveEffects/heal_effect.asm" +INCLUDE "engine/battle/moveEffects/transform_effect.asm" +INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm" +INCLUDE "engine/battle/moveEffects/mist_effect.asm" +INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm" +INCLUDE "engine/battle/moveEffects/pay_day_effect.asm" +INCLUDE "engine/battle/moveEffects/paralyze_effect.asm"
\ No newline at end of file diff --git a/engine/bank3d/link_menu.asm b/engine/bank3d/link_menu.asm new file mode 100644 index 00000000..a460eb00 --- /dev/null +++ b/engine/bank3d/link_menu.asm @@ -0,0 +1,912 @@ +Func_f531b:: ; f531b (3d:531b) + ld c,$14 + call DelayFrames + ld a,$1 + ld [wBuffer],a + xor a + ld [wUnknownSerialFlag_d499],a + hlCoord 0,0 + ld bc,$405 + call TextBoxBorder + ld de,Text_f5791 + hlCoord 1,2 + call PlaceString + hlCoord 8,0 + ld bc,$80a + call TextBoxBorder + hlCoord 10,2 + ld de,Text_f579c + call PlaceString + hlCoord 0,10 + ld bc,$612 + call TextBoxBorder + call UpdateSprites + xor a + ld [wcd37],a + ld [wd72d],a + ld [wd11e],a + ld hl,wTopMenuItemY + ld a,$2 + ld [hli],a + ld a,$9 + ld [hli],a + xor a + ld [hli],a + inc hl + ld a,$3 + ld [hli],a + ld a,$3 + ld [hli],a + xor a + ld [hl],a +.asm_f5377 + call Func_f56bd + call HandleMenuInput + and $3 + add a + add a + ld b,a + ld a,[wCurrentMenuItem] + cp $3 + jr nz,.asm_f5390 + bit 2,b + jr z,.asm_f5390 + dec a + ld b,$8 +.asm_f5390 + add b + add $c0 + ld [wLinkMenuSelectionSendBuffer],a + ld [wLinkMenuSelectionSendBuffer+1],a +.asm_f5399 + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + push af + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + pop bc + cp b + jr nz,.asm_f5399 + and $f0 + cp $c0 + jr nz,.asm_f5399 + ld a,b + and $c + jr nz,.asm_f53c4 + ld a,[wLinkMenuSelectionSendBuffer] + and $c + jr z,.asm_f5377 + jr .asm_f53df +.asm_f53c4 + ld a,[wLinkMenuSelectionSendBuffer] + and $c + jr z,.asm_f53d1 + ld a,[hSerialConnectionStatus] + cp $2 + jr z,.asm_f53df +.asm_f53d1 + ld a,$1 + ld [wd11e],a + ld a,b + ld [wLinkMenuSelectionSendBuffer],a + and $3 + ld [wCurrentMenuItem],a +.asm_f53df + call DelayFrame + call DelayFrame + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + call Serial_ExchangeByte + ld b,$14 +.loop + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz,.loop + ld b,$7f + ld c,$7f + ld d,$7f + ld e,$ec + ld a,[wLinkMenuSelectionSendBuffer] + bit 3,a + jr nz,.asm_f541a + ld b,e + ld e,c + ld a,[wCurrentMenuItem] + and a + jr z,.asm_f541a + ld c,b + ld b,d + dec a + jr z,.asm_f541a + ld d,c + ld c,b +.asm_f541a + ld a,b + Coorda 9,2 + ld a,c + Coorda 9,4 + ld a,d + Coorda 9,6 + ld a,e + Coorda 9,8 + ld c,40 + call DelayFrames + ld a,[wLinkMenuSelectionSendBuffer] + bit 3,a + jr nz,asm_f547f + ld a,[wCurrentMenuItem] + cp $3 + jr z,asm_f547f + inc a + ld [wUnknownSerialFlag_d499],a + ld a,[wCurrentMenuItem] + ld hl,PointerTable_f5488 + ld c,a + ld b,$0 + add hl,bc + add hl,bc + ld a,[hli] + ld h,[hl] + ld l,a + ld de,.returnaddress + push de + jp hl +.returnaddress + ld [wLinkMenuSelectionSendBuffer],a + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + call Serial_SyncAndExchangeNybble + ld a,[wLinkMenuSelectionSendBuffer] + and a + jr nz,asm_f547c + ld a, [wLinkMenuSelectionReceiveBuffer] + and a + jr nz, Func_f5476 + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + and a + ret + +Func_f5476:: ; f5476 (3d:5476) + ld hl,ColosseumIneligibleText + call PrintText +asm_f547c:: ; f547c (3d:574c) + jp Func_f531b + +asm_f547f:: ; f547f (3d:547f) + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + scf + ret + +PointerTable_f5488:: ; f5488 (3d:5488) + dw PokeCup + dw PikaCup + dw PetitCup + +PokeCup:: ; f548e (3d:548e) + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + ld a,[wPartyMon1Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + ld b,a + ld a,[wPartyMon2Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + ld c,a + ld a,[wPartyMon3Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + add b + add c + cp 156 + jp nc,CombinedLevelsGreaterThan155 + xor a + ret + +PikaCup:: ; f54e4 (3d:54e4) + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] ; wPartySpecies + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + ld a,[wPartyMon1Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + ld b,a + ld a,[wPartyMon2Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + ld c,a + ld a,[wPartyMon3Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + add b + add c + cp 51 + jp nc,CombinedLevelsAbove50 + xor a + ret + +PetitCup:: ; f553a (3d:553a) + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + dec hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + inc hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + inc hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + dec hl + dec hl + ld b,$3 +.bigloop + ld a,[hli] + push hl + push bc + push af + dec a + ld c,a + ld b,$0 + ld hl,Pointer_4050b + add hl,bc + add hl,bc + ld de,wcd6d + ld bc,$2 + ld a,BANK(Pointer_4050b) + call FarCopyData + ld hl,wcd6d + ld a,[hli] + ld h,[hl] + ld l,a + ld de,wcd6d + ld bc,$14 + ld a,BANK(Pointer_4050b) + call FarCopyData + ld hl,wcd6d +.loop2 + ld a,[hli] + cp "@" + jr nz,.loop2 + ld a,[hli] + cp $7 + jp nc,asm_f5689 + add a + add a + ld b,a + add a + add b + ld b,a + ld a,[hli] + add b + cp $51 + jp nc,asm_f5689 + ld a,[hli] + sub $b9 + ld a,[hl] + sbc $1 + jp nc,asm_f569b + pop af + pop bc + pop hl + dec b + jr nz,.bigloop + ld a,[wPartyMon1Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + ld b,a + ld a,[wPartyMon2Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + ld c,a + ld a,[wPartyMon3Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + add b + add c + cp 81 + jp nc,CombinedLevelsAbove80 + xor a + ret + +NotThreeMonsInParty:: ; f561d (3d:516d) + ld hl,Colosseum3MonsText + call PrintText + ld a,$1 + ret + +MewInParty:: ; f5626 (3d:f5626) + ld hl,ColosseumMewText + call PrintText + ld a,$2 + ret + +DuplicateSpecies:: ; f562f (3d:f562f) + ld hl,ColosseumDifferentMonsText + call PrintText + ld a,$3 + ret + +LevelAbove55:: ; f5638 (3d:5638) + ld hl,ColosseumMaxL55Text + call PrintText + ld a,$4 + ret + +LevelUnder50:: ; f5641 (3d:5641) + ld hl,ColosseumMinL50Text + call PrintText + ld a,$5 + ret + +CombinedLevelsGreaterThan155:: ; f5641 (3d:564a) + ld hl,ColosseumTotalL155Text + call PrintText + ld a,$6 + ret + +LevelAbove30:: ; f5653 (3d:5653) + ld hl,ColosseumMaxL30Text + call PrintText + ld a,$7 + ret + +LevelUnder25:: ; f565c (3d:565c) + ld hl,ColosseumMinL25Text + call PrintText + ld a,$8 + ret + +CombinedLevelsAbove80:: ; f5665 (3d:5665) + ld hl,ColosseumTotalL80Text + call PrintText + ld a,$9 + ret + +LevelAbove20:: ; f566e (3d:566e) + ld hl,ColosseumMaxL20Text + call PrintText + ld a,$a + ret + +LevelUnder15:: ; f5677 (3d:5677) + ld hl,ColosseumMinL15Text + call PrintText + ld a,$b + ret + +CombinedLevelsAbove50:: ; f5680 (3d:5680) + ld hl,ColosseumTotalL50Text + call PrintText + ld a,$c + ret + +asm_f5689:: ; f5689 (3d:5689) + pop af + pop bc + pop hl + ld [wd11e],a + call GetMonName + ld hl,ColosseumHeightText + call PrintText + ld a,$d + ret + +asm_f569b:: ; f569b (3d:569b) + pop af + pop bc + pop hl + ld [wd11e],a + call GetMonName + ld hl,ColosseumWeightText + call PrintText + ld a,$e + ret + +asm_f56ad:: ; f56ad (3d:56ad) + ld a,[hl] + ld [wd11e],a + call GetMonName + ld hl,ColosseumEvolvedText + call PrintText + ld a,$f + ret + +Func_f56bd:: ; f56bd (3d:56bd) + xor a + ld [H_AUTOBGTRANSFERENABLED],a + hlCoord 1,11 + ld bc,$612 + call ClearScreenArea + ld a,[wCurrentMenuItem] + cp $3 + jr nc,.asm_f56e6 + ld hl,PointerTable_f56ee + ld a,[wCurrentMenuItem] + ld c,a + ld b,$0 + add hl,bc + add hl,bc + ld a,[hli] + ld h,[hl] + ld l,a + ld d,h + ld e,l + hlCoord 1,12 + call PlaceString +.asm_f56e6 + call Delay3 + ld a,$1 + ld [H_AUTOBGTRANSFERENABLED],a + ret + +PointerTable_f56ee:: ; f56ee (3d:56ee) + dw Text_f56f4 + dw Text_f5728 + dw Text_f575b + +Text_f56f4:: ; f56f4 (3d:56f4) + db "LVs of 3<pkmn>:50-55" + next "Sum of LVs:155 MAX" + next "MEW can't attend.@" + +Text_f5728:: ; f5728 (3d:5728) + db "LVs of 3<pkmn>:15-20" + next "Sum of LVs:50 MAX" + next "MEW can't attend.@" + +Text_f575b:: ; f575b (3d:575b) + db "3 Basic <pkmn>.LV25-30" + next "Sum of LVs:80 MAX" + next "6′8″ and 44lb MAX@" + +Text_f5791:: ; f5791 (3d:5791) + db "View" + next "Rules@" + +Text_f579c:: ; f579c (3d:579c) + db "# Cup" + next "Pika Cup" + next "Petit Cup" + next "CANCEL@" + +Colosseum3MonsText:: ; f57bc (3d:57bc) + TX_FAR _Colosseum3MonsText ; a0a2b + db "@" + +ColosseumMewText:: ; f57c1 (3d:57c1) + TX_FAR _ColosseumMewText ; a0a46 + db "@" + +ColosseumDifferentMonsText:: ; f57c6 (3d:57c6) + TX_FAR _ColosseumDifferentMonsText ; a0a5f + db "@" + +ColosseumMaxL55Text:: ; f57cb (3d:57cb) + TX_FAR _ColosseumMaxL55Text ; a0a81 + db "@" + +ColosseumMinL50Text:: ; f57d0 (3d:57d0) + TX_FAR _ColosseumMinL50Text ; a0a9a + db "@" + +ColosseumTotalL155Text:: ; f57d5 (3d:57d5) + TX_FAR _ColosseumTotalL155Text ; a0aba + db "@" + +ColosseumMaxL30Text:: ; f57da (3d:57da) + TX_FAR _ColosseumMaxL30Text ; a0ad9 + db "@" + +ColosseumMinL25Text:: ; f57df (3d:57df) + TX_FAR _ColosseumMinL25Text ; a0af2 + db "@" + +ColosseumTotalL80Text:: ; f57e4 (3d:57e4) + TX_FAR _ColosseumTotalL80Text ; a0b12 + db "@" + +ColosseumMaxL20Text:: ; f57e9 (3d:57e9) + TX_FAR _ColosseumMaxL20Text ; a0b30 + db "@" + +ColosseumMinL15Text:: ; f57ee (3d:57ee) + TX_FAR _ColosseumMinL15Text ; a0b49 + db "@" + +ColosseumTotalL50Text:: ; f57f3 (3d:57f3) + TX_FAR _ColosseumTotalL50Text ; a0b69 + db "@" + +ColosseumHeightText:: ; f57f8 (3d:57f8) + TX_FAR _ColosseumHeightText ; a0b87 + db "@" + +ColosseumWeightText:: ; f57fd (3d:57fd) + TX_FAR _ColosseumWeightText ; a0b9f + db "@" + +ColosseumEvolvedText:: ; f5802 (3d:5802) + TX_FAR _ColosseumEvolvedText ; a0bbb + db "@" + +ColosseumIneligibleText:: ; f5807 (3d:5807) + TX_FAR _ColosseumIneligibleText ; a0bd4 + db "@" + +LinkMenu: ; f580c (3d:580c) + xor a + ld [wd358], a + ld hl, wd72e + set 6, [hl] + ld hl, TextTerminator_f5a16 + call PrintText + call SaveScreenTilesToBuffer1 + ld hl, ColosseumWhereToText + call PrintText + hlCoord 5, 3 + ld bc, $80d + call TextBoxBorder + call UpdateSprites + hlCoord 7, 5 + ld de, TradeCenterText + call PlaceString + xor a + ld [wcd37], a + ld [wd72d], a + ld [wd11e], a + ld hl, wTopMenuItemY + ld a, $5 + ld [hli], a + ld a, $6 + ld [hli], a + xor a + ld [hli], a + inc hl + ld a, $3 + ld [hli], a + ld [hli], a + xor a + ld [hl], a +.waitForInputLoop + call HandleMenuInput + and A_BUTTON | B_BUTTON + add a + add a + ld b, a + ld a, [wCurrentMenuItem] + cp $3 + jr nz,.asm_f586b + bit 2,b + jr z,.asm_f586b + dec a + ld b,$8 +.asm_f586b + add b + add $d0 + ld [wLinkMenuSelectionSendBuffer], a + ld [wLinkMenuSelectionSendBuffer + 1], a +.exchangeMenuSelectionLoop + call Serial_ExchangeLinkMenuSelection + ld a, [wLinkMenuSelectionReceiveBuffer] + ld b, a + and $f0 + cp $d0 + jr z, .asm_5c7d + ld a, [wLinkMenuSelectionReceiveBuffer + 1] + ld b, a + and $f0 + cp $d0 + jr nz, .exchangeMenuSelectionLoop +.asm_5c7d + ld a, b + and $c ; did the enemy press A or B? + jr nz, .enemyPressedAOrB +; the enemy didn't press A or B + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again + jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection +.enemyPressedAOrB + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection +; the enemy and the player both pressed A or B +; The gameboy that is clocking the connection wins. + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr z, .doneChoosingMenuSelection +.useEnemyMenuSelection + ld a, $1 + ld [wd11e], a + ld a, b + ld [wLinkMenuSelectionSendBuffer], a + and $3 + ld [wCurrentMenuItem], a ; wCurrentMenuItem +.doneChoosingMenuSelection + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr nz, .skipStartingTransfer + call DelayFrame + call DelayFrame + ld a, START_TRANSFER_INTERNAL_CLOCK + ld [rSC], a +.skipStartingTransfer + ld b, $7f + ld c, $7f + ld d, $7f + ld e, $ec + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .updateCursorPosition +; A button was pressed + ld a, [wCurrentMenuItem] + cp $2 + jp z, .asm_f5963 + ld b, e + ld e, c + ld a, [wCurrentMenuItem] + and a + jr z, .updateCursorPosition + ld c, b + ld b, d + dec a + jr z, .updateCursorPosition + ld d, c + ld c, b +.updateCursorPosition + call Func_f59ec + call LoadScreenTilesFromBuffer1 + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .choseCancel ; cancel if B pressed + ld a, [wCurrentMenuItem] + cp $2 + jr z, .choseCancel + xor a + ld [wWalkBikeSurfState], a ; start walking + ld a, [wCurrentMenuItem] + and a + ld a, TRADE_CENTER + jr nz, .next + ld a, BATTLE_CENTER +.next + ld [wd72d], a + ld hl, ColosseumPleaseWaitText + call PrintText + ld c, $32 + call DelayFrames + ld hl, wd732 + res 1, [hl] + ld a, [W_ANIMATIONID] + ld [wDestinationMap], a + callab SpecialWarpIn + ld c, $14 + call DelayFrames + xor a + ld [wMenuJoypadPollCount], a + ld [wSerialExchangeNybbleSendData], a + inc a ; LINK_STATE_IN_CABLE_CLUB + ld [wLinkState], a + ld [wcc47], a + ld hl,Func_5ce4 + ld b,BANK(Func_5ce4) + jp Bankswitch +.choseCancel + xor a + ld [wMenuJoypadPollCount], a + call Delay3 + callab CloseLinkConnection + ld hl, ColosseumCanceledText + call PrintText + ld hl, wd72e + res 6, [hl] + ret + +.asm_f5963 + ld a,[wd11e] + and a + jr nz,.asm_f5974 + ld b,$7f + ld c,$7f + ld d,$ec + ld e,$7f + call Func_f59ec +.asm_f5974 + xor a + ld [wBuffer], a + ld a,$ff + ld [wSerialExchangeNybbleReceiveData],a + ld a, $b + ld [wLinkMenuSelectionSendBuffer], a + ld b,$78 +.loop + ld a,[hSerialConnectionStatus] + cp $2 + call z,DelayFrame + dec b + jr z,.asm_f59b2 + call Serial_ExchangeNybble + call DelayFrame + ld a,[wSerialExchangeNybbleReceiveData] + inc a + jr z,.loop + ld b,$f +.loop2 + call DelayFrame + call Serial_ExchangeNybble + dec b + jr nz,.loop2 + ld b,$f +.loop3 + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz,.loop3 + jr .asm_f59d6 + +.asm_f59b2 + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + ld a,[wd11e] + and a + jr z,.asm_f59cd + ld b,$7f + ld c,$7f + ld d,$7f + ld e,$ec + call Func_f59ec + jp .choseCancel + +.asm_f59cd + ld hl,ColosseumVersionText + call PrintText + jp .choseCancel + +.asm_f59d6 + ld b,$7f + ld c,$7f + ld d,$ec + ld e,$7f + call Func_f59ec + call Func_f531b + jp c,.choseCancel + ld a,$f0 + jp .next + +Func_f59ec:: ; f59ec (3d:59ec) + ld a, b + Coorda 6, 5 + ld a, c + Coorda 6, 7 + ld a, d + Coorda 6, 9 + ld a, e + Coorda 6, 11 + ld c, 40 + call DelayFrames + ret + +ColosseumWhereToText: ; f5a02 (3d:5a02) + TX_FAR _ColosseumWhereToText + db "@" + +ColosseumPleaseWaitText: ; f5a07 (3d:5a07) + TX_FAR _ColosseumPleaseWaitText + db "@" + +ColosseumCanceledText: ; f5a0c (3d:5a0c) + TX_FAR _ColosseumCanceledText + db "@" + +ColosseumVersionText: ; f5a11 (3d:5a11) + TX_FAR _ColosseumVersionText ; 28:4c47 + db "@" + +TextTerminator_f5a16: ; f5a16 (3d:5a16) + db "@" + +TradeCenterText: ; f5a17 (3d:5a17) + db "TRADE CENTER" + next "COLOSSEUM" + next "COLOSSEUM2" + next "CANCEL@"
\ No newline at end of file diff --git a/engine/bank3d/main.asm b/engine/bank3d/main.asm new file mode 100644 index 00000000..7b3326c9 --- /dev/null +++ b/engine/bank3d/main.asm @@ -0,0 +1,660 @@ +INCLUDE "engine/battle/common_text.asm" +INCLUDE "engine/battle/link_battle_versus_text.asm" +INCLUDE "engine/battle/unused_stats_functions.asm" +INCLUDE "engine/battle/scroll_draw_trainer_pic.asm" + +Func_f429f:: ; f429f (3d:429f) + hlCoord 0,5 + ld c,$0 +.asm_f42a4 + inc c + ld a,c + cp $9 + ret z + ld d,$5b + push bc + push hl +.asm_f42ad + call Func_f42c2 + dec hl + ld a,d + sub $7 + ld d,a + dec c + jr nz,.asm_f42ad + ld c,$2 + call DelayFrames + pop hl + pop bc + inc hl + jr .asm_f42a4 + +Func_f42c2:: ; f42c2 (3d:f42c2) + push hl + push de + push bc + ld e,$7 +.loop + ld a,d + cp $31 + jr nc,.asm_f42ce + ld a,$7f +.asm_f42ce + ld [hl],a + ld bc,$14 + add hl,bc + inc d + dec e + jr nz,.loop + pop bc + pop de + pop hl + ret + +INCLUDE "engine/battle/decrement_pp.asm" + +Func_f430a:: ; f430a (3d:430a) + ld a,d + cp $4 + jr z,.asm_f4320 + cp $6 + jr z,.asm_f4320 + push de + callab Func_fce18 + pop de + ret nc + jr .asm_f432b +.asm_f4320 + push de + callab Func_fcdb8 + pop de + ret nc +.asm_f432b + push de + ld e,$0 + ld a,[wd470] + cp $64 + jr c,.asm_f433b + inc e + cp $c8 + jr c,.asm_f433b + inc e +.asm_f433b + ld c,d + dec c + ld b,$0 + ld hl,Pointer_f4385 + add hl,bc + add hl,bc + add hl,bc + ld d,$0 + add hl,de + ld a,[hl] + cp $64 + ld a,[wd470] + jr nc,.asm_f4357 + add [hl] + jr nc,.asm_f435b + ld a,$ff + jr .asm_f435b +.asm_f4357 + add [hl] + jr c,.asm_f435b + xor a +.asm_f435b + ld [wd470],a + pop de + dec d + ld hl,Pointer_f43a6 + ld e,d + ld d,$0 + add hl,de + ld a,[hl] + ld b,a + cp $80 + jr z,.asm_f4384 + ld a,[wd471] + jr c,.asm_f437d + cp b + jr nc,.asm_f4384 + ld a,[wd49c] + and a + jr nz,.asm_f4384 + jr .asm_f4380 +.asm_f437d + cp b + jr c,.asm_f4384 +.asm_f4380 + ld a,b + ld [wd471],a +.asm_f4384 + ret + +Pointer_f4385:: ; f4385 (3d:4385) + db $05,$03,$02,$05,$03,$02,$01,$01,$00,$03,$02,$01,$01,$01,$00,$02,$01,$01 + db $fd,$fd,$fb,$ff,$ff,$ff,$fb,$fb,$f6,$fb,$fb,$f6,$f6,$f6,$ec + +Pointer_f43a6:: ; f43a6 (3d:43a6) + db $8a,$83,$80,$80,$94,$80,$62,$6c,$62,$6c + db $00 + +; f43b1 (3d:43b1) +RedPicBack:: INCBIN "pic/trainer/redb.pic" +OldManPic:: INCBIN "pic/trainer/oldman.pic" +OakPicBack:: INCBIN "pic/ytrainer/prof.oakb.pic" + +;SECTION "bank3d Yellow Intro",ROMX[$453f],BANK[$3D] + +Func_f453f:: ; f453f (3d:453f) + ld hl,PokemonLogoGraphics + ld de,vChars2 + ld bc,$730 + ld a,BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d + call FarCopyData + ld hl,YellowLogoGraphics+$230 + ld de,vChars0+$fd0 + ld bc,$30 + ld a,BANK(YellowLogoGraphics) + call FarCopyData + ld hl,YellowLogoGraphics+$260 + ld de,vChars1 + ld bc,$400 + ld a,BANK(YellowLogoGraphics) + call FarCopyData + ld hl,YellowLogoGraphics+$660 + ld de,vChars0+$f00 + ld bc,$c0 + ld a,BANK(YellowLogoGraphics) + call FarCopyData + ret + +Func_f4578:: ; f4578 (3d:4578) + hlCoord 2,1 + ld de,Pointer_f45f9 + ld bc,7 << 8 | 16 ; 16x7 (xy) + call CopyScreenArea + ret + +Func_f4585:: ; f4585 (3d:4585) + hlCoord 6,4 + ld de,Pointer_f4673 + ld bc,4 << 8 | 7 ; 7x4 (xy) + call CopyScreenArea + hlCoord 9,8 + ld [hl],$64 + inc hl + ld [hl],$65 + ret + +Func_f459a:: ; f459a (3d:459a) + hlCoord 4,8 + ld de,Pointer_f468f + ld bc,9 << 8 | 12 ; 12x9 (xy) + call CopyScreenArea + hlCoord 16,10 + ld [hl],$96 + hlCoord 16,11 + ld [hl],$9d + hlCoord 16,12 + ld [hl],$a7 + hlCoord 16,13 + ld [hl],$b1 + ld hl,Pointer_f45c7 + ld de,wOAMBuffer + ld bc,$20 + call CopyData + ret + +Pointer_f45c7: ; f45c7 (3d:45c7) + db $60,$40,$f1,$22 + db $60,$48,$f0,$22 + db $68,$40,$f3,$22 + db $68,$48,$f2,$22 + db $60,$60,$f0,$02 + db $60,$68,$f1,$02 + db $68,$60,$f2,$02 + db $68,$68,$f3,$02 + +CopyScreenArea:: ; f45e7 (3d:45e7) +; copy cxb (xy) screen area from de to hl + push bc + push hl +.loop + ld a,[de] + inc de + ld [hli],a + dec c + jr nz,.loop + pop hl + ld bc,$14 + add hl,bc + pop bc + dec b + jr nz,CopyScreenArea + ret + +Pointer_f45f9: ; f45f9 (3d:45f9) +; 16x7 (xy) + db $f4,$f4,$f4,$f4,$f4,$f4,$49,$f4,$72,$30,$f4,$f4,$f4,$f4,$f4,$f4 + db $fd,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$f4,$0d,$0e,$0f + db $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f + db $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f + db $f4,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f + db $f4,$41,$42,$43,$44,$45,$46,$47,$48,$f4,$4a,$4b,$4c,$4d,$4e,$4f + db $f4,$6a,$6b,$6c,$6d,$f4,$f4,$f4,$f4,$f4,$f4,$6e,$6f,$70,$71,$f4 + +Pointer_f4669:: ; f4669 (3d:4669) + db $47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$5f + +Pointer_f4673:: ; f4673 (3d:4673) +; 7x4 (xy) + db $24,$25,$66,$67,$68,$69,$2a + db $50,$51,$52,$53,$54,$55,$56 + db $57,$58,$59,$5a,$5b,$5c,$5d + db $6d,$5e,$5f,$60,$61,$62,$63 + +Pointer_f468f:: ; f468f (3d:468f) +; 12x9 (xy) + db $80,$81,$82,$83,$00,$00,$00,$00,$84,$85,$86,$87 + db $88,$89,$8a,$8b,$8c,$8d,$8d,$8e,$8f,$8a,$90,$91 + db $00,$92,$93,$8a,$8a,$8a,$8a,$8a,$8a,$94,$95,$00 + db $00,$00,$97,$8a,$8a,$98,$99,$8a,$8a,$9a,$9b,$9c + db $00,$00,$9e,$9f,$a0,$a1,$a2,$a3,$a4,$a5,$a6,$8a + db $00,$a8,$a9,$aa,$8a,$ab,$ac,$8a,$ad,$ae,$af,$b0 + db $00,$b2,$b3,$b4,$8a,$8a,$8a,$8a,$b5,$b6,$b7,$b8 + db $00,$b9,$ba,$8a,$8a,$8a,$8a,$8a,$8a,$bb,$bc,$00 + db $00,$00,$bd,$8a,$8a,$8a,$8a,$8a,$8a,$be,$bf,$00 + +; f46f9 (3d:46f9) +PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp" +YellowLogoGraphics: INCBIN "gfx/yellow_titlescreen.2bpp" + +INCLUDE "engine/bank3d/link_menu.asm" + +HandleMenuInputDouble:: ; f5a40 (3d:5a40) + xor a + ld [wd09b],a + +HandleMenuInputPokemonSelectionDouble:: ; f5a44 (3d:5a44) + ld a,[H_DOWNARROWBLINKCNT1] + push af + ld a,[H_DOWNARROWBLINKCNT2] + push af ; save existing values on stack + xor a + ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1 + ld a,$06 + ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2 +.loop1 + xor a + ld [wPartyMonAnimCounter],a ; counter for pokemon shaking animation + call Func_f5ab0 + call JoypadLowSensitivity + ld a,[hJoy5] + and a ; was a key pressed? + jr nz,.keyPressed + pop af + ld [H_DOWNARROWBLINKCNT2],a + pop af + ld [H_DOWNARROWBLINKCNT1],a ; restore previous values + xor a + ld [wMenuWrappingEnabled],a ; disable menu wrapping + ret +.keyPressed + xor a + ld [wcc4b],a + ld a,[hJoy5] + ld b,a + bit 6,a ; pressed Up key? + jr z,.checkIfDownPressed +.upPressed + ld a,[wCurrentMenuItem] ; selected menu item + and a ; already at the top of the menu? + jr z,.checkOtherKeys +.notAtTop + dec a + ld [wCurrentMenuItem],a ; move selected menu item up one space + jr .checkOtherKeys +.checkIfDownPressed + bit 7,a + jr z,.checkOtherKeys +.downPressed + ld a,[wCurrentMenuItem] + inc a + ld c,a + ld a,[wMaxMenuItem] + cp c + jr c,.checkOtherKeys + ld a,c + ld [wCurrentMenuItem],a +.checkOtherKeys + ld a,[wMenuWatchedKeys] + and b ; does the menu care about any of the pressed keys? + jp z,.loop1 +.checkIfAButtonOrBButtonPressed + ld a,[hJoy5] + and A_BUTTON | B_BUTTON + jr z,.skipPlayingSound +.AButtonOrBButtonPressed + ld a, $90 ; (SFX_02_40 - SFX_Headers_02) / 3 + call PlaySound ; play sound +.skipPlayingSound + pop af + ld [H_DOWNARROWBLINKCNT2],a + pop af + ld [H_DOWNARROWBLINKCNT1],a ; restore previous values + ld a,[hJoy5] + ret + +Func_f5ab0:: ; f5ab0 (3d:5ab0) + ld a,[wTopMenuItemY] + and a + jr z,.asm_f5ac0 + hlCoord 0,0 + ld bc,$14 +.loop + add hl,bc + dec a + jr nz,.loop +.asm_f5ac0 + ld a,[wTopMenuItemX] + ld b,$0 + ld c,a + add hl,bc + push hl + ld a,[wLastMenuItem] + and a + jr z,.asm_f5ad5 + ld bc,$28 +.loop2 + add hl,bc + dec a + jr nz,.loop2 +.asm_f5ad5 + ld a,[hl] + cp "▶" + jr nz,.asm_f5ade + ld a,[wTileBehindCursor] + ld [hl],a +.asm_f5ade + pop hl + ld a,[wCurrentMenuItem] + and a + jr z,.asm_f5aec + ld bc,$28 +.loop3 + add hl,bc + dec a + jr nz,.loop3 +.asm_f5aec + ld a,[hl] + cp "▶" + jr z,.asm_f5af4 + ld [wTileBehindCursor],a +.asm_f5af4 + ld a,"▶" + ld [hl],a + ld a,l + ld [wMenuCursorLocation],a + ld a,h + ld [wMenuCursorLocation+1],a + ld a,[wCurrentMenuItem] + ld [wLastMenuItem],a + ret + +Func_f5b06:: ; f5b06 (3d:5b06) + ld hl,wd728 + set 0,[hl] + ld hl,Text_f5b17 + call PrintText + ld hl,Text_f5b28 + jp PrintText + +Text_f5b17:: ; f5b17 (3d:5b17) + TX_FAR _UsedStrengthText ; 2d:417e + db $08 ; asm + ld a,[wcf91] + call PlayCry + call Delay3 + jp TextScriptEnd + +Text_f5b28:: ; f5b28 (3d:5b28) + TX_FAR _CanMoveBouldersText ; 2d:4193 + db "@" + +Func_f5b2d:: ; f5b2d (3d:5b2d) + ld hl,wd728 + set 1,[hl] + ld a,[wd732] + bit 5,a + jr nz,.asm_f5b59 + ld a,[W_CURMAP] + cp SEAFOAM_ISLANDS_5 + ret nz + ld a,[wd881] + and $3 + cp $3 + ret z + ld hl,CoordsData_f5b64 + call ArePlayerCoordsInArray + ret nc + ld hl,wd728 + res 1,[hl] + ld hl,Text_f5b67 + jp PrintText +.asm_f5b59 + ld hl,wd728 + res 1,[hl] + ld hl,Text_f5b6c + jp PrintText + +CoordsData_f5b64:: ; f5b64 (3d:5b64) + db 11,07 + db $ff + +Text_f5b67:: ; f5b67 (3d:5b67) + TX_FAR _CurrentTooFastText ; 2d:41ab + db "@" + +Text_f5b6c:: ; f5b6c (3d:5b6c) + TX_FAR _CyclingIsFunText ; 2d:41ca + db "@" + +AddItemToInventory_:: ; f5b70 (3d:5b70) + ld a,[wcf96] ; a = item quantity + push af + push bc + push de + push hl + push hl + ld d,50 ; PC box can hold 50 items + 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,20 ; bag can hold 20 items +.checkIfInventoryFull + ld a,[hl] + sub d + ld d,a + ld a,[hli] + and a + jr z,.addNewItem +.notAtEndOfInventory + 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 +.loop + ld a,[hl] + cp a,$ff ; is it the end of the table? + jr nz, .notAtEndOfInventory +.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,[wcf96] + 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,[wcf96] + 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 [wcf96],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 [wcf96],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 +; [wcf96] = quantity to remove +RemoveItemFromInventory_: ; f5be1 (3d:5be1) + push hl + inc hl + ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed + add a + add l + ld l,a + jr nc,.noCarry + inc h +.noCarry + inc hl + ld a,[wcf96] ; quantity being removed + ld e,a + ld a,[hl] ; a = current quantity + sub e + ld [hld],a ; store new quantity + ld [wcf97],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 [wcc2c],a + ld [wd07e],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 [wd12a],a + cp a,2 + jr c,.done + ld [wMaxMenuItem],a + jr .done +.skipMovingUpSlots + pop hl +.done + ret + +TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" +BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" +CircleTile: INCBIN "gfx/circle_tile.2bpp" +BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" + +Func_f5ea4:: ; f5ea4 (3d:5ea4) + ld a,[W_CURMAP] + ld c,a + ld hl,FishingSlots +.loop + ld a,[hli] + cp $ff + jr z,.notfound + cp c + jr z,.found + ld de,$8 + add hl,de + jr .loop +.found + call GenerateRandomFishingEncounter + ret +.notfound + ld de,$0 + ret + +GenerateRandomFishingEncounter: ; f5ec1 (3d:5ec1) + call Random + cp $66 + jr c,.asm_f5ed6 + inc hl + inc hl + cp $b2 + jr c,.asm_f5ed6 + inc hl + inc hl + cp $e5 + jr c,.asm_f5ed6 + inc hl + inc hl +.asm_f5ed6 + ld e,[hl] + inc hl + ld d,[hl] + ret + +INCLUDE "data/super_rod.asm" +INCLUDE "engine/bank3d/bank3d_battle.asm" +INCLUDE "engine/items/tm_prices.asm" +INCLUDE "engine/multiply_divide.asm" +INCLUDE "engine/give_pokemon.asm" +INCLUDE "engine/battle/get_trainer_name.asm" +INCLUDE "engine/bank3d/random.asm" +INCLUDE "engine/predefs.asm"
\ No newline at end of file diff --git a/engine/bank3d/random.asm b/engine/bank3d/random.asm new file mode 100644 index 00000000..ddf042df --- /dev/null +++ b/engine/bank3d/random.asm @@ -0,0 +1,13 @@ +Random_:: ; f67dc (3d:67dc) +; Generate a random 16-bit value. + ld a, [rDIV] + ld b, a + ld a, [hRandomAdd] + adc b + ld [hRandomAdd], a + ld a, [rDIV] + ld b, a + ld a, [hRandomSub] + sbc b + ld [hRandomSub], a + ret diff --git a/engine/bank3f/data/map_header_banks.asm b/engine/bank3f/data/map_header_banks.asm new file mode 100644 index 00000000..eeff1974 --- /dev/null +++ b/engine/bank3f/data/map_header_banks.asm @@ -0,0 +1,252 @@ +; see also MapHeaderPointers +MapHeaderBanks:: ; fc3e4 (3f:43e4) + dr $fc3e4,$fc4dd + ;db BANK(PalletTown_h) ;PALLET_TOWN + ;db BANK(ViridianCity_h) ; VIRIDIAN_CITY + ;db BANK(PewterCity_h) ; PEWTER_CITY + ;db BANK(CeruleanCity_h) ; CERULEAN_CITY + ;db BANK(LavenderTown_h) ; LAVENDER_TOWN + ;db BANK(VermilionCity_h) ; VERMILION_CITY + ;db BANK(CeladonCity_h) ; CELADON_CITY + ;db BANK(FuchsiaCity_h) ; FUCHSIA_CITY + ;db BANK(CinnabarIsland_h) ; CINNABAR_ISLAND + ;db BANK(IndigoPlateau_h) ; INDIGO_PLATEAU + ;db BANK(SaffronCity_h) ; SAFFRON_CITY + ;db $1 ; unused + ;db BANK(Route1_h) ; ROUTE_1 + ;db BANK(Route2_h) ; ROUTE_2 + ;db BANK(Route3_h) ; ROUTE_3 + ;db BANK(Route4_h) ; ROUTE_4 + ;db BANK(Route5_h) ; ROUTE_5 + ;db BANK(Route6_h) ; ROUTE_6 + ;db BANK(Route7_h) ; ROUTE_7 + ;db BANK(Route8_h) ; ROUTE_8 + ;db BANK(Route9_h) ; ROUTE_9 + ;db BANK(Route10_h) ; ROUTE_10 + ;db BANK(Route11_h) ; ROUTE_11 + ;db BANK(Route12_h) ; ROUTE_12 + ;db BANK(Route13_h) ; ROUTE_13 + ;db BANK(Route14_h) ; ROUTE_14 + ;db BANK(Route15_h) ; ROUTE_15 + ;db BANK(Route16_h) ; ROUTE_16 + ;db BANK(Route17_h) ; ROUTE_17 + ;db BANK(Route18_h) ; ROUTE_18 + ;db BANK(Route19_h) ; ROUTE_19 + ;db BANK(Route20_h) ; ROUTE_20 + ;db BANK(Route21_h) ; ROUTE_21 + ;db BANK(Route22_h) ; ROUTE_22 + ;db BANK(Route23_h) ; ROUTE_23 + ;db BANK(Route24_h) ; ROUTE_24 + ;db BANK(Route25_h) ; ROUTE_25 + ;db BANK(RedsHouse1F_h) + ;db BANK(RedsHouse2F_h) + ;db BANK(BluesHouse_h) + ;db BANK(OaksLab_h) + ;db BANK(ViridianPokecenter_h) + ;db BANK(ViridianMart_h) + ;db BANK(School_h) + ;db BANK(ViridianHouse_h) + ;db BANK(ViridianGym_h) + ;db BANK(DiglettsCaveRoute2_h) + ;db BANK(ViridianForestExit_h) + ;db BANK(Route2House_h) + ;db BANK(Route2Gate_h) + ;db BANK(ViridianForestEntrance_h) + ;db BANK(ViridianForest_h) + ;db BANK(Museum1F_h) + ;db BANK(Museum2F_h) + ;db BANK(PewterGym_h) + ;db BANK(PewterHouse1_h) + ;db BANK(PewterMart_h) + ;db BANK(PewterHouse2_h) + ;db BANK(PewterPokecenter_h) + ;db BANK(MtMoon1_h) + ;db BANK(MtMoon2_h) + ;db BANK(MtMoon3_h) + ;db BANK(CeruleanHouseTrashed_h) + ;db BANK(CeruleanHouse1_h) + ;db BANK(CeruleanPokecenter_h) + ;db BANK(CeruleanGym_h) + ;db BANK(BikeShop_h) + ;db BANK(CeruleanMart_h) + ;db BANK(MtMoonPokecenter_h) + ;db BANK(CeruleanHouseTrashed_h) + ;db BANK(Route5Gate_h) + ;db BANK(UndergroundPathEntranceRoute5_h) + ;db BANK(DayCareM_h) + ;db BANK(Route6Gate_h) + ;db BANK(UndergroundPathEntranceRoute6_h) + ;db BANK(UndergroundPathEntranceRoute6_h) ;FREEZE + ;db BANK(Route7Gate_h) + ;db BANK(UndergroundPathEntranceRoute7_h) + ;db BANK(UndergroundPathEntranceRoute7Copy_h) ;FREEZE + ;db BANK(Route8Gate_h) + ;db BANK(UndergroundPathEntranceRoute8_h) + ;db BANK(RockTunnelPokecenter_h) + ;db BANK(RockTunnel1_h) + ;db BANK(PowerPlant_h) + ;db BANK(Route11Gate_h) + ;db BANK(DiglettsCaveEntranceRoute11_h) + ;db BANK(Route11GateUpstairs_h) + ;db BANK(Route12Gate_h) + ;db BANK(BillsHouse_h) + ;db BANK(VermilionPokecenter_h) + ;db BANK(FanClub_h) + ;db BANK(VermilionMart_h) + ;db BANK(VermilionGym_h) + ;db BANK(VermilionHouse1_h) + ;db BANK(VermilionDock_h) + ;db BANK(SSAnne1_h) + ;db BANK(SSAnne2_h) + ;db BANK(SSAnne3_h) + ;db BANK(SSAnne4_h) + ;db BANK(SSAnne5_h) + ;db BANK(SSAnne6_h) + ;db BANK(SSAnne7_h) + ;db BANK(SSAnne8_h) + ;db BANK(SSAnne9_h) + ;db BANK(SSAnne10_h) + ;db $1D ;unused + ;db $1D ;unused + ;db $1D ;unused + ;db BANK(VictoryRoad1_h) + ;db $1D ;unused + ;db $1D ;unused + ;db $1D ;unused + ;db $1D ;unused + ;db BANK(Lance_h) + ;db $1D ;unused + ;db $1D ;unused + ;db $1D ;unused + ;db $1D ;unused + ;db BANK(HallofFameRoom_h) + ;db BANK(UndergroundPathNS_h) + ;db BANK(Gary_h) + ;db BANK(UndergroundPathWE_h) + ;db BANK(CeladonMart1_h) + ;db BANK(CeladonMart2_h) + ;db BANK(CeladonMart3_h) + ;db BANK(CeladonMart4_h) + ;db BANK(CeladonMartRoof_h) + ;db BANK(CeladonMartElevator_h) + ;db BANK(CeladonMansion1_h) + ;db BANK(CeladonMansion2_h) + ;db BANK(CeladonMansion3_h) + ;db BANK(CeladonMansion4_h) + ;db BANK(CeladonMansion5_h) + ;db BANK(CeladonPokecenter_h) + ;db BANK(CeladonGym_h) + ;db BANK(CeladonGameCorner_h) + ;db BANK(CeladonMart5_h) + ;db BANK(CeladonPrizeRoom_h) + ;db BANK(CeladonDiner_h) + ;db BANK(CeladonHouse_h) + ;db BANK(CeladonHotel_h) + ;db BANK(LavenderPokecenter_h) + ;db BANK(PokemonTower1_h) + ;db BANK(PokemonTower2_h) + ;db BANK(PokemonTower3_h) + ;db BANK(PokemonTower4_h) + ;db BANK(PokemonTower5_h) + ;db BANK(PokemonTower6_h) + ;db BANK(PokemonTower7_h) + ;db BANK(LavenderHouse1_h) + ;db BANK(LavenderMart_h) + ;db BANK(LavenderHouse2_h) + ;db BANK(FuchsiaMart_h) + ;db BANK(FuchsiaHouse1_h) + ;db BANK(FuchsiaPokecenter_h) + ;db BANK(FuchsiaHouse2_h) + ;db BANK(SafariZoneEntrance_h) + ;db BANK(FuchsiaGym_h) + ;db BANK(FuchsiaMeetingRoom_h) + ;db BANK(SeafoamIslands2_h) + ;db BANK(SeafoamIslands3_h) + ;db BANK(SeafoamIslands4_h) + ;db BANK(SeafoamIslands5_h) + ;db BANK(VermilionHouse2_h) + ;db BANK(FuchsiaHouse3_h) + ;db BANK(Mansion1_h) + ;db BANK(CinnabarGym_h) + ;db BANK(Lab1_h) + ;db BANK(Lab2_h) + ;db BANK(Lab3_h) + ;db BANK(Lab4_h) + ;db BANK(CinnabarPokecenter_h) + ;db BANK(CinnabarMart_h) + ;db BANK(CinnabarMart_h) + ;db BANK(IndigoPlateauLobby_h) + ;db BANK(CopycatsHouse1F_h) + ;db BANK(CopycatsHouse2F_h) + ;db BANK(FightingDojo_h) + ;db BANK(SaffronGym_h) + ;db BANK(SaffronHouse1_h) + ;db BANK(SaffronMart_h) + ;db BANK(SilphCo1_h) + ;db BANK(SaffronPokecenter_h) + ;db BANK(SaffronHouse2_h) + ;db BANK(Route15Gate_h) + ;db BANK(Route15GateUpstairs_h) + ;db BANK(Route16Gate_h) + ;db BANK(Route16GateUpstairs_h) + ;db BANK(Route16House_h) + ;db BANK(Route12House_h) + ;db BANK(Route18Gate_h) + ;db BANK(Route18GateUpstairs_h) + ;db BANK(SeafoamIslands1_h) + ;db BANK(Route22Gate_h) + ;db BANK(VictoryRoad2_h) + ;db BANK(Route12GateUpstairs_h) + ;db BANK(VermilionHouse3_h) + ;db BANK(DiglettsCave_h) + ;db BANK(VictoryRoad3_h) + ;db BANK(RocketHideout1_h) + ;db BANK(RocketHideout2_h) + ;db BANK(RocketHideout3_h) + ;db BANK(RocketHideout4_h) + ;db BANK(RocketHideoutElevator_h) + ;db $01 + ;db $01 + ;db $01 + ;db BANK(SilphCo2_h) + ;db BANK(SilphCo3_h) + ;db BANK(SilphCo4_h) + ;db BANK(SilphCo5_h) + ;db BANK(SilphCo6_h) + ;db BANK(SilphCo7_h) + ;db BANK(SilphCo8_h) + ;db BANK(Mansion2_h) + ;db BANK(Mansion3_h) + ;db BANK(Mansion4_h) + ;db BANK(SafariZoneEast_h) + ;db BANK(SafariZoneNorth_h) + ;db BANK(SafariZoneWest_h) + ;db BANK(SafariZoneCenter_h) + ;db BANK(SafariZoneRestHouse1_h) + ;db BANK(SafariZoneSecretHouse_h) + ;db BANK(SafariZoneRestHouse2_h) + ;db BANK(SafariZoneRestHouse3_h) + ;db BANK(SafariZoneRestHouse4_h) + ;db BANK(UnknownDungeon2_h) + ;db BANK(UnknownDungeon3_h) + ;db BANK(UnknownDungeon1_h) + ;db BANK(NameRater_h) + ;db BANK(CeruleanHouse2_h) + ;db $01 + ;db BANK(RockTunnel2_h) + ;db BANK(SilphCo9_h) + ;db BANK(SilphCo10_h) + ;db BANK(SilphCo11_h) + ;db BANK(SilphCoElevator_h) + ;db $11 + ;db $11 + ;db BANK(BattleCenterM_h) + ;db BANK(TradeCenterM_h) + ;db $11 + ;db $11 + ;db $11 + ;db $11 + ;db BANK(Lorelei_h) + ;db BANK(Bruno_h) + ;db BANK(Agatha_h) + ;db BANK(BeachHouse_h)
\ No newline at end of file diff --git a/engine/bank3f/data/map_header_pointers.asm b/engine/bank3f/data/map_header_pointers.asm new file mode 100644 index 00000000..c7dd0c9f --- /dev/null +++ b/engine/bank3f/data/map_header_pointers.asm @@ -0,0 +1,252 @@ +; see also MapHeaderBanks +MapHeaderPointers:: ; fc1f2 (3f:41f2) + dr $fc1f2,$fc3e4 + ;dw PalletTown_h + ;dw ViridianCity_h + ;dw PewterCity_h + ;dw CeruleanCity_h + ;dw LavenderTown_h + ;dw VermilionCity_h + ;dw CeladonCity_h + ;dw FuchsiaCity_h + ;dw CinnabarIsland_h + ;dw IndigoPlateau_h + ;dw SaffronCity_h + ;dw SaffronCity_h + ;dw Route1_h + ;dw Route2_h + ;dw Route3_h + ;dw Route4_h + ;dw Route5_h + ;dw Route6_h + ;dw Route7_h + ;dw Route8_h + ;dw Route9_h + ;dw Route10_h + ;dw Route11_h + ;dw Route12_h + ;dw Route13_h + ;dw Route14_h + ;dw Route15_h + ;dw Route16_h + ;dw Route17_h + ;dw Route18_h + ;dw Route19_h + ;dw Route20_h + ;dw Route21_h + ;dw Route22_h + ;dw Route23_h + ;dw Route24_h + ;dw Route25_h + ;dw RedsHouse1F_h + ;dw RedsHouse2F_h + ;dw BluesHouse_h + ;dw OaksLab_h ;id=40 + ;dw ViridianPokecenter_h + ;dw ViridianMart_h + ;dw School_h + ;dw ViridianHouse_h + ;dw ViridianGym_h + ;dw DiglettsCaveRoute2_h + ;dw ViridianForestExit_h + ;dw Route2House_h + ;dw Route2Gate_h + ;dw ViridianForestEntrance_h ;id=50 + ;dw ViridianForest_h + ;dw Museum1F_h + ;dw Museum2F_h + ;dw PewterGym_h + ;dw PewterHouse1_h + ;dw PewterMart_h + ;dw PewterHouse2_h + ;dw PewterPokecenter_h + ;dw MtMoon1_h + ;dw MtMoon2_h ;id=60 + ;dw MtMoon3_h + ;dw CeruleanHouseTrashed_h + ;dw CeruleanHouse1_h + ;dw CeruleanPokecenter_h + ;dw CeruleanGym_h + ;dw BikeShop_h + ;dw CeruleanMart_h + ;dw MtMoonPokecenter_h + ;dw CeruleanHouseTrashed_h ; copy + ;dw Route5Gate_h + ;dw UndergroundPathEntranceRoute5_h + ;dw DayCareM_h + ;dw Route6Gate_h + ;dw UndergroundPathEntranceRoute6_h + ;dw UndergroundPathEntranceRoute6_h ; unused + ;dw Route7Gate_h + ;dw UndergroundPathEntranceRoute7_h + ;dw UndergroundPathEntranceRoute7Copy_h + ;dw Route8Gate_h + ;dw UndergroundPathEntranceRoute8_h ;id=80 + ;dw RockTunnelPokecenter_h + ;dw RockTunnel1_h + ;dw PowerPlant_h + ;dw Route11Gate_h + ;dw DiglettsCaveEntranceRoute11_h + ;dw Route11GateUpstairs_h + ;dw Route12Gate_h + ;dw BillsHouse_h + ;dw VermilionPokecenter_h + ;dw FanClub_h ;id=90 + ;dw VermilionMart_h + ;dw VermilionGym_h + ;dw VermilionHouse1_h + ;dw VermilionDock_h + ;dw SSAnne1_h + ;dw SSAnne2_h + ;dw SSAnne3_h + ;dw SSAnne4_h + ;dw SSAnne5_h + ;dw SSAnne6_h ;id=100 + ;dw SSAnne7_h + ;dw SSAnne8_h + ;dw SSAnne9_h + ;dw SSAnne10_h + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw VictoryRoad1_h + ;dw Lance_h ; unused + ;dw Lance_h ; unused ;id=110 + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw Lance_h + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw Lance_h ; unused + ;dw HallofFameRoom_h + ;dw UndergroundPathNS_h + ;dw Gary_h ;id=120 + ;dw UndergroundPathWE_h + ;dw CeladonMart1_h + ;dw CeladonMart2_h + ;dw CeladonMart3_h + ;dw CeladonMart4_h + ;dw CeladonMartRoof_h + ;dw CeladonMartElevator_h + ;dw CeladonMansion1_h + ;dw CeladonMansion2_h + ;dw CeladonMansion3_h ;id=130 + ;dw CeladonMansion4_h + ;dw CeladonMansion5_h + ;dw CeladonPokecenter_h + ;dw CeladonGym_h + ;dw CeladonGameCorner_h + ;dw CeladonMart5_h + ;dw CeladonPrizeRoom_h + ;dw CeladonDiner_h + ;dw CeladonHouse_h + ;dw CeladonHotel_h ;id=140 + ;dw LavenderPokecenter_h + ;dw PokemonTower1_h + ;dw PokemonTower2_h + ;dw PokemonTower3_h + ;dw PokemonTower4_h + ;dw PokemonTower5_h + ;dw PokemonTower6_h + ;dw PokemonTower7_h + ;dw LavenderHouse1_h + ;dw LavenderMart_h ;id=150 + ;dw LavenderHouse2_h + ;dw FuchsiaMart_h + ;dw FuchsiaHouse1_h + ;dw FuchsiaPokecenter_h + ;dw FuchsiaHouse2_h + ;dw SafariZoneEntrance_h + ;dw FuchsiaGym_h + ;dw FuchsiaMeetingRoom_h + ;dw SeafoamIslands2_h + ;dw SeafoamIslands3_h ;id=160 + ;dw SeafoamIslands4_h + ;dw SeafoamIslands5_h + ;dw VermilionHouse2_h + ;dw FuchsiaHouse3_h + ;dw Mansion1_h + ;dw CinnabarGym_h + ;dw Lab1_h + ;dw Lab2_h + ;dw Lab3_h + ;dw Lab4_h ;id=170 + ;dw CinnabarPokecenter_h + ;dw CinnabarMart_h + ;dw CinnabarMart_h ; unused + ;dw IndigoPlateauLobby_h + ;dw CopycatsHouse1F_h + ;dw CopycatsHouse2F_h + ;dw FightingDojo_h + ;dw SaffronGym_h + ;dw SaffronHouse1_h + ;dw SaffronMart_h ;id=180 + ;dw SilphCo1_h + ;dw SaffronPokecenter_h + ;dw SaffronHouse2_h + ;dw Route15Gate_h + ;dw Route15GateUpstairs_h + ;dw Route16Gate_h + ;dw Route16GateUpstairs_h + ;dw Route16House_h + ;dw Route12House_h + ;dw Route18Gate_h ;id=190 + ;dw Route18GateUpstairs_h + ;dw SeafoamIslands1_h + ;dw Route22Gate_h + ;dw VictoryRoad2_h + ;dw Route12GateUpstairs_h + ;dw VermilionHouse3_h + ;dw DiglettsCave_h + ;dw VictoryRoad3_h + ;dw RocketHideout1_h + ;dw RocketHideout2_h ;200 + ;dw RocketHideout3_h + ;dw RocketHideout4_h + ;dw RocketHideoutElevator_h + ;dw RocketHideoutElevator_h ; unused + ;dw RocketHideoutElevator_h ; unused + ;dw RocketHideoutElevator_h ; unused + ;dw SilphCo2_h + ;dw SilphCo3_h + ;dw SilphCo4_h + ;dw SilphCo5_h ;210 + ;dw SilphCo6_h + ;dw SilphCo7_h + ;dw SilphCo8_h + ;dw Mansion2_h + ;dw Mansion3_h + ;dw Mansion4_h + ;dw SafariZoneEast_h + ;dw SafariZoneNorth_h + ;dw SafariZoneWest_h + ;dw SafariZoneCenter_h ;220 + ;dw SafariZoneRestHouse1_h + ;dw SafariZoneSecretHouse_h + ;dw SafariZoneRestHouse2_h + ;dw SafariZoneRestHouse3_h + ;dw SafariZoneRestHouse4_h + ;dw UnknownDungeon2_h + ;dw UnknownDungeon3_h + ;dw UnknownDungeon1_h + ;dw NameRater_h + ;dw CeruleanHouse2_h + ;dw Route16Gate_h ; unused + ;dw RockTunnel2_h + ;dw SilphCo9_h + ;dw SilphCo10_h + ;dw SilphCo11_h + ;dw SilphCoElevator_h + ;dw SilphCo2_h ; unused + ;dw SilphCo2_h ; unused + ;dw BattleCenterM_h + ;dw TradeCenterM_h + ;dw SilphCo2_h ; unused + ;dw SilphCo2_h ; unused + ;dw SilphCo2_h ; unused + ;dw SilphCo2_h ; unused + ;dw Lorelei_h + ;dw Bruno_h + ;dw Agatha_h ;247 + ;dw BeachHouse_h
\ No newline at end of file diff --git a/engine/bank3f/data/map_songs.asm b/engine/bank3f/data/map_songs.asm new file mode 100644 index 00000000..ece6d321 --- /dev/null +++ b/engine/bank3f/data/map_songs.asm @@ -0,0 +1,252 @@ +MapSongBanks: ; fc000 (3f:4000) + dr $fc000,$fc1f2 + + ;db MUSIC_PALLET_TOWN, BANK(Music_PalletTown) ;PALLET_TOWN + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; VIRIDIAN_CITY + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; PEWTER_CITY + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; CERULEAN_CITY + ;db MUSIC_LAVENDER, BANK(Music_Lavender) ; LAVENDER_TOWN + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; VERMILION_CITY + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CELADON_CITY + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; FUCHSIA_CITY + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) ; CINNABAR_ISLAND + ;db MUSIC_INDIGO_PLATEAU, BANK(Music_IndigoPlateau) ; INDIGO_PLATEAU + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; SAFFRON_CITY + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; unused + ;db MUSIC_ROUTES1, BANK(Music_Routes1) ; ROUTE_1 + ;db MUSIC_ROUTES1, BANK(Music_Routes1) ; ROUTE_2 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_3 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_4 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_5 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_6 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_7 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_8 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_9 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_10 + ;db MUSIC_ROUTES4, BANK(Music_Routes4) ; ROUTE_11 + ;db MUSIC_ROUTES4, BANK(Music_Routes4) ; ROUTE_12 + ;db MUSIC_ROUTES4, BANK(Music_Routes4) ; ROUTE_13 + ;db MUSIC_ROUTES4, BANK(Music_Routes4) ; ROUTE_14 + ;db MUSIC_ROUTES4, BANK(Music_Routes4) ; ROUTE_15 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_16 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_17 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_18 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_19 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_20 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_21 + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; ROUTE_22 + ;db MUSIC_INDIGO_PLATEAU, BANK(Music_IndigoPlateau) ; ROUTE_23 + ;db MUSIC_ROUTES2, BANK(Music_Routes2) ; ROUTE_24 + ;db MUSIC_ROUTES2, BANK(Music_Routes2) ; ROUTE_25 + ;db MUSIC_PALLET_TOWN, BANK(Music_PalletTown) ; RedsHouse1F + ;db MUSIC_PALLET_TOWN, BANK(Music_PalletTown) ; RedsHouse2F + ;db MUSIC_PALLET_TOWN, BANK(Music_PalletTown) ; BluesHouse + ;db MUSIC_OAKS_LAB, BANK(Music_OaksLab) ; OaksLab + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; ViridianPokecenter + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; ViridianMart + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; School + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; ViridianHouse + ;db MUSIC_GYM, BANK(Music_Gym) ; ViridianGym + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; DiglettsCaveRoute2 + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; ViridianForestExit + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route2House + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route2Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; ViridianForestEntrance + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; ViridianForest + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Museum1F + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Museum2F + ;db MUSIC_GYM, BANK(Music_Gym) ; PewterGym + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; PewterHouse1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; PewterMart + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; PewterHouse2 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; PewterPokecenter + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; MtMoon1 + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; MtMoon2 + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; MtMoon3 + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; CeruleanHouseTrashed + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; CeruleanHouse1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeruleanPokecenter + ;db MUSIC_GYM, BANK(Music_Gym) ; CeruleanGym + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; BikeShop + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeruleanMart + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; MtMoonPokecenter + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; CeruleanHouseTrashed + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route5Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; UndergroundTunnelEntranceRoute5 + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; DayCareM + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route6Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; UndergroundTunnelEntranceRoute6 + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; FREEZE + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route7Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; UndergroundPathEntranceRoute7 + ;db MUSIC_CELADON, BANK(Music_Celadon) ;FREEZE + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route8Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; UndergroundPathEntranceRoute8 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; RockTunnelPokecenter + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; RockTunnel1 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; PowerPlant + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; Route11Gate + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; DiglettsCaveEntranceRoute11 + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; Route11GateUpstairs + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route12Gate + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; BillsHouse + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; VermilionPokecenter + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; FanClub + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; VermilionMart + ;db MUSIC_GYM, BANK(Music_Gym) ; VermilionGym + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; VermilionHouse1 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; VermilionDock + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne1 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne2 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne3 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne4 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne5 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne6 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne7 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne8 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne9 + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ; SSAnne10 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ;unused + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ;unused + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ;unused + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; VictoryRoad1 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ;unused + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ;unused + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ;unused + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ;unused + ;db MUSIC_INDIGO_PLATEAU, BANK(Music_IndigoPlateau) ; Lance + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ;unused + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ;unused + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ;unused + ;db MUSIC_SS_ANNE, BANK(Music_SSAnne) ;unused + ;db MUSIC_PALLET_TOWN, BANK(Music_PalletTown) ; HallofFameRoom + ;db MUSIC_ROUTES1, BANK(Music_Routes1) ; UndergroundPathNS + ;db MUSIC_INDIGO_PLATEAU, BANK(Music_IndigoPlateau) ; Gary + ;db MUSIC_ROUTES1, BANK(Music_Routes1) ; UndergroundPathWE + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMart1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMart2 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMart3 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMart4 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMartRoof + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMartElevator + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonMansion1 + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonMansion2 + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonMansion3 + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonMansion4 + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonMansion5 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonPokecenter + ;db MUSIC_GYM, BANK(Music_Gym) ; CeladonGym + ;db MUSIC_GAME_CORNER, BANK(Music_GameCorner) ; CeladonGameCorner + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CeladonMart5 + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonPrizeRoom + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonDiner + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonHouse + ;db MUSIC_CELADON, BANK(Music_Celadon) ; CeladonHotel + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; LavenderPokecenter + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower1 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower2 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower3 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower4 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower5 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower6 + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; PokemonTower7 + ;db MUSIC_LAVENDER, BANK(Music_Lavender) ; LavenderHouse1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; LavenderMart + ;db MUSIC_LAVENDER, BANK(Music_Lavender) ; LavenderHouse2 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; FuchsiaMart + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; FuchsiaHouse1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; FuchsiaPokecenter + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; FuchsiaHouse2 + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; SafariZoneEntrance + ;db MUSIC_GYM, BANK(Music_Gym) ; FuchsiaGym + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; FuchsiaMeetingRoom + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; SeafoamIslands2 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; SeafoamIslands3 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; SeafoamIslands4 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; SeafoamIslands5 + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; VermilionHouse2 + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; FuchsiaHouse3 + ;db MUSIC_CINNABAR_MANSION, BANK(Music_CinnabarMansion) ; Mansion1 + ;db MUSIC_GYM, BANK(Music_Gym) ; CinnabarGym + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) ; Lab1 + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) ; Lab2 + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) ; Lab3 + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) ; Lab4 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CinnabarPokecenter + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; CinnabarMart + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) + ;db MUSIC_INDIGO_PLATEAU, BANK(Music_IndigoPlateau) ; IndigoPlateauLobby + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; CopycatsHouse1F + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; CopycatsHouse2F + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; FightingDojo + ;db MUSIC_GYM, BANK(Music_Gym) ; SaffronGym + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; SaffronHouse1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; SaffronMart + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo1 + ;db MUSIC_POKECENTER, BANK(Music_Pokecenter) ; SaffronPokecenter + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; SaffronHouse2 + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route15Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route15GateUpstairs + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route16Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route16GateUpstairs + ;db MUSIC_CELADON, BANK(Music_Celadon) ; Route16House + ;db MUSIC_CELADON, BANK(Music_Celadon) ; Route12House + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route18Gate + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route18GateUpstairs + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; SeafoamIslands1 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; Route22Gate + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; VictoryRoad2 + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; Route12GateUpstairs + ;db MUSIC_VERMILION, BANK(Music_Vermilion) ; VermilionHouse3 + ;db MUSIC_DUNGEON2, BANK(Music_Dungeon2) ; DiglettsCave + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; VictoryRoad3 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; RocketHideout1 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; RocketHideout2 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; RocketHideout3 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; RocketHideout4 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; RocketHideoutElevator + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo2 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo3 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo4 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo5 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo6 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo7 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo8 + ;db MUSIC_CINNABAR_MANSION, BANK(Music_CinnabarMansion) ; Mansion2 + ;db MUSIC_CINNABAR_MANSION, BANK(Music_CinnabarMansion) ; Mansion3 + ;db MUSIC_CINNABAR_MANSION, BANK(Music_CinnabarMansion) ; Mansion4 + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneEast + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneNorth + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneWest + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneCenter + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneRestHouse1 + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneSecretHouse + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneRestHouse2 + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneRestHouse3 + ;db MUSIC_SAFARI_ZONE, BANK(Music_SafariZone) ; SafariZoneRestHouse4 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; UnknownDungeon2 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; UnknownDungeon3 + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; UnknownDungeon1 + ;db MUSIC_CITIES2, BANK(Music_Cities2) ; NameRater + ;db MUSIC_CITIES1, BANK(Music_Cities1) ; CeruleanHouse2 + ;db MUSIC_CINNABAR, BANK(Music_Cinnabar) + ;db MUSIC_DUNGEON3, BANK(Music_Dungeon3) ; RockTunnel2 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo9 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo10 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCo11 + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCoElevator + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_CELADON, BANK(Music_Celadon) ; BattleCenterM + ;db MUSIC_CELADON, BANK(Music_Celadon) ; TradeCenterM + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_SILPH_CO, BANK(Music_SilphCo) + ;db MUSIC_GYM, BANK(Music_Gym) ; Lorelei + ;db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; Bruno + ;db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; Agatha + ;db MUSIC_ROUTES3, BANK(Music_Routes3) ; BeachHouse
\ No newline at end of file diff --git a/engine/bank3f/main.asm b/engine/bank3f/main.asm new file mode 100644 index 00000000..b9c34e1a --- /dev/null +++ b/engine/bank3f/main.asm @@ -0,0 +1,325 @@ +INCLUDE "engine/bank3f/data/map_songs.asm" +INCLUDE "engine/bank3f/data/map_header_pointers.asm" +INCLUDE "engine/bank3f/data/map_header_banks.asm" + +Func_fc4dd:: ; fc4dd (3f:44dd) +; possibly to test if pika should be out? + ld a,[wd430] + bit 5,a + jr nz,.asm_fc4f8 ; 3f:44f8 + ld a,[wd430] + bit 7,a + jr nz,.asm_fc4f8 + call Func_fcdb8 + jr nc,.asm_fc4f8 + ld a,[wWalkBikeSurfState] + and a + jr nz,.asm_fc4f8 + scf + ret +.asm_fc4f8 + and a + ret + +Func_fc4fa:: ; fc4fa (3f:44fa) + ld hl,wd430 + bit 4,[hl] + res 4,[hl] + jr nz,.asm_fc515 + call Func_1542 + call Func_fc523 + ld a,$ff + ld [wSpriteStateData1 + $f2],a + call Func_fcb84 + call Func_fc5bc + ret + +.asm_fc515 + call Func_fc53f + xor a + ld [wd431],a + ld a,[wSpriteStateData1 + $9] + ld [wSpriteStateData1 + $f9],a + ret + +Func_fc523:: ; fc523 (3f:4523) + ld hl,wSpriteStateData1 + $f0 + call Func_fc52c + ld hl,wSpriteStateData2 + $f0 +Func_fc52c:: ; fc52c (3f:4523) + ld bc,$10 + xor a + call FillMemory + ret + +Func_fc534:: ; fc534 (3f:4534) + call Func_fc53f + call Func_fc5bc + xor a + ld [wd431],a + ret + +Func_fc53f:: ; fc53f (3f:453f) + ld bc,wSpriteStateData1 + $f0 + ld a,[W_YCOORD] + add $4 + ld e,a + ld a,[W_XCOORD] + add $4 + ld d,a + ld a,[wd431] + and a + jr z,.asm_fc5aa + cp $1 + jr z,.asm_fc59e + cp $2 + jr z,.asm_fc584 + cp $3 + jr z,.asm_fc5aa + cp $4 + jr z,.asm_fc5a4 + cp $5 + jr z,.asm_fc5a7 + cp $6 + jr z,.asm_fc5a1 + cp $7 + jr z,.asm_fc572 + jr .asm_fc59e + +.asm_fc572 + ld a,[wSpriteStateData1 + $9] + and a ; SPRITE_FACING_DOWN + jr z,.asm_fc5a4 + cp SPRITE_FACING_UP + jr z,.asm_fc5a7 + cp SPRITE_FACING_LEFT + jr z,.asm_fc5a1 + cp SPRITE_FACING_RIGHT + jr z,.asm_fc59e +.asm_fc584 + ld a,[wSpriteStateData1 + $9] + and a + jr nz,.asm_fc58d + dec e + jr .asm_fc5aa +.asm_fc58d + cp SPRITE_FACING_UP + jr nz,.asm_fc594 + inc e + jr .asm_fc5aa +.asm_fc594 + cp SPRITE_FACING_LEFT + jr nz,.asm_fc59b + inc d + jr .asm_fc5aa +.asm_fc59b + dec d + jr .asm_fc5aa +.asm_fc59e + inc d + jr .asm_fc5aa +.asm_fc5a1 + dec d + jr .asm_fc5aa +.asm_fc5a4 + inc e + jr .asm_fc5aa +.asm_fc5a7 + dec e + jr .asm_fc5aa ; useless jr +.asm_fc5aa + ld hl,$104 + add hl,bc + ld [hl],e + inc hl + ld [hl],d + inc hl +Func_fc4b2:: ; fc4b2 (3f:44b2) + ld [hl],$fe + push hl + ld hl,wd472 + set 5,[hl] + pop hl + ret + +Func_fc5bc:: ; fc5bc (3f:45bc) + ld a,$49 + ld [wSpriteStateData1 + $f0],a + ld a,$ff + ld [wSpriteStateData1 + $f2],a + ld a,[wd431] + and a + jr z,.asm_fc5e4 + cp $1 + jr z,.asm_fc5e4 + cp $3 + jr z,.asm_fc5eb + cp $4 + jr z,.asm_fc5e4 + cp $6 + jr z,.asm_fc5e4 + cp $7 + jr z,.asm_fc5f1 + call Func_fccb2 + ret + +.asm_fc5e4 + ld a,[wSpriteStateData1 + $9] + ld [wSpriteStateData1 + $f9],a + ret +.asm_fc5eb + ld a,$0 + ld [wSpriteStateData1 + $f9],a + ret +.asm_fc5f1 + ld a,[wSpriteStateData1 + $9] + xor $4 + ld [wSpriteStateData1 + $f9],a + ret + +Func_fc5fa:: ; fc5fa (3f:45fa) + ld a,[W_CURMAP] + cp OAKS_LAB + jr z,.asm_fc63d + cp ROUTE_22_GATE + jr z,.asm_fc62d + cp MT_MOON_2 + jr z,.asm_fc635 + cp ROCK_TUNNEL_1 + jr z,.asm_fc645 + ld a,[W_CURMAP] + ld hl,Pointer_fc64b + call Func_1568 ; similar to IsInArray, but not the same + jr c,.asm_fc639 + ld a,[W_CURMAP] + ld hl,Pointer_fc653 + call Func_1568 + jr nc,.asm_fc641 + ld a,[wSpriteStateData1 + $9] + and a + jr nz,.asm_fc641 + ld a,$3 + jr .asm_fc647 + +.asm_fc62d + ld a,[wSpriteStateData1 + $9] + and a + jr z,.asm_fc645 + jr .asm_fc641 +.asm_fc635 + ld a,$3 + jr .asm_fc647 +.asm_fc639 + ld a,$4 + jr .asm_fc647 +.asm_fc63d + ld a,$6 + jr .asm_fc647 +.asm_fc641 + ld a,$1 + jr .asm_fc647 +.asm_fc645 + ld a,$3 +.asm_fc647 + ld [wd431],a + ret + +Pointer_fc64b:: ; fc64b (3f:464b) + db $c2,$4c,$4f,$ba,$be,$b8,$54,$ff + +Pointer_fc653:: ; fc653 (3f:4653) + db $2f,$e6,$3e,$5e,$80,$31,$a4,$ff + +Func_fc65b:: ; fc65b (3f:465b) + ld a,[W_CURMAP] + cp VIRIDIAN_FOREST_EXIT + jr z,.asm_fc673 + cp VIRIDIAN_FOREST_ENTRANCE + jr z,.asm_fc67c + ld a,[W_CURMAP] + ld hl,Pointer_fc68e + call Func_1568 + jr c,.asm_fc688 + jr .asm_fc684 +.asm_fc673 + ld a,[wSpriteStateData1 + $9] + cp SPRITE_FACING_UP + jr z,.asm_fc688 + jr .asm_fc684 +.asm_fc67c + ld a,[wSpriteStateData1 + $9] + and a ; SPRITE_FACING_DOWN + jr z,.asm_fc684 + jr .asm_fc688 +.asm_fc684 + ld a,$0 + jr .asm_fc68a +.asm_fc688 + ld a,$1 +.asm_fc68a + ld [wd431],a + ret + +Pointer_fc68e:: ; fc68e (3f:468e) + db $33,$dd,$df,$e0,$e1,$de,$ec,$7f,$a8,$a9,$aa,$ff + +Func_fc69a:: ; fc69a (3f:469a) + ld a,[W_CURMAP] + cp ROUTE_22_GATE + jr z,.asm_fc6a7 + cp ROUTE_2_GATE + jr z,.asm_fc6b0 + jr .asm_fc6bd +.asm_fc6a7 + ld a,[wSpriteStateData1 + $9] + cp SPRITE_FACING_UP + jr z,.asm_fc6b9 + jr .asm_fc6bd +.asm_fc6b0 + ld a,[wSpriteStateData1 + $9] + cp SPRITE_FACING_UP + jr z,.asm_fc6b9 + jr .asm_fc6bd +.asm_fc6b9 + ld a,$1 + jr .asm_fc6c1 +.asm_fc6bd + ld a,$3 + jr .asm_fc6c1 +.asm_fc6c1 + ld [wd431],a + ret + + dr $fc6c5,$fc6d5 +Func_fc6d5:: ; fc6d5 (3f:46d5) + dr $fc6d5,$fcb84 +Func_fcb84: ; fcb84 (3f:45bc) + dr $fcb84,$fcc08 +Func_fcc08:: ; fcc08 (3f:4c08) + dr $fcc08,$fccb2 +Func_fccb2:: ; fccb2 (3f:4cb2) + dr $fccb2,$fcdb8 +Func_fcdb8:: ; fcdb8 (3f:4db8) + dr $fcdb8,$fce18 +Func_fce18:: ; fce18 (3f:4e18) + dr $fce18,$fcf0c +Func_fcf0c:: ; fcf0c (3f:4f0c) + dr $fcf0c,$fd004 +Func_fd004:: ; fd004 (3f:5004) + dr $fd004,$fd0d0 +Func_fd0d0:: ; fd0d0 (3f:50d0) + dr $fd0d0,$fd2a1 +Func_fd2a1:: ; fd2a1 (3f:52a1) + dr $fd2a1,$fe66f + +OfficerJennySprite: INCBIN "gfx/sprites/officer_jenny.2bpp" +PikachuSprite: INCBIN "gfx/sprites/pikachu.2bpp" +SandshrewSprite: INCBIN "gfx/sprites/sandshrew.2bpp" +OddishSprite: INCBIN "gfx/sprites/oddish.2bpp" +BulbasaurSprite: INCBIN "gfx/sprites/bulbasaur.2bpp" +JigglypuffSprite: INCBIN "gfx/sprites/jigglypuff.2bpp" +Clefairy2Sprite: INCBIN "gfx/sprites/clefairy2.2bpp" +ChanseySprite: INCBIN "gfx/sprites/chansey.2bpp" +SurfingPikachuSprite: INCBIN "gfx/sprites/surfing_pikachu.2bpp" +JessieSprite: INCBIN "gfx/sprites/jessie.2bpp" +JamesSprite: INCBIN "gfx/sprites/james.2bpp"
\ No newline at end of file diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 6d0f0e5f..626eea9e 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -367,15 +367,7 @@ AnimationTileset2: ; 786ee (1e:46ee) INCBIN "gfx/attack_anim_2.2bpp" SlotMachineTiles2: ; 78bde (1e:4bde) -IF DEF(_RED) - INCBIN "gfx/red/slotmachine2.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/slotmachine2.2bpp" -ENDC -IF DEF(_YELLOW) - INCBIN "gfx/yellow/slotmachine2.2bpp" -ENDC + INCBIN "gfx/slotmachine2.2bpp" MoveAnimation: ; 78d5e (1e:4d5e) push hl diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 9a5f62b1..642d457b 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -1,5 +1,5 @@ -BattleTransition: ; 7096d (1c:496d) - ld a, 1 +BattleTransition: ; 709d7 (1c:49d7) + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a @@ -70,7 +70,7 @@ BattleTransition: ; 7096d (1c:496d) ; bit 0: set if trainer battle ; bit 1: set if enemy is at least 3 levels higher than player ; bit 2: set if dungeon map -BattleTransitions: ; 709d2 (1c:49d2) +BattleTransitions: ; 70a3c (1c:4a3c) dw BattleTransition_DoubleCircle ; %000 dw BattleTransition_Spiral ; %001 dw BattleTransition_Circle ; %010 @@ -80,7 +80,7 @@ BattleTransitions: ; 709d2 (1c:49d2) dw BattleTransition_VerticalStripes ; %110 dw BattleTransition_Split ; %111 -GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2) +GetBattleTransitionID_WildOrTrainer: ; 70a4c (1c:4a4c) ld a, [W_CUROPPONENT] cp 200 jr nc, .trainer @@ -90,7 +90,7 @@ GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2) set 0, c ret -GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef) +GetBattleTransitionID_CompareLevels: ; 70a59 (1c:4a59) ld hl, wPartyMon1HP .faintedLoop ld a, [hli] @@ -121,7 +121,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef) ; fails to recognize VICTORY_ROAD_2, VICTORY_ROAD_3, all ROCKET_HIDEOUT maps, ; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE ; and SILPH_CO_[9-11]F as dungeon maps -GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19) +GetBattleTransitionID_IsDungeonMap: ; 70a83 (1c:4a83) ld a, [W_CURMAP] ld e, a ld hl, DungeonMaps1 @@ -153,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19) ; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP ; is equal to one of these maps -DungeonMaps1: ; 70a3f (1c:4a3f) +DungeonMaps1: ; 70aa9 (1c:4aa9) db VIRIDIAN_FOREST db ROCK_TUNNEL_1 db SEAFOAM_ISLANDS_1 @@ -162,7 +162,7 @@ DungeonMaps1: ; 70a3f (1c:4a3f) ; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP ; is in between or equal to each pair of maps -DungeonMaps2: ; 70a44 (1c:4a44) +DungeonMaps2: ; 70aac (1c:4aac) ; all MT_MOON maps db MT_MOON_1 db MT_MOON_3 @@ -181,29 +181,37 @@ DungeonMaps2: ; 70a44 (1c:4a44) db UNKNOWN_DUNGEON_1 db $FF -LoadBattleTransitionTile: ; 70a4d (1c:4a4d) +LoadBattleTransitionTile: ; 70ab7 (1c:4ab7) ld hl, vChars1 + $7f0 ld de, BattleTransitionTile lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10 jp CopyVideoData -BattleTransitionTile: ; 70a59 (1c:4a59) +BattleTransitionTile: ; 70ac3 (1c:4ac3) INCBIN "gfx/battle_transition.2bpp" BattleTransitionTileEnd: -BattleTransition_BlackScreen: ; 70a69 (1c:4a69) +BattleTransition_BlackScreen: ; 70ad3 (1c:4ad3) ld a, $ff ld [rBGP], a ld [rOBP0], a ld [rOBP1], a + call Func_3021 + call Func_3040 + call Func_3061 ret ; for non-dungeon trainer battles ; called regardless of mon levels, but does an ; outward spiral if enemy is at least 3 levels ; higher than player and does an inward spiral otherwise +<<<<<<< HEAD +BattleTransition_Spiral: ; 70ae5 (1c:4ae5) + ld a, [wcd47] +======= BattleTransition_Spiral: ; 70a72 (1c:4a72) ld a, [wBattleTransitionSpiralDirection] +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a and a jr z, .outwardSpiral call BattleTransition_InwardSpiral @@ -235,12 +243,21 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72) ld [wOutwardSpiralTileMapPointer], a ret +<<<<<<< HEAD +BattleTransition_InwardSpiral: ; 70b1d (1c:4b1d) + ld a, $7 + ld [wWhichTrade], a + ld hl, wTileMap + ld c, $11 + ld de, $14 +======= BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) ld a, 7 ld [wInwardSpiralUpdateScreenCounter], a coord hl, 0, 0 ld c, SCREEN_HEIGHT - 1 ld de, SCREEN_WIDTH +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_InwardSpiral_ inc c jr .skip @@ -253,7 +270,11 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) call BattleTransition_InwardSpiral_ dec c dec c +<<<<<<< HEAD + ld de, -$14 +======= ld de, -SCREEN_WIDTH +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_InwardSpiral_ inc c ld de, -1 @@ -265,7 +286,7 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) jr nz, .loop ret -BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0) +BattleTransition_InwardSpiral_: ; 70b53 (1c:4b53) push bc .loop ld [hl], $ff @@ -284,10 +305,17 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0) pop bc ret +<<<<<<< HEAD +BattleTransition_OutwardSpiral_: ; 70b6c (1c:4b6c) + ld bc, -$14 + ld de, $14 + ld a, [wd09b] +======= BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9) ld bc, -SCREEN_WIDTH ld de, SCREEN_WIDTH ld a, [wOutwardSpiralTileMapPointer + 1] +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a ld l, a ld a, [wOutwardSpiralTileMapPointer] ld h, a @@ -352,14 +380,19 @@ BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9) jr .done FlashScreen: -BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d) +BattleTransition_FlashScreen_: ; 70be8 (1c:4be8s) ld hl, BattleTransition_FlashScreenPalettes .loop ld a, [hli] cp $1 jr z, .done ld [rBGP], a +<<<<<<< HEAD + call Func_3021 + ld c, $2 +======= ld c, 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call DelayFrames jr .loop .done @@ -367,28 +400,45 @@ BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d) jr nz, BattleTransition_FlashScreen_ ret -BattleTransition_FlashScreenPalettes: ; 70b72 (1c:4b72) +BattleTransition_FlashScreenPalettes: ; 70be8 (1c:4be8) db $F9,$FE,$FF,$FE,$F9,$E4,$90,$40,$00,$40,$90,$E4 db $01 ; terminator ; used for low level trainer dungeon battles +<<<<<<< HEAD +BattleTransition_Shrink: ; 70bf4 (1c:4bf4) + ld c, $9 +======= BattleTransition_Shrink: ; 70b7f (1c:4b7f) ld c, SCREEN_HEIGHT / 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a .loop push bc xor a ld [H_AUTOBGTRANSFERENABLED], a +<<<<<<< HEAD + hlCoord 0, 7 + deCoord 0, 8 + ld bc, -$28 +======= coord hl, 0, 7 coord de, 0, 8 ld bc, -SCREEN_WIDTH * 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_CopyTiles1 coord hl, 0, 10 coord de, 0, 9 ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 +<<<<<<< HEAD + hlCoord 8, 0 + deCoord 9, 0 + ld bc, -$2 +======= coord hl, 8, 0 coord de, 9, 0 ld bc, -2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_CopyTiles2 coord hl, 11, 0 coord de, 10, 0 @@ -406,23 +456,40 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f) jp DelayFrames ; used for high level trainer dungeon battles +<<<<<<< HEAD +BattleTransition_Split: ; 70c40 (1c:4c40) + ld c, $9 +======= BattleTransition_Split: ; 70bca (1c:4bca) ld c, SCREEN_HEIGHT / 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a xor a ld [H_AUTOBGTRANSFERENABLED], a .loop push bc +<<<<<<< HEAD + hlCoord 0, 16 + deCoord 0, 17 + ld bc, -$28 +======= coord hl, 0, 16 coord de, 0, 17 ld bc, -SCREEN_WIDTH * 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_CopyTiles1 coord hl, 0, 1 coord de, 0, 0 ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 +<<<<<<< HEAD + hlCoord 18, 0 + deCoord 19, 0 + ld bc, -$2 +======= coord hl, 18, 0 coord de, 19, 0 ld bc, -2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a call BattleTransition_CopyTiles2 coord hl, 1, 0 coord de, 0, 0 @@ -437,7 +504,7 @@ BattleTransition_Split: ; 70bca (1c:4bca) ld c, 10 jp DelayFrames -BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) +BattleTransition_CopyTiles1: ; 70c88 (1c:4c88) ld a, c ld [wBattleTransitionCopyTilesOffset], a ld a, b @@ -469,7 +536,7 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) jr nz, .loop2 ret -BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) +BattleTransition_CopyTiles2: ; 70cb5 (1c:4c3f) ld a, c ld [wBattleTransitionCopyTilesOffset], a ld a, b @@ -519,10 +586,17 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ret ; used for high level wild dungeon battles +<<<<<<< HEAD +BattleTransition_VerticalStripes: ; 70cf4 (1c:4cf4) + ld c, $12 + ld hl, wTileMap + deCoord 1, 17 +======= BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) ld c, SCREEN_HEIGHT coord hl, 0, 0 coord de, 1, 17 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a xor a ld [H_AUTOBGTRANSFERENABLED], a .loop @@ -547,8 +621,13 @@ BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) jr nz, .loop jp BattleTransition_BlackScreen +<<<<<<< HEAD +BattleTransition_VerticalStripes_: ; 70d20 (1c:4d20) + ld c, $a +======= BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ld c, SCREEN_WIDTH / 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a .loop ld [hl], $ff inc hl @@ -558,10 +637,17 @@ BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ret ; used for low level wild dungeon battles +<<<<<<< HEAD +BattleTransition_HorizontalStripes: ; 70d2a (1c:4d2a) + ld c, $14 + ld hl, wTileMap + deCoord 19, 1 +======= BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) ld c, SCREEN_WIDTH coord hl, 0, 0 coord de, 19, 1 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a xor a ld [H_AUTOBGTRANSFERENABLED], a .loop @@ -582,9 +668,15 @@ BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) jr nz, .loop jp BattleTransition_BlackScreen +<<<<<<< HEAD +BattleTransition_HorizontalStripes_: ; 70d4e (1c:4d4e) + ld c, $9 + ld de, $28 +======= BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) ld c, SCREEN_HEIGHT / 2 ld de, SCREEN_WIDTH * 2 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a .loop ld [hl], $ff add hl, de @@ -595,7 +687,7 @@ BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) ; used for high level wild non-dungeon battles ; makes one full circle around the screen ; by animating each half circle one at a time -BattleTransition_Circle: ; 70ce4 (1c:4ce4) +BattleTransition_Circle: ; 70d5a (1c:4d5a) call BattleTransition_FlashScreen lb bc, 0, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 @@ -606,14 +698,14 @@ BattleTransition_Circle: ; 70ce4 (1c:4ce4) call BattleTransition_Circle_Sub1 jp BattleTransition_BlackScreen -BattleTransition_FlashScreen: ; 70cfd (1c:4cfd) +BattleTransition_FlashScreen: ; 70d73 (1c:4d73) ld b, $3 call BattleTransition_FlashScreen_ xor a ld [H_AUTOBGTRANSFERENABLED], a ret -BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06) +BattleTransition_Circle_Sub1: ; 70d7c (1c:4d7c) push bc push hl ld a, b @@ -627,8 +719,13 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06) jr nz, BattleTransition_Circle_Sub1 ret +<<<<<<< HEAD +BattleTransition_TransferDelay3: ; 70d8f (1c:4d8f) + ld a, $1 +======= BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) ld a, 1 +>>>>>>> 1a987d1e1ab96ca9553d4253c72858057332a03a ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a @@ -638,7 +735,7 @@ BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) ; used for low level wild non-dungeon battles ; makes two half circles around the screen ; by animating both half circles at the same time -BattleTransition_DoubleCircle: ; 70d24 (1c:4d24) +BattleTransition_DoubleCircle: ; 70d9a (1c:4d9a) call BattleTransition_FlashScreen ld c, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 @@ -666,7 +763,7 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24) jr nz, .loop jp BattleTransition_BlackScreen -BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50) +BattleTransition_Circle_Sub2: ; 70dc6 (1c:4dc6) ld [wBattleTransitionCircleScreenQuadrantY], a ld a, [hli] ld [wBattleTransitionCircleScreenQuadrantX], a @@ -679,7 +776,7 @@ BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50) ld l, a jp BattleTransition_Circle_Sub3 -BattleTransition_HalfCircle1: ; 70d61 (1c:4d61) +BattleTransition_HalfCircle1: ; 70dd7 (1c:4dd7) db $01 dw BattleTransition_CircleData1 dwCoord 18, 6 @@ -720,7 +817,7 @@ BattleTransition_HalfCircle1: ; 70d61 (1c:4d61) dw BattleTransition_CircleData1 dwCoord 1, 6 -BattleTransition_HalfCircle2: ; 70d93 (1c:4d93) +BattleTransition_HalfCircle2: ; 70d93 (1c:4e09) db $00 dw BattleTransition_CircleData1 dwCoord 1, 11 @@ -761,7 +858,7 @@ BattleTransition_HalfCircle2: ; 70d93 (1c:4d93) dw BattleTransition_CircleData1 dwCoord 18, 11 -BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5) +BattleTransition_Circle_Sub3: ; 70e3b (1c:4e3b) push hl ld a, [de] ld c, a @@ -806,17 +903,17 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5) jr nz, .loop2 jr BattleTransition_Circle_Sub3 -BattleTransition_CircleData1: ; 70dfe (1c:4dfe) +BattleTransition_CircleData1: ; 70e74 (1c:4e74) db $02,$03,$05,$04,$09,$FF -BattleTransition_CircleData2: ; 70e04 (1c:4e04) +BattleTransition_CircleData2: ; 70e7a (1c:4e7a) db $01,$01,$02,$02,$04,$02,$04,$02,$03,$FF -BattleTransition_CircleData3: ; 70e0e (1c:4e0e) +BattleTransition_CircleData3: ; 70e84 (1c:4e84) db $02,$01,$03,$01,$04,$01,$04,$01,$04,$01,$03,$01,$02,$01,$01,$01,$01,$FF -BattleTransition_CircleData4: ; 70e20 (1c:4e20) +BattleTransition_CircleData4: ; 70e97 (1c:4e97) db $04,$01,$04,$00,$03,$01,$03,$00,$02,$01,$02,$00,$01,$FF -BattleTransition_CircleData5: ; 70e2e (1c:4e2e) +BattleTransition_CircleData5: ; 70ea3 (1c:4ea3) db $04,$00,$03,$00,$03,$00,$02,$00,$02,$00,$01,$00,$01,$00,$01,$FF diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index a1afcb75..e3c7e1fa 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -1,5 +1,5 @@ -PrintBeginningBattleText: ; 58d99 (16:4d99) - ld a, [W_ISINBATTLE] +PrintBeginningBattleText: ; f4000 (3d:4000) + ld a, [W_ISINBATTLE] ; W_ISINBATTLE dec a jr nz, .trainerBattle ld a, [W_CURMAP] @@ -8,8 +8,20 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) cp LAVENDER_HOUSE_1 jr c, .pokemonTower .notPokemonTower + ld a,[W_BATTLETYPE] + cp $4 ; new battle type? + jr nz,.notnewbattletype + callab Func_fd0d0 + ld e,$24 + jr c,.asm_f4026 + ld e,$a +.asm_f4026 + callab Func_f0000 + jr .continue +.notnewbattletype ld a, [wEnemyMonSpecies2] call PlayCry +.continue ld hl, WildMonAppearedText ld a, [W_MOVEMISSED] and a @@ -23,9 +35,13 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) call DelayFrames ld hl, TrainerWantsToFightText .wildBattle + ld a, [W_BATTLETYPE] + and a + jr nz, .doNotDrawPokeballs push hl callab DrawAllPokeballs pop hl +.doNotDrawPokeballs call PrintText jr .done .pokemonTower @@ -63,38 +79,38 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) xor a ld [wFrequencyModifier], a ld a, $80 - ld [wTempoModifier], a - ld a, SFX_SILPH_SCOPE + ld [wc0f2], a + ld a, $e9 ; (SFX_08_77 - SFX_Headers_08) / 3 call PlaySound jp WaitForSoundToFinish .done ret -WildMonAppearedText: ; 58e3b (16:4e3b) +WildMonAppearedText: ; f40c7 (3d:40c7) TX_FAR _WildMonAppearedText db "@" -HookedMonAttackedText: ; 58e40 (16:4e40) +HookedMonAttackedText: ; f40cc (3d:40cc) TX_FAR _HookedMonAttackedText db "@" -EnemyAppearedText: ; 58e45 (16:4e45) +EnemyAppearedText: ; f40d1 (3d:40d1) TX_FAR _EnemyAppearedText db "@" -TrainerWantsToFightText: ; 58e4a (16:4e4a) +TrainerWantsToFightText: ; f40d6 (3d:40d6) TX_FAR _TrainerWantsToFightText db "@" -UnveiledGhostText: ; 58e4f (16:4e4f) +UnveiledGhostText: ; f40db (3d:40db) TX_FAR _UnveiledGhostText db "@" -GhostCantBeIDdText: ; 58e54 (16:4e54) +GhostCantBeIDdText: ; f40e0 (3d:40e0) TX_FAR _GhostCantBeIDdText db "@" -PrintSendOutMonMessage: ; 58e59 (16:4e59) +PrintSendOutMonMessage: ; f40e0 (3d:40e5) ld hl, wEnemyMonHP ld a, [hli] or [hl] @@ -126,7 +142,7 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59) ld a, [H_QUOTIENT + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP ld hl, GoText ; 70% or greater cp 70 - jr nc, .printText + jr nc, .printText ld hl, DoItText ; 40% - 69% cp 40 jr nc, .printText @@ -137,38 +153,38 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59) .printText jp PrintText -GoText: ; 58eae (16:4eae) +GoText: ; f413a (3d:413a) TX_FAR _GoText TX_ASM jr PrintPlayerMon1Text -DoItText: ; 58eb5 (16:4eb5) +DoItText: ; f4141 (3d:4141) TX_FAR _DoItText TX_ASM jr PrintPlayerMon1Text -GetmText: ; 58ebc (16:4ebc) +GetmText: ; f4148 (3d:4148) TX_FAR _GetmText TX_ASM jr PrintPlayerMon1Text -EnemysWeakText: ; 58ec3 (16:4ec3) +EnemysWeakText: ; f414f (3d:414f) TX_FAR _EnemysWeakText TX_ASM -PrintPlayerMon1Text: +PrintPlayerMon1Text: ; f4154 (3d:4154) ld hl, PlayerMon1Text ret -PlayerMon1Text: ; 58ecc (16:4ecc) +PlayerMon1Text: ; f4158 (3d:4158) TX_FAR _PlayerMon1Text db "@" -RetreatMon: ; 58ed1 (16:4ed1) +RetreatMon: ; f415d (3d:415d) ld hl, PlayerMon2Text jp PrintText -PlayerMon2Text: ; 58ed7 (16:4ed7) +PlayerMon2Text: ; f4163 (3d:4163) TX_FAR _PlayerMon2Text TX_ASM push de @@ -219,25 +235,25 @@ PlayerMon2Text: ; 58ed7 (16:4ed7) ld hl, GoodText ; HP went down 70% or more ret -EnoughText: ; 58f25 (16:4f25) +EnoughText: ; f41b1 (3d:41b1) TX_FAR _EnoughText TX_ASM jr PrintComeBackText -OKExclamationText: ; 58f2c (16:4f2c) +OKExclamationText: ; f41b8 (3d:41b8) TX_FAR _OKExclamationText TX_ASM jr PrintComeBackText -GoodText: ; 58f33 (16:4f33) +GoodText: ; f41bf (3d:41bf) TX_FAR _GoodText TX_ASM jr PrintComeBackText -PrintComeBackText: ; 58f3a (16:4f3a) +PrintComeBackText: ; f41c6 (3d:41c6) ld hl, ComeBackText ret -ComeBackText: ; 58f3e (16:4f3e) +ComeBackText: ; f41ca (3d:41ca) TX_FAR _ComeBackText db "@" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 0b534dda..8a46c705 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2982,11 +2982,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6) jp Delay3 DisabledText: ; 3d555 (f:5555) -IF DEF(_YELLOW) db "Disabled!@" -ELSE - db "disabled!@" -ENDC TypeText: ; 3d55f (f:555f) db "TYPE@" @@ -6836,168 +6832,6 @@ PlayMoveAnimation: ; 3ef07 (f:6f07) call Delay3 predef_jump MoveAnimation -InitBattle: ; 3ef12 (f:6f12) - ld a, [W_CUROPPONENT] - and a - jr z, DetermineWildOpponent - -InitOpponent: ; 3ef18 (f:6f18) - ld a, [W_CUROPPONENT] - ld [wcf91], a - ld [wEnemyMonSpecies2], a - jr InitBattleCommon - -DetermineWildOpponent: ; 3ef23 (f:6f23) - ld a, [wd732] - bit 1, a - jr z, .asm_3ef2f - ld a, [hJoyHeld] - bit 1, a ; B button pressed? - ret nz -.asm_3ef2f - ld a, [wNumberOfNoRandomBattleStepsLeft] - and a - ret nz - callab TryDoWildEncounter - ret nz -InitBattleCommon: ; 3ef3d (f:6f3d) - ld a, [wMapPalOffset] - push af - ld hl, wLetterPrintingDelayFlags - ld a, [hl] - push af - res 1, [hl] - callab InitBattleVariables - ld a, [wEnemyMonSpecies2] - sub 200 - jp c, InitWildBattle - ld [W_TRAINERCLASS], a - call GetTrainerInformation - callab ReadTrainer - call DoBattleTransitionAndInitBattleVariables - call _LoadTrainerPic - xor a - ld [wEnemyMonSpecies2], a - ld [hStartTileID], a - dec a - ld [wAICount], a - coord hl, 12, 0 - predef CopyUncompressedPicToTilemap - ld a, $ff - ld [wEnemyMonPartyPos], a - ld a, $2 - ld [W_ISINBATTLE], a - jp _InitBattleCommon - -InitWildBattle: ; 3ef8b (f:6f8b) - ld a, $1 - ld [W_ISINBATTLE], a - call LoadEnemyMonData - call DoBattleTransitionAndInitBattleVariables - ld a, [W_CUROPPONENT] - cp MAROWAK - jr z, .isGhost - call IsGhostBattle - jr nz, .isNoGhost -.isGhost - ld hl, W_MONHSPRITEDIM - ld a, $66 - ld [hli], a ; write sprite dimensions - ld bc, GhostPic - ld a, c - ld [hli], a ; write front sprite pointer - ld [hl], b - ld hl, wEnemyMonNick ; set name to "GHOST" - ld a, "G" - ld [hli], a - ld a, "H" - ld [hli], a - ld a, "O" - ld [hli], a - ld a, "S" - ld [hli], a - ld a, "T" - ld [hli], a - ld [hl], "@" - ld a, [wcf91] - push af - ld a, MON_GHOST - ld [wcf91], a - ld de, vFrontPic - call LoadMonFrontSprite ; load ghost sprite - pop af - ld [wcf91], a - jr .spriteLoaded -.isNoGhost - ld de, vFrontPic - call LoadMonFrontSprite ; load mon sprite -.spriteLoaded - xor a - ld [W_TRAINERCLASS], a - ld [hStartTileID], a - coord hl, 12, 0 - predef CopyUncompressedPicToTilemap - -; common code that executes after init battle code specific to trainer or wild battles -_InitBattleCommon: ; 3efeb (f:6feb) - ld b, SET_PAL_BATTLE_BLACK - call RunPaletteCommand - call SlidePlayerAndEnemySilhouettesOnScreen - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld hl, .emptyString - call PrintText - call SaveScreenTilesToBuffer1 - call ClearScreen - ld a, $98 - ld [H_AUTOBGTRANSFERDEST + 1], a - ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a - call Delay3 - ld a, $9c - ld [H_AUTOBGTRANSFERDEST + 1], a - call LoadScreenTilesFromBuffer1 - coord hl, 9, 7 - lb bc, 5, 10 - call ClearScreenArea - coord hl, 1, 0 - lb bc, 4, 10 - call ClearScreenArea - call ClearSprites - ld a, [W_ISINBATTLE] - dec a ; is it a wild battle? - call z, DrawEnemyHUDAndHPBar ; draw enemy HUD and HP bar if it's a wild battle - call StartBattle - callab EndOfBattle - pop af - ld [wLetterPrintingDelayFlags], a - pop af - ld [wMapPalOffset], a - ld a, [wSavedTilesetType] - ld [hTilesetType], a - scf - ret -.emptyString - db "@" - -_LoadTrainerPic: ; 3f04b (f:704b) -; wd033-wd034 contain pointer to pic - ld a, [wTrainerPicPointer] - ld e, a - ld a, [wTrainerPicPointer + 1] - ld d, a ; de contains pointer to trainer pic - ld a, [wLinkState] - and a - ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) - jr z, .loadSprite - ld a, Bank(RedPicFront) -.loadSprite - call UncompressSpriteFromDE - ld de, vFrontPic - ld a, $77 - ld c, a - jp LoadUncompressedSpriteData - ; unreferenced ResetCryModifiers: ; 3f069 (f:7069) xor a @@ -7005,121 +6839,6 @@ ResetCryModifiers: ; 3f069 (f:7069) ld [wTempoModifier], a jp PlaySound -; animates the mon "growing" out of the pokeball -AnimateSendingOutMon: ; 3f073 (f:7073) - ld a, [wPredefRegisters] - ld h, a - ld a, [wPredefRegisters + 1] - ld l, a - ld a, [hStartTileID] - ld [hBaseTileID], a - ld b, $4c - ld a, [W_ISINBATTLE] - and a - jr z, .notInBattle - add b - ld [hl], a - call Delay3 - ld bc, -(SCREEN_WIDTH * 2 + 1) - add hl, bc - ld a, 1 - ld [wDownscaledMonSize], a - lb bc, 3, 3 - predef CopyDownscaledMonTiles - ld c, 4 - call DelayFrames - ld bc, -(SCREEN_WIDTH * 2 + 1) - add hl, bc - xor a - ld [wDownscaledMonSize], a - lb bc, 5, 5 - predef CopyDownscaledMonTiles - ld c, 5 - call DelayFrames - ld bc, -(SCREEN_WIDTH * 2 + 1) - jr .next -.notInBattle - ld bc, -(SCREEN_WIDTH * 6 + 3) -.next - add hl, bc - ld a, [hBaseTileID] - add $31 - jr CopyUncompressedPicToHL - -CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6) - ld a, [wPredefRegisters] - ld h, a - ld a, [wPredefRegisters + 1] - ld l, a - ld a, [hStartTileID] -CopyUncompressedPicToHL: ; 3f0d0 (f:70d0) - lb bc, 7, 7 - ld de, SCREEN_WIDTH - push af - ld a, [W_SPRITEFLIPPED] - and a - jr nz, .flipped - pop af -.loop - push bc - push hl -.innerLoop - ld [hl], a - add hl, de - inc a - dec c - jr nz, .innerLoop - pop hl - inc hl - pop bc - dec b - jr nz, .loop - ret - -.flipped - push bc - ld b, 0 - dec c - add hl, bc - pop bc - pop af -.flippedLoop - push bc - push hl -.flippedInnerLoop - ld [hl], a - add hl, de - inc a - dec c - jr nz, .flippedInnerLoop - pop hl - dec hl - pop bc - dec b - jr nz, .flippedLoop - ret - -LoadMonBackPic: ; 3f103 (f:7103) -; Assumes the monster's attributes have -; been loaded with GetMonHeader. - ld a, [wBattleMonSpecies2] - ld [wcf91], a - coord hl, 1, 5 - ld b, 7 - ld c, 8 - call ClearScreenArea - ld hl, W_MONHBACKSPRITE - W_MONHEADER - call UncompressMonSprite - predef ScaleSpriteByTwo - ld de, vBackPic - call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite - ld hl, vSprites - ld de, vBackPic - ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied - ld a, [H_LOADEDROMBANK] - ld b, a - jp CopyVideoData - JumpMoveEffect: ; 3f132 (f:7132) call _JumpMoveEffect ld b, $1 diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index 7345c5c1..c6a9f2b5 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -1,4 +1,4 @@ -DecrementPP: ; 68000 (1a:4000) +DecrementPP: ; f42db (3d:42db) ; after using a move, decrement pp in battle and (if not transformed?) in party ld a, [de] cp a, STRUGGLE @@ -33,7 +33,7 @@ DecrementPP: ; 68000 (1a:4000) ld a, [wPlayerMonNumber] ; which mon in party is active ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ; calculate address of the mon to modify -.DecrementPP +.DecrementPP ; f4301 (3d:4301) ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? ld c, a ld b, 0 diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index 961f25cf..d393b800 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -1,16 +1,16 @@ -GetTrainerName_: ; 13a58 (4:7a58) +GetTrainerName_: ; f67a5 (3d:67a5) ld hl, W_GRASSRATE ld a, [wLinkState] and a - jr nz, .rival + jr nz, .foundName ld hl, W_RIVALNAME ld a, [W_TRAINERCLASS] cp SONY1 - jr z, .rival + jr z, .foundName cp SONY2 - jr z, .rival + jr z, .foundName cp SONY3 - jr z, .rival + jr z, .foundName ld [wd0b5], a ld a, TRAINER_NAME ld [wNameListType], a @@ -18,6 +18,7 @@ GetTrainerName_: ; 13a58 (4:7a58) ld [wPredefBank], a call GetName ld hl, wcd6d +.foundName .rival ld de, W_TRAINERNAME ld bc, $d diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index d76f3f41..719fcf0a 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -1,7 +1,8 @@ -MarowakAnim: ; 708ca (1c:48ca) +MarowakAnim: ; 7092b (1c:492b) ; animate the ghost being unveiled as a Marowak ld a, $e4 ld [rOBP1], a + call Func_3061 call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap coord hl, 12, 0 @@ -27,6 +28,7 @@ MarowakAnim: ; 708ca (1c:48ca) sla a sla a ld [rOBP1], a + call Func_3061 jr nz, .fadeOutGhostLoop call ClearSprites call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM @@ -40,6 +42,7 @@ MarowakAnim: ; 708ca (1c:48ca) srl b rra ld [rOBP1], a + call Func_3061 ld a, b and a jr nz, .fadeInMarowakLoop @@ -49,7 +52,7 @@ MarowakAnim: ; 708ca (1c:48ca) jp ClearSprites ; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM -CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) +CopyMonPicFromBGToSpriteVRAM: ; 70994 (1c:4994) ld de, vFrontPic ld hl, vSprites ld bc, 7 * 7 @@ -74,7 +77,7 @@ CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) ld [hli], a ld a, d ld [hli], a - ld a, $10 ; use OBP1 + ld a, $14 ; use OBP1 ld [hli], a inc d dec c diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 6a4cd771..78f4ad22 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -1,4 +1,4 @@ -InitBattleVariables: ; 525af (14:65af) +InitBattleVariables: ; f6236 (3d:6236) ld a, [hTilesetType] ld [wSavedTilesetType], a xor a diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index dfb2fe35..9849cc9a 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -1,9 +1,8 @@ ; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names -DisplayLinkBattleVersusTextBox: ; 372d6 (d:72d6) +DisplayLinkBattleVersusTextBox: ; f41cf (3d:41cf) call LoadTextBoxTilePatterns coord hl, 3, 4 - ld b, $7 - ld c, $c + ld bc, $70c call TextBoxBorder coord hl, 4, 5 ld de, wPlayerName diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm index b8a783e4..e88d065a 100644 --- a/engine/battle/moveEffects/focus_energy_effect.asm +++ b/engine/battle/moveEffects/focus_energy_effect.asm @@ -1,4 +1,4 @@ -FocusEnergyEffect_: ; 27f86 (9:7f86) +FocusEnergyEffect_: ; f628b (3d:628b) ld hl, W_PLAYERBATTSTATUS2 ld a, [H_WHOSETURN] and a @@ -16,7 +16,7 @@ FocusEnergyEffect_: ; 27f86 (9:7f86) call DelayFrames jpab PrintButItFailedText_ -GettingPumpedText: ; 27fb3 (9:7fb3) +GettingPumpedText: ; f62b5 (3d:62b5) db $0a TX_FAR _GettingPumpedText db "@" diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm index cea63a1f..dbce6ebb 100644 --- a/engine/battle/moveEffects/heal_effect.asm +++ b/engine/battle/moveEffects/heal_effect.asm @@ -1,4 +1,4 @@ -HealEffect_: ; 3b9ec (e:79ec) +HealEffect_: ; f62ba (3d:62ba) ld a, [H_WHOSETURN] and a ld de, wBattleMonHP @@ -86,7 +86,7 @@ HealEffect_: ; 3b9ec (e:79ec) ld [wHPBarNewHP], a .playAnim ld hl, PlayCurrentMoveAnimation - call BankswitchEtoF + call Bankswitch3DtoF ld a, [H_WHOSETURN] and a coord hl, 10, 9 @@ -98,23 +98,23 @@ HealEffect_: ; 3b9ec (e:79ec) ld [wHPBarType], a predef UpdateHPBar2 ld hl, DrawHUDsAndHPBars - call BankswitchEtoF + call Bankswitch3DtoF ld hl, RegainedHealthText jp PrintText .failed ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF -StartedSleepingEffect: ; 3baa2 (e:7aa2) +StartedSleepingEffect: ; f6370 (3d:6370) TX_FAR _StartedSleepingEffect db "@" -FellAsleepBecameHealthyText: ; 3baa7 (e:7aa7) +FellAsleepBecameHealthyText: ; f6375 (3d:6375) TX_FAR _FellAsleepBecameHealthyText db "@" -RegainedHealthText: ; 3baac (e:7aac) +RegainedHealthText: ; f637a (3d:637a) TX_FAR _RegainedHealthText db "@" diff --git a/engine/battle/moveEffects/mist_effect.asm b/engine/battle/moveEffects/mist_effect.asm index 1f8e40b0..5d7669f8 100644 --- a/engine/battle/moveEffects/mist_effect.asm +++ b/engine/battle/moveEffects/mist_effect.asm @@ -1,4 +1,4 @@ -MistEffect_: ; 33f2b (c:7f2b) +MistEffect_: ; f64ac (3d:64ac) ld hl, W_PLAYERBATTSTATUS2 ld a, [H_WHOSETURN] and a @@ -14,6 +14,6 @@ MistEffect_: ; 33f2b (c:7f2b) .mistAlreadyInUse jpab PrintButItFailedText_ -ShroudedInMistText: ; 33f52 (c:7f52) +ShroudedInMistText: ; f64d3 (3d:64d3) TX_FAR _ShroudedInMistText db "@" diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm index 907db80c..c1dde6ff 100644 --- a/engine/battle/moveEffects/one_hit_ko_effect.asm +++ b/engine/battle/moveEffects/one_hit_ko_effect.asm @@ -1,5 +1,5 @@ -OneHitKOEffect_: ; 33f57 (c:7f57) - ld hl, W_DAMAGE +OneHitKOEffect_: ; f64db (3d:64db) + ld hl, W_DAMAGE xor a ld [hli], a ld [hl], a ; set the damage output to zero diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm index 658b0c50..3e0cf062 100644 --- a/engine/battle/moveEffects/paralyze_effect.asm +++ b/engine/battle/moveEffects/paralyze_effect.asm @@ -1,4 +1,4 @@ -ParalyzeEffect_: ; 52601 (14:6601) +ParalyzeEffect_: ; f6562 (3d:6562) ld hl, wEnemyMonStatus ld de, W_PLAYERMOVETYPE ld a, [H_WHOSETURN] diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm index 26e69ef5..2fa6b53f 100644 --- a/engine/battle/moveEffects/pay_day_effect.asm +++ b/engine/battle/moveEffects/pay_day_effect.asm @@ -1,4 +1,4 @@ -PayDayEffect_ ; 2feb8 (b:7eb8) +PayDayEffect_ ; f6511 (3d:6511) xor a ld hl, wcd6d ld [hli], a @@ -40,6 +40,6 @@ PayDayEffect_ ; 2feb8 (b:7eb8) ld hl, CoinsScatteredText jp PrintText -CoinsScatteredText: ; 2ff04 (b:7f04) +CoinsScatteredText: ; f655d (3d:655d) TX_FAR _CoinsScatteredText db "@" diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm index df34827f..ee053670 100644 --- a/engine/battle/moveEffects/reflect_light_screen_effect.asm +++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm @@ -1,4 +1,4 @@ -ReflectLightScreenEffect_: ; 3bb97 (e:7b97) +ReflectLightScreenEffect_: ; f645d (3d:645d) ld hl, W_PLAYERBATTSTATUS3 ld de, W_PLAYERMOVEEFFECT ld a, [H_WHOSETURN] @@ -23,23 +23,23 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97) .playAnim push hl ld hl, PlayCurrentMoveAnimation - call BankswitchEtoF + call Bankswitch3DtoF pop hl jp PrintText .moveFailed ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF -LightScreenProtectedText: ; 3bbd7 (e:7bd7) +LightScreenProtectedText: ; f649d (3d:649d) TX_FAR _LightScreenProtectedText db "@" -ReflectGainedArmorText: ; 3bbdc (e:7bdc) +ReflectGainedArmorText: ; f64a2 (3d:64a2) TX_FAR _ReflectGainedArmorText db "@" -BankswitchEtoF: ; 3bbe1 (e:7be1) - ld b, BANK(BattleCore) +Bankswitch3DtoF: ; f64a7 (3d:64a7) + ld b, $f ; BANK(BattleCore) jp Bankswitch diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm index 6a40eda2..fef6f7aa 100644 --- a/engine/battle/moveEffects/transform_effect.asm +++ b/engine/battle/moveEffects/transform_effect.asm @@ -1,4 +1,4 @@ -TransformEffect_: ; 3bab1 (e:7ab1) +TransformEffect_: ; f637f (3d:637f) ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies ld bc, W_ENEMYBATTSTATUS3 @@ -100,18 +100,11 @@ TransformEffect_: ; 3bab1 (e:7ab1) and a jr z, .lessThanFourMoves ld a, $5 - ld [de], a - inc de - dec b - jr nz, .copyPPLoop - jr .copyStats .lessThanFourMoves -; 0 PP for blank moves - xor a ld [de], a inc de dec b - jr nz, .lessThanFourMoves + jr nz, .copyPPLoop .copyStats ; original (unmodified) stats and stat mods pop hl @@ -141,8 +134,8 @@ TransformEffect_: ; 3bab1 (e:7ab1) .failed ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF -TransformedText: ; 3bb92 (e:7b92) +TransformedText: ; f6458 (3d:6458) TX_FAR _TransformedText db "@" diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index 6b0e2220..00627d74 100755 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -1,19 +1,19 @@ -PrintSafariZoneBattleText: ; 4277 (1:4277) +PrintSafariZoneBattleText: ; 4111 (1:4111) ld hl, wSafariBaitFactor ld a, [hl] and a - jr z, .asm_4284 + jr z, .asm_411e dec [hl] ld hl, SafariZoneEatingText - jr .asm_429f -.asm_4284 + jr .asm_4138 +.asm_411e dec hl ld a, [hl] and a ret z dec [hl] ld hl, SafariZoneAngryText - jr nz, .asm_429f + jr nz, .asm_4138 push hl ld a, [wEnemyMonSpecies] ld [wd0b5], a @@ -21,16 +21,16 @@ PrintSafariZoneBattleText: ; 4277 (1:4277) ld a, [W_MONHCATCHRATE] ld [wEnemyMonCatchRate], a pop hl -.asm_429f +.asm_4138 push hl call LoadScreenTilesFromBuffer1 pop hl jp PrintText -SafariZoneEatingText: ; 42a7 (1:42a7) +SafariZoneEatingText: ; 4141 (1:4141) TX_FAR _SafariZoneEatingText db "@" -SafariZoneAngryText: ; 42ac (1:42ac) +SafariZoneAngryText: ; 4146 (1:4146) TX_FAR _SafariZoneAngryText db "@" diff --git a/engine/battle/scroll_draw_trainer_pic.asm b/engine/battle/scroll_draw_trainer_pic.asm index 5949208c..e5e66b38 100644 --- a/engine/battle/scroll_draw_trainer_pic.asm +++ b/engine/battle/scroll_draw_trainer_pic.asm @@ -1,4 +1,4 @@ -_ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) +_ScrollTrainerPicAfterBattle: ; f4259 (e:f4259) ; Load the enemy trainer's pic and scrolls it into ; the screen from the right. xor a @@ -32,7 +32,7 @@ _ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) jr .scrollLoop ; write one 7-tile column of the trainer pic to the tilemap -DrawTrainerPicColumn: ; 39707 (e:5707) +DrawTrainerPicColumn: ; f428d (3d:428d) push hl push de push bc diff --git a/engine/battle/unused_stats_functions.asm b/engine/battle/unused_stats_functions.asm index 23ddbc20..5b2e5e0e 100644 --- a/engine/battle/unused_stats_functions.asm +++ b/engine/battle/unused_stats_functions.asm @@ -1,5 +1,5 @@ ; does nothing since no stats are ever selected (barring glitches) -DoubleSelectedStats: ; 39680 (e:5680) +DoubleSelectedStats: ; f4206 (3d:4206) ld a, [H_WHOSETURN] and a ld a, [wPlayerStatsToDouble] @@ -29,7 +29,7 @@ DoubleSelectedStats: ; 39680 (e:5680) ret ; does nothing since no stats are ever selected (barring glitches) -HalveSelectedStats: ; 396a7 (e:56a7) +HalveSelectedStats: ; f422d (3d:422d) ld a, [H_WHOSETURN] and a ld a, [wPlayerStatsToHalve] diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index fa8faebc..c2011535 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -2,12 +2,14 @@ LoadShootingStarGraphics: ; 70000 (1c:4000) ld a, $f9 ld [rOBP0], a ld a, $a4 - ld [rOBP1], a - ld de, AnimationTileset2 + $30 ; star tile (top left quadrant) + ld [rOBP1], a ; $ff49 + call Func_3040 + call Func_3061 + ld de, AnimationTileset2 ; $4757 ; star tile (top left quadrant) ld hl, vChars1 + $200 lb bc, BANK(AnimationTileset2), $01 call CopyVideoData - ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant) + ld de, AnimationTileset2 + $100 ; $481e ; star tile (bottom left quadrant) ld hl, vChars1 + $210 lb bc, BANK(AnimationTileset2), $01 call CopyVideoData @@ -24,9 +26,9 @@ LoadShootingStarGraphics: ; 70000 (1c:4000) ld bc, GameFreakShootingStarOAMDataEnd - GameFreakShootingStarOAMData jp CopyData -AnimateShootingStar: ; 70044 (1c:4044) +AnimateShootingStar: ; 7004a (1c:404a) call LoadShootingStarGraphics - ld a, SFX_SHOOTING_STAR + ld a, $c2 ; (SFX_1f_67 - SFX_Headers_1f) / 3 call PlaySound ; Move the big star down and left across the screen. @@ -37,7 +39,7 @@ AnimateShootingStar: ; 70044 (1c:4044) push bc .bigStarInnerLoop ld a, [hl] ; Y - add 4 + add 4y ld [hli], a ld a, [hl] ; X add -4 @@ -58,46 +60,46 @@ AnimateShootingStar: ; 70044 (1c:4044) .next cp b jr nz, .bigStarLoop - -; Clear big star OAM. ld hl, wOAMBuffer ld c, 4 ld de, 4 + +; Clear big star OAM. .clearOAMLoop ld [hl], 160 add hl, de dec c jr nz, .clearOAMLoop - + ; Make Gamefreak logo flash. ld b, 3 .flashLogoLoop - ld hl, rOBP0 + ld hl, rOBP0 ; $ff48 rrc [hl] rrc [hl] + call Func_3040 ld c, 10 call CheckForUserInterruption ret c dec b jr nz, .flashLogoLoop - ; Copy 24 instances of the small stars OAM data. ; Note that their coordinates put them off-screen. ld de, wOAMBuffer ld a, 24 .initSmallStarsOAMLoop push af - ld hl, SmallStarsOAM + ld hl, SmallStarsOAM ; $40ee ld bc, SmallStarsOAMEnd - SmallStarsOAM call CopyData pop af dec a jr nz, .initSmallStarsOAMLoop - + ; Animate the small stars falling from the Gamefreak logo. xor a - ld [wMoveDownSmallStarsOAMCount], a - ld hl, SmallStarsWaveCoordsPointerTable + ld [wMoveDownSmallStarsOAMCount], a ; wWhichTrade + ld hl, SmallStarsWaveCoordsPointerTable ; 1c:4105 ld c, 6 .smallStarsLoop ld a, [hli] @@ -118,6 +120,15 @@ AnimateShootingStar: ; 70044 (1c:4044) ld [hli], a ; X inc de inc hl + push bc + ld a, [de] + ld b,a + ld a, [hl] + and $f0 + or b + ld [hl], a + inc de + pop bc inc hl dec c jr nz, .smallStarsInnerLoop @@ -145,11 +156,11 @@ AnimateShootingStar: ; 70044 (1c:4044) and a ret -SmallStarsOAM: ; 700ee (1c:40ee) +SmallStarsOAM: ; 70101 (1c:4101) db $00,$00,$A2,$90 SmallStarsOAMEnd: -SmallStarsWaveCoordsPointerTable: ; 700f2 (1c:40f2) +SmallStarsWaveCoordsPointerTable: ; 70105 (1c:4105) dw SmallStarsWave1Coords dw SmallStarsWave2Coords dw SmallStarsWave3Coords @@ -160,34 +171,42 @@ SmallStarsWaveCoordsPointerTable: ; 700f2 (1c:40f2) ; The stars that fall from the Gamefreak logo come in 4 waves of 4 OAM entries. ; These arrays contain the Y and X coordinates of each OAM entry. -SmallStarsWave1Coords: ; 700fe (1c:40fe) +SmallStarsWave1Coords: ; 70111 (1c:4111) db $68,$30 - db $68,$40 + db $05,$68 + db $40,$05 db $68,$58 - db $68,$78 + db $04,$68 + db $78,$07 -SmallStarsWave2Coords: ; 70106 (1c:4106) +SmallStarsWave2Coords: ; 7011d (1c:411d) db $68,$38 - db $68,$48 + db $05,$68 + db $48,$06 db $68,$60 - db $68,$70 + db $04,$68 + db $70,$07 -SmallStarsWave3Coords: ; 7010e (1c:410e) +SmallStarsWave3Coords: ; 70129 (1c:4129) db $68,$34 - db $68,$4C + db $05,$68 + db $4c,$06 db $68,$54 - db $68,$64 + db $06,$68 + db $64,$07 -SmallStarsWave4Coords: ; 70116 (1c:4116) - db $68,$3C - db $68,$5C - db $68,$6C - db $68,$74 +SmallStarsWave4Coords: ; 70135 (1c:4135) + db $68,$3c + db $05,$68 + db $5c,$04 + db $68,$6c + db $07,$68 + db $74,$07 -SmallStarsEmptyWave: ; 7011e (1c:411e) +SmallStarsEmptyWave: ; 70141 (1c:4141) db $FF -MoveDownSmallStars: ; 7011f (1c:411f) +MoveDownSmallStars: ; 70142 (1c:4142) ld b, 8 .loop ld hl, wOAMBuffer + $5c @@ -195,17 +214,16 @@ MoveDownSmallStars: ; 7011f (1c:411f) ld de, -4 ld c, a .innerLoop - inc [hl] ; Y + inc [hl] add hl, de dec c jr nz, .innerLoop - ; Toggle the palette so that the lower star in the small stars tile blinks in ; and out. - ld a, [rOBP1] - xor %10100000 - ld [rOBP1], a - + ld a, [rOBP1] ; $ff49 + xor $10100000 + ld [rOBP1], a ; $ff49 + call Func_3061 ld c, 3 call CheckForUserInterruption ret c @@ -213,7 +231,7 @@ MoveDownSmallStars: ; 7011f (1c:411f) jr nz, .loop ret -GameFreakLogoOAMData: ; 70140 (1c:4140) +GameFreakLogoOAMData: ; 70166 (1c:4166) db $48,$50,$8D,$00 db $48,$58,$8E,$00 db $50,$50,$8F,$00 @@ -232,13 +250,13 @@ GameFreakLogoOAMData: ; 70140 (1c:4140) db $60,$78,$86,$00 GameFreakLogoOAMDataEnd: -GameFreakShootingStarOAMData: ; 70180 (1c:4180) - db $00,$A0,$A0,$10 - db $00,$A8,$A0,$30 - db $08,$A0,$A1,$10 - db $08,$A8,$A1,$30 +GameFreakShootingStarOAMData: ; 701a6 (1c:41a6) + db $00,$A0,$A0,$14 + db $00,$A8,$A0,$34 + db $08,$A0,$A1,$14 + db $08,$A8,$A1,$34 GameFreakShootingStarOAMDataEnd: -FallingStar: ; 70190 (1c:4190) +FallingStar: ; 701b6 (1c:41b6) INCBIN "gfx/falling_star.2bpp" FallingStarEnd: diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 02e2b743..410c9c33 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -1,4 +1,4 @@ -_GivePokemon: ; 4fda5 (13:7da5) +_GivePokemon: ; f66fa (3d:66fa) ; returns success in carry ; and whether the mon was added to the party in [wAddedToParty] call EnableAutoTextBoxDrawing @@ -44,6 +44,8 @@ _GivePokemon: ; 4fda5 (13:7da5) ret .addToParty call SetPokedexOwnedFlag + ld hl, UnknownTerminator_f6794 + call PrintText call AddPartyMon ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -51,7 +53,7 @@ _GivePokemon: ; 4fda5 (13:7da5) scf ret -SetPokedexOwnedFlag: ; 4fe11 (13:7e11) +SetPokedexOwnedFlag: ; f676c (3d:676c) ld a, [wcf91] push af ld [wd11e], a @@ -68,15 +70,18 @@ SetPokedexOwnedFlag: ; 4fe11 (13:7e11) ld hl, GotMonText jp PrintText -GotMonText: ; 4fe39 (13:7e39) +UnknownTerminator_f6794: ; f6794 (3d:6794) + db "@" + +GotMonText: ; f6795 (3d:6795) TX_FAR _GotMonText db $0b db "@" -SetToBoxText: ; 4fe3f (13:7e3f) +SetToBoxText: ; f679b (3d:679b) TX_FAR _SetToBoxText db "@" -BoxIsFullText: ; 4fe44 (13:7e44) +BoxIsFullText: ; f67a0 (3d:67a0) TX_FAR _BoxIsFullText db "@" diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index d95c01c5..37b56e2d 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -1,4 +1,4 @@ -AnimateHallOfFame: ; 701a0 (1c:41a0) +AnimateHallOfFame: ; 701c6 (1c:41c6) call HoFFadeOutScreenAndMusic call ClearScreen ld c, 100 @@ -33,8 +33,8 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) .skipInc ld a, $90 ld [hWY], a - ld c, BANK(Music_HallOfFame) - ld a, MUSIC_HALL_OF_FAME + ld c, $1f ; BANK(Music_HallOfFame) + ld a, $ca ; MUSIC_HALL_OF_FAME call PlayMusic ld hl, wPartySpecies ld c, $ff @@ -58,8 +58,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld c, 80 call DelayFrames coord hl, 2, 13 - ld b, $3 - ld c, $e + lb bc, $3, $e call TextBoxBorder coord hl, 4, 15 ld de, HallOfFameText @@ -77,7 +76,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld bc, HOF_MON call AddNTimes ld [hl], $ff - call SaveHallOfFameTeams + callab SaveHallOfFameTeams ; useless since in same bank xor a ld [wHoFMonSpecies], a inc a @@ -91,10 +90,10 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) res 3, [hl] ret -HallOfFameText: ; 7026b (1c:426b) +HallOfFameText: ; 70295 (1c:4295) db "HALL OF FAME@" -HoFShowMonOrPlayer: ; 70278 (1c:4278) +HoFShowMonOrPlayer: ; 702a2 (1c:42a2) call ClearScreen ld a, $d0 ld [hSCY], a @@ -122,6 +121,7 @@ HoFShowMonOrPlayer: ; 70278 (1c:4278) call RunPaletteCommand ld a, %11100100 ld [rBGP], a + call Func_3021 ld c, $31 ; back pic call HoFLoadMonPlayerPicTileIDs ld d, $a0 @@ -149,17 +149,32 @@ HoFShowMonOrPlayer: ; 70278 (1c:4278) jr nz, .ScrollPic ret -HoFDisplayAndRecordMonInfo: ; 702e1 (1c:42e1) +HoFDisplayAndRecordMonInfo: ; 7030e (1c:430e) ld a, [wHoFPartyMonIndex] - ld hl, wPartyMonNicks + ld hl, wPartyMonNicks ; wPartyMonNicks call GetPartyMonName call HoFDisplayMonInfo + ld a, [wHoFPartyMonIndex] + ld [wWhichPokemon], a + callab Func_fce18 ; 3f:4e18 + jr nc, .asm_70336 + ld e, $22 + callab Func_f0000 + jr .asm_7033c +.asm_70336 + ld a,[wHoFMonSpecies] + call PlayCry +.asm_7033c jp HoFRecordMonInfo - -HoFDisplayMonInfo: ; 702f0 (1c:42f0) - coord hl, 0, 2 - ld b, 9 - ld c, 10 + +Func_7033f: ; 7033f (1c:433f) + call HoFDisplayMonInfo + ld a,[wHoFMonSpecies] + jp PlayCry + +HoFDisplayMonInfo: ; 70348 (1c:4348) + hlCoord 0, 2 + lb bc, 9, 10 call TextBoxBorder coord hl, 2, 6 ld de, HoFMonInfoText @@ -174,22 +189,24 @@ HoFDisplayMonInfo: ; 702f0 (1c:42f0) ld [wd0b5], a coord hl, 3, 9 predef PrintMonType - ld a, [wHoFMonSpecies] - jp PlayCry + ret -HoFMonInfoText: ; 70329 (1c:4329) +HoFMonInfoText: ; 7037b (1c:437b) db "LEVEL/" next "TYPE1/" next "TYPE2/@" -HoFLoadPlayerPics: ; 7033e (1c:433e) - ld de, RedPicFront +HoFLoadPlayerPics: ; 70390 (1c:433e) + ld de, RedPicFront ; $6ede ld a, BANK(RedPicFront) call UncompressSpriteFromDE + ld a,$0 + call SwitchSRAMBankAndLatchClockData ld hl, S_SPRITEBUFFER1 ld de, S_SPRITEBUFFER0 ld bc, $310 call CopyData + call PrepareRTCDataAndDisableSRAM ld de, vFrontPic call InterlaceMergeSpriteBuffers ld de, RedPicBack @@ -200,22 +217,20 @@ HoFLoadPlayerPics: ; 7033e (1c:433e) call InterlaceMergeSpriteBuffers ld c, $1 -HoFLoadMonPlayerPicTileIDs: ; 7036d (1c:436d) -; c = base tile ID - ld b, 0 +HoFLoadMonPlayerPicTileIDs: ; 703c7 (1c:43c7) + ld b, $0 coord hl, 12, 5 predef_jump CopyTileIDsFromList -HoFDisplayPlayerStats: ; 70377 (1c:4377) - SetEvent EVENT_HALL_OF_FAME_DEX_RATING +HoFDisplayPlayerStats: ; 703d1 (1c:43d1) + ld hl, wd747 + set 3, [hl] predef DisplayDexRating - coord hl, 0, 4 - ld b, $6 - ld c, $a + hlCoord 0, 4 + lb bc, 6, 10 call TextBoxBorder - coord hl, 5, 0 - ld b, $2 - ld c, $9 + hlCoord 5, 0 + lb bc, 2, 9 call TextBoxBorder coord hl, 7, 2 ld de, wPlayerName @@ -245,26 +260,26 @@ HoFDisplayPlayerStats: ; 70377 (1c:4377) call HoFPrintTextAndDelay ld hl, wDexRatingText -HoFPrintTextAndDelay: ; 703e2 (1c:43e2) +HoFPrintTextAndDelay: ; 7043a (1c:443a) call PrintText ld c, 120 jp DelayFrames -HoFPlayTimeText: ; 703ea (1c:43ea) +HoFPlayTimeText: ; 70442 (1c:4442) db "PLAY TIME@" -HoFMoneyText: ; 703f4 (1c:43f4) +HoFMoneyText: ; 7044c (1c:444c) db "MONEY@" -DexSeenOwnedText: ; 703fa (1c:43fa) +DexSeenOwnedText: ; 70452 (1c:4452) TX_FAR _DexSeenOwnedText db "@" -DexRatingText: ; 703ff (1c:43ff) +DexRatingText: ; 70457 (1c:4457) TX_FAR _DexRatingText db "@" -HoFRecordMonInfo: ; 70404 (1c:4404) +HoFRecordMonInfo: ; 7045c (1c:445c) ld hl, wHallOfFame ld bc, HOF_MON ld a, [wHoFPartyMonIndex] @@ -279,7 +294,7 @@ HoFRecordMonInfo: ; 70404 (1c:4404) ld bc, NAME_LENGTH jp CopyData -HoFFadeOutScreenAndMusic: ; 70423 (1c:4423) +HoFFadeOutScreenAndMusic: ; 7047b (1c:447b) ld a, 10 ld [wAudioFadeOutCounterReloadValue], a ld [wAudioFadeOutCounter], a diff --git a/engine/intro.asm b/engine/intro.asm index 29aa4ef4..6d2e350c 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -441,18 +441,9 @@ FightIntroBackMon: ; 41a99 (10:5a99) FightIntroBackMonEnd: FightIntroFrontMon: ; 42099 (10:6099) - -IF DEF(_RED) - INCBIN "gfx/red/intro_nido_1.6x6.2bpp" - INCBIN "gfx/red/intro_nido_2.6x6.2bpp" - INCBIN "gfx/red/intro_nido_3.6x6.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/intro_purin_1.6x6.2bpp" - INCBIN "gfx/blue/intro_purin_2.6x6.2bpp" - INCBIN "gfx/blue/intro_purin_3.6x6.2bpp" -ENDC - + INCBIN "gfx/intro_nido_1.6x6.2bpp" + INCBIN "gfx/intro_nido_2.6x6.2bpp" + INCBIN "gfx/intro_nido_3.6x6.2bpp" FightIntroFrontMonEnd: ds $10 ; blank tile diff --git a/engine/items/items.asm b/engine/items/items.asm index f0666587..29289fd9 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -2727,31 +2727,35 @@ IsNextTileShoreOrWater: ; e8b8 (3:68b8) ld a, [W_CURMAPTILESET] ld hl, WaterTilesets ld de,1 - call IsInArray - jr nc, .notShoreOrWater + call IsInArray ; does the current map allow surfing? + ret nc ; if not, return + ld hl,WaterTile ld a, [W_CURMAPTILESET] cp SHIP_PORT ; Vermilion Dock tileset - ld a, [wTileInFrontOfPlayer] ; tile in front of player jr z, .skipShoreTiles ; if it's the Vermilion Dock tileset - cp $48 ; eastern shore tile in Safari Zone - jr z, .shoreOrWater - cp $32 ; usual eastern shore tile - jr z, .shoreOrWater + cp GYM ; eastern shore tile in Safari Zone + jr z, .skipShoreTiles + cp DOJO ; usual eastern shore tile + jr z, .skipShoreTiles + ld hl,ShoreTiles .skipShoreTiles - cp $14 ; water tile - jr z, .shoreOrWater -.notShoreOrWater - scf - ret -.shoreOrWater - and a + ld a,[wTileInFrontOfPlayer] + ld de,$1 + call IsInArray ret ; tilesets with water -WaterTilesets: ; e8e0 (3:68e0) +WaterTilesets: ; e834 (3:6834) db OVERWORLD, FOREST, DOJO, GYM, SHIP, SHIP_PORT, CAVERN, FACILITY, PLATEAU db $ff ; terminator +; shore tiles +ShoreTiles: ; e83e (3:683e) + db $48, $32 +WaterTile: ; e840 (3:6840) + db $14 + db $ff ; terminator + ReadSuperRodData: ; e8ea (3:68ea) ; return e = 2 if no fish on this map ; return e = 1 if a bite, bc = level,species @@ -2797,7 +2801,7 @@ ReadSuperRodData: ; e8ea (3:68ea) ld e, $1 ; $1 if there's a bite ret -INCLUDE "data/super_rod.asm" +;INCLUDE "data/super_rod.asm" ; reloads map view and processes sprite data ; for items that cause the overworld to be displayed diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index 6bb7f711..a3a8c608 100755 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -1,4 +1,4 @@ -GetMachinePrice: ; 7bf86 (1e:7f86) +GetMachinePrice: ; f65d4 (3d:65d4) ; Input: [wcf91] = Item Id of a TM ; Output: Stores the TM price at hItemPrice ld a, [wcf91] ; a contains TM item id diff --git a/engine/joypad.asm b/engine/joypad.asm index 31e197e2..f73d77b2 100644 --- a/engine/joypad.asm +++ b/engine/joypad.asm @@ -1,12 +1,48 @@ -_Joypad:: +ReadJoypad_:: ; c000 (3:4000) +; Poll joypad input. +; Unlike the hardware register, button +; presses are indicated by a set bit. + ld a, [hReadJoypad] + and a + ret nz + + ld a, 1 << 5 ; select direction keys + ;ld c, 0 + + ld [rJOYP], a + ld a, [rJOYP] + ld a, [rJOYP] + cpl + and %1111 + swap a + ld b, a + + ld a, 1 << 4 ; select button keys + ld [rJOYP], a + rept 6 + ld a, [rJOYP] + endr + cpl + and %1111 + or b + + ld [hJoyInput], a + + ld a, 1 << 4 + 1 << 5 ; deselect keys + ld [rJOYP], a + ret + + +_Joypad:: ; c02d (3:402d) ; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast ; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput ld a, [hJoyInput] + ld b,a + and $4F cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset jp z, TrySoftReset - ld b, a ld a, [hJoyLast] ld e, a xor b diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index e8e48b79..87595a09 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -343,9 +343,7 @@ BillsPCMenuText: ; 216e1 (8:56e1) next "DEPOSIT ", $4a next "RELEASE ", $4a next "CHANGE BOX" -IF DEF(_YELLOW) next "PRINT BOX" -ENDC next "SEE YA!" db "@" diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index a58523e8..7953b849 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -367,9 +367,7 @@ PokedexMenuItemsText: ; 402af (10:42af) db "DATA" next "CRY" next "AREA" -IF DEF(_YELLOW) next "PRNT" -ENDC next "QUIT@" ; tests if a pokemon's bit is set in the seen or owned pokemon bit fields diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 3c48e6ed..60010d9c 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -1,13 +1,11 @@ -DisplayStartMenu:: ; 2acd (0:2acd) - ld a,BANK(StartMenu_Pokedex) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a +DisplayStartMenu:: ; 29d1 (0:29d1) + switchbank StartMenu_Pokedex ; also bank for other functions ld a,[wWalkBikeSurfState] ; walking/biking/surfing ld [wWalkBikeSurfStateCopy],a - ld a, SFX_START_MENU + ld a, $8f ; (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound call PlaySound -RedisplayStartMenu:: ; 2adf (0:2adf) +RedisplayStartMenu:: ; 29e1 (0:29e1) callba DrawStartMenu callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone call UpdateSprites @@ -76,7 +74,7 @@ RedisplayStartMenu:: ; 2adf (0:2adf) jp z,StartMenu_Option ; EXIT falls through to here -CloseStartMenu:: ; 2b70 (0:2b70) +CloseStartMenu:: ; 2a72 (0:2a72) call Joypad ld a,[hJoyPressed] bit 0,a ; was A button newly pressed? diff --git a/engine/multiply_divide.asm b/engine/multiply_divide.asm index ec16c42b..7cb381b4 100755 --- a/engine/multiply_divide.asm +++ b/engine/multiply_divide.asm @@ -1,17 +1,18 @@ -_Multiply: ; 37d41 (d:7d41) +_Multiply: ; f660e (3d:660e) ld a, $8 ld b, a xor a - ld [H_PRODUCT], a - ld [H_MULTIPLYBUFFER], a - ld [H_MULTIPLYBUFFER+1], a - ld [H_MULTIPLYBUFFER+2], a - ld [H_MULTIPLYBUFFER+3], a -.loop - ld a, [H_MULTIPLIER] + ld [H_PRODUCT], a ; $ff95 + ld [H_MULTIPLYBUFFER], a ; $ff9b + ld [H_MULTIPLYBUFFER+1], a ; $ff9c + ld [H_MULTIPLYBUFFER+2], a ; $ff9d + ld [H_MULTIPLYBUFFER+3], a ; $ff9e +.multiplyLoop + ld a, [H_MULTIPLIER] ; $ff99 srl a - ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) - jr nc, .smallMultiplier + ld [H_MULTIPLIER], a ; $ff99 + jr nc, .smallMultiplier ; less than $80 +; code to possibly multiply the multiplicand by 2 and divide the multiplier by 2? ld a, [H_MULTIPLYBUFFER+3] ld c, a ld a, [H_MULTIPLICAND+2] @@ -22,14 +23,14 @@ _Multiply: ; 37d41 (d:7d41) ld a, [H_MULTIPLICAND+1] adc c ld [H_MULTIPLYBUFFER+2], a - ld a, [H_MULTIPLYBUFFER+1] + ld a, [H_MULTIPLYBUFFER+1] ; $ff9c ld c, a - ld a, [H_MULTIPLICAND] ; (aliases: H_MULTIPLICAND) + ld a, [H_MULTIPLICAND] ; $ff96 adc c - ld [H_MULTIPLYBUFFER+1], a + ld [H_MULTIPLYBUFFER+1], a ; $ff9c ld a, [H_MULTIPLYBUFFER] ld c, a - ld a, [H_PRODUCT] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_PRODUCT] ; $ff95 adc c ld [H_MULTIPLYBUFFER], a .smallMultiplier @@ -41,103 +42,107 @@ _Multiply: ; 37d41 (d:7d41) ld a, [H_MULTIPLICAND+1] rl a ld [H_MULTIPLICAND+1], a - ld a, [H_MULTIPLICAND] + ld a, [H_MULTIPLICAND] ; $ff96 rl a - ld [H_MULTIPLICAND], a - ld a, [H_PRODUCT] + ld [H_MULTIPLICAND], a ; $ff96 + ld a, [H_PRODUCT] ; $ff95 rl a - ld [H_PRODUCT], a - jr .loop + ld [H_PRODUCT], a ; $ff95 + jr .multiplyLoop .done ld a, [H_MULTIPLYBUFFER+3] ld [H_PRODUCT+3], a ld a, [H_MULTIPLYBUFFER+2] ld [H_PRODUCT+2], a + ld a, [H_MULTIPLYBUFFER+1] ; $ff9c + ld [H_PRODUCT+1], a ; $ff96 + ld a, [H_MULTIPLYBUFFER] + ld [H_PRODUCT], a ; $ff95 ld a, [H_MULTIPLYBUFFER+1] ld [H_PRODUCT+1], a ld a, [H_MULTIPLYBUFFER] ld [H_PRODUCT], a ret -_Divide: ; 37da5 (d:7da5) +_Divide: ; f6672 (3d:6672) xor a - ld [H_DIVIDEBUFFER], a - ld [H_DIVIDEBUFFER+1], a - ld [H_DIVIDEBUFFER+2], a - ld [H_DIVIDEBUFFER+3], a - ld [H_DIVIDEBUFFER+4], a + ld [H_DIVIDEBUFFER], a ; ff9a + ld [H_DIVIDEBUFFER+1], a ; ff9b + ld [H_DIVIDEBUFFER+2], a ; ff9c + ld [H_DIVIDEBUFFER+3], a ; ff9d + ld [H_DIVIDEBUFFER+4], a ; ff9e ld a, $9 ld e, a -.asm_37db3 +.asm_f6680 ld a, [H_DIVIDEBUFFER] ld c, a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) + ld a, [H_DIVIDEND+1] ; $ff96 sub c ld d, a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_DIVISOR] ; $ff99 ld c, a - ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND] ; $ff95 sbc c - jr c, .asm_37dce - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + jr c, .asm_f669b + ld [H_DIVIDEND], a ; $ff95 ld a, d - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) + ld [H_DIVIDEND+1], a ; $ff96 ld a, [H_DIVIDEBUFFER+4] inc a ld [H_DIVIDEBUFFER+4], a - jr .asm_37db3 -.asm_37dce + jr .asm_f6680 +.asm_f669b ld a, b cp $1 - jr z, .asm_37e18 + jr z, .done ld a, [H_DIVIDEBUFFER+4] sla a ld [H_DIVIDEBUFFER+4], a ld a, [H_DIVIDEBUFFER+3] rl a ld [H_DIVIDEBUFFER+3], a - ld a, [H_DIVIDEBUFFER+2] + ld a, [H_DIVIDEBUFFER+2] ; $ff9c rl a - ld [H_DIVIDEBUFFER+2], a + ld [H_DIVIDEBUFFER+2], a ; $ff9c ld a, [H_DIVIDEBUFFER+1] rl a ld [H_DIVIDEBUFFER+1], a dec e - jr nz, .asm_37e04 + jr nz, .asm_f66d1 ld a, $8 ld e, a ld a, [H_DIVIDEBUFFER] - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_DIVISOR], a ; $ff99 xor a ld [H_DIVIDEBUFFER], a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND+1] ; $ff96 + ld [H_DIVIDEND], a ; $ff95 ld a, [H_DIVIDEND+2] - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) + ld [H_DIVIDEND+1], a ; $ff96 ld a, [H_DIVIDEND+3] ld [H_DIVIDEND+2], a -.asm_37e04 +.asm_f66d1 ld a, e cp $1 - jr nz, .asm_37e0a + jr nz, .asm_f66d7 dec b -.asm_37e0a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) +.asm_f66d7 + ld a, [H_DIVISOR] ; $ff99 srl a - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_DIVISOR], a ; $ff99 ld a, [H_DIVIDEBUFFER] rr a ld [H_DIVIDEBUFFER], a - jr .asm_37db3 -.asm_37e18 - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + jr .asm_f6680 +.done + ld a, [H_DIVIDEND+1] ; $ff96 + ld [H_REMAINDER], a ; $ff99 ld a, [H_DIVIDEBUFFER+4] ld [H_QUOTIENT+3], a ld a, [H_DIVIDEBUFFER+3] ld [H_QUOTIENT+2], a - ld a, [H_DIVIDEBUFFER+2] - ld [H_QUOTIENT+1], a ; (aliases: H_MULTIPLICAND) + ld a, [H_DIVIDEBUFFER+2] ; $ff9c + ld [H_QUOTIENT+1], a ; $ff96 ld a, [H_DIVIDEBUFFER+1] - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_QUOTIENT], a ; $ff95 ret diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 673c13ad..c0349d2e 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -187,39 +187,6 @@ DisplayIntroNameTextBox: ; 6a6c (1:6a6c) .namestring ; 6aa3 (1:6aa3) db "NAME@" -IF DEF(_RED) -DefaultNamesPlayer: ; 6aa8 (1:6aa8) - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" - -DefaultNamesRival: ; 6abe (1:6abe) - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" -ENDC - -IF DEF(_BLUE) -DefaultNamesPlayer: ; 6aa8 (1:6aa8) - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" - -DefaultNamesRival: ; 6abe (1:6abe) - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" -ENDC - -IF DEF(_YELLOW) DefaultNamesPlayer: db "NEW NAME" next "YELLOW" @@ -233,7 +200,6 @@ DefaultNamesRival: next "GARY" next "JOHN" db "@" -ENDC GetDefaultName: ; 6ad6 (1:6ad6) ; a = name index @@ -258,25 +224,11 @@ GetDefaultName: ; 6ad6 (1:6ad6) ld de, wcd6d ld bc, $14 jp CopyData - -IF DEF(_RED) -DefaultNamesPlayerList: ; 6af2 (1:6af2) - db "NEW NAME@RED@ASH@JACK@" -DefaultNamesRivalList: ; 6b08 (1:6b08) - db "NEW NAME@BLUE@GARY@JOHN@" -ENDC -IF DEF(_BLUE) -DefaultNamesPlayerList: ; 6af2 (1:6af2) - db "NEW NAME@BLUE@GARY@JOHN@" -DefaultNamesRivalList: ; 6b08 (1:6b08) - db "NEW NAME@RED@ASH@JACK@" -ENDC -IF DEF(_YELLOW) + DefaultNamesPlayerList: db "NEW NAME@YELLOW@ASH@JACK@" DefaultNamesRivalList: db "NEW NAME@BLUE@GARY@JOHN@" -ENDC TextTerminator_6b20: ; 6b20 (1:6b20) db "@" diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index bf7130cb..e9310925 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -1,5 +1,5 @@ -AnimateHealingMachine: ; 70433 (1c:4433) - ld de, PokeCenterFlashingMonitorAndHealBall +AnimateHealingMachine: ; 7048b (1c:448b) + ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7 ld hl, vChars0 + $7c0 lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles call CopyVideoData @@ -11,83 +11,84 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, [rOBP1] push af ld a, $e0 - ld [rOBP1], a +<<<<<<< HEAD + ld [rOBP1], a ; $ff49 + call Func_3061 ld hl, wOAMBuffer + $84 - ld de, PokeCenterOAMData + ld de, PokeCenterOAMData ; $44d7 call CopyHealingMachineOAM ld a, 4 ld [wAudioFadeOutControl], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .waitLoop ld a, [wAudioFadeOutControl] - and a ; is fade-out finished? - jr nz, .waitLoop ; if not, check again - ld a, [wPartyCount] + and a + jr nz, .waitLoop + ld a, [wPartyCount] ; wPartyCount ld b, a .partyLoop call CopyHealingMachineOAM - ld a, SFX_HEALING_MACHINE + ld a, $9e ; (SFX_02_4a - SFX_Headers_02) / 3 call PlaySound ld c, 30 call DelayFrames dec b +<<<<<<< HEAD jr nz, .partyLoop ld a, [wAudioROMBank] - cp BANK(Audio3_UpdateMusic) + cp $1f ld [wAudioSavedROMBank], a jr nz, .next - ld a, $ff - ld [wNewSoundID], a - call PlaySound - ld a, BANK(Music_PkmnHealed) + call StopAllMusic + ld a, $2 ; BANK(Music_PkmnHealed) ld [wAudioROMBank], a .next - ld a, MUSIC_PKMN_HEALED + ld a, $e8 ; MUSIC_PKMN_HEALED ld [wNewSoundID], a call PlaySound ld d, $28 call FlashSprite8Times .waitLoop2 - ld a, [wChannelSoundIDs] - cp MUSIC_PKMN_HEALED ; is the healed music still playing? - jr z, .waitLoop2 ; if so, check gain + ld a, [wc026] + cp $e8 ; MUSIC_PKMN_HEALED + jr z, .waitLoop2 ld c, 32 call DelayFrames pop af - ld [rOBP1], a + ld [rOBP1], a ; $ff49 + call Func_3061 pop hl pop af ld [hl], a jp UpdateSprites -PokeCenterFlashingMonitorAndHealBall: ; 704b7 (1c:44b7) +PokeCenterFlashingMonitorAndHealBall: ; 7050b (1c:450b) INCBIN "gfx/pokecenter_ball.2bpp" -PokeCenterOAMData: ; 704d7 (1c:44d7) - db $24,$34,$7C,$10 ; heal machine monitor - db $2B,$30,$7D,$10 ; pokeballs 1-6 - db $2B,$38,$7D,$30 - db $30,$30,$7D,$10 - db $30,$38,$7D,$30 - db $35,$30,$7D,$10 - db $35,$38,$7D,$30 +PokeCenterOAMData: ; 7042b (1c:442b) + db $24,$34,$7C,$14 ; heal machine monitor + db $2B,$30,$7D,$14 ; pokeballs 1-6 + db $2B,$38,$7D,$34 + db $30,$30,$7D,$14 + db $30,$38,$7D,$34 + db $35,$30,$7D,$14 + db $35,$38,$7D,$34 ; d = value to xor with palette -FlashSprite8Times: ; 704f3 (1c:44f3) +FlashSprite8Times: ; 70547 (1c:4547) ld b, 8 .loop ld a, [rOBP1] xor d ld [rOBP1], a + call Func_3061 ld c, 10 call DelayFrames dec b jr nz, .loop ret -CopyHealingMachineOAM: ; 70503 (1c:4503) +CopyHealingMachineOAM: ; 7055a (1c:455a) ; copy one OAM entry and advance the pointers ld a, [de] inc de diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 33411dfc..84d67b36 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -8,7 +8,7 @@ ; fields, respectively, within loops. The X is the loop index. ; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y* ; denote fields of the sprite slots interated over in the inner loop. -InitMapSprites: ; 1785b (5:785b) +_InitMapSprites: ; 1785b (5:785b) call InitOutsideMapSprites ret c ; return if the map is an outside map (already handled by above call) ; if the map is an inside map (i.e. mapID >= $25) diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm index 41360965..ff85eb3e 100644 --- a/engine/overworld/oam.asm +++ b/engine/overworld/oam.asm @@ -187,3 +187,19 @@ GetSpriteScreenXY: ; 4bd1 (1:4bd1) and $f0 ld [de], a ; c1xb (x) ret + +_IsTilePassable:: ; 4aaa (1:4aaa) + ld hl,W_TILESETCOLLISIONPTR ; pointer to list of passable tiles + ld a,[hli] + ld h,[hl] + ld l,a ; hl now points to passable tiles +.loop + ld a,[hli] + cp a,$ff + jr z,.tileNotPassable + cp c + ret z + jr .loop +.tileNotPassable + scf + ret
\ No newline at end of file diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 74762b00..05be3d1d 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -1,4 +1,4 @@ -EnterMapAnim: ; 70510 (1c:4510) +EnterMapAnim: ; 70567 (1c:4567) call InitFacingDirectionList ld a, $ec ld [wSpriteStateData1 + 4], a ; player's sprite Y screen position @@ -9,15 +9,15 @@ EnterMapAnim: ; 70510 (1c:4510) bit 7, [hl] ; used fly out of battle? res 7, [hl] jr nz, .flyAnimation - ld a, SFX_TELEPORT_ENTER_1 + ld a, $a0 ; (SFX_02_4c - SFX_Headers_02) / 3 call PlaySound ld hl, wd732 bit 4, [hl] ; used dungeon warp? - res 4, [hl] pop hl + ;res 4, [hl] jr nz, .dungeonWarpAnimation call PlayerSpinWhileMovingDown - ld a, SFX_TELEPORT_ENTER_2 + ld a, $a3 ; (SFX_02_4f - SFX_Headers_02) / 3 call PlaySound call IsPlayerStandingOnWarpPadOrHole ld a, b @@ -34,23 +34,24 @@ EnterMapAnim: ; 70510 (1c:4510) ld [hl], $ff ; wPlayerSpinInPlaceAnimSoundID ld hl, wFacingDirectionList call PlayerSpinInPlace + ld a, $1 + ld [wd431], a .restoreDefaultMusic call PlayDefaultMusic .done + call Func_151d jp RestoreFacingDirectionAndYScreenPos .dungeonWarpAnimation ld c, 50 call DelayFrames call PlayerSpinWhileMovingDown + ld a, $0 + ld [wd431], a jr .done .flyAnimation pop hl - ld de, BirdSprite - ld hl, vNPCSprites - lb bc, BANK(BirdSprite), $0c - call CopyVideoData call LoadBirdSpriteGraphics - ld a, SFX_FLY + ld a, $a4 ; SFX_BIRD_FLY call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list @@ -61,9 +62,11 @@ EnterMapAnim: ; 70510 (1c:4510) ld de, FlyAnimationEnterScreenCoords call DoFlyAnimation call LoadPlayerSpriteGraphics + ld a, $1 + ld [wd431], a jr .restoreDefaultMusic -FlyAnimationEnterScreenCoords: ; 70592 (1c:4592) +FlyAnimationEnterScreenCoords: ; 705ed (1c:45ed) ; y, x pairs ; This is the sequence of screen coordinates used by the overworld ; Fly animation when the player is entering a map. @@ -80,7 +83,7 @@ FlyAnimationEnterScreenCoords: ; 70592 (1c:4592) db $3C, $48 db $3C, $40 -PlayerSpinWhileMovingDown: ; 705aa (1c:45aa) +PlayerSpinWhileMovingDown: ; 70605 (1c:4605) ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY ld a, $10 ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimDeltaY @@ -90,7 +93,9 @@ PlayerSpinWhileMovingDown: ; 705aa (1c:45aa) ld [hl], a ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay jp PlayerSpinWhileMovingUpOrDown -_LeaveMapAnim: ; 705ba (1c:45ba) + +_LeaveMapAnim: ; 70615 (1c:4615) + call Func_1510 call InitFacingDirectionList call IsPlayerStandingOnWarpPadOrHole ld a, b @@ -99,7 +104,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) dec a jp nz, LeaveMapThroughHoleAnim .spinWhileMovingUp - ld a, SFX_TELEPORT_EXIT_1 + ld a, $9f ; (SFX_02_4b - SFX_Headers_02) / 3 call PlaySound ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY ld a, -$10 @@ -133,7 +138,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta xor a ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue - ld [hl], SFX_TELEPORT_EXIT_2 ; wPlayerSpinInPlaceAnimSoundID + ld [hl], $a1 ; SFX_TELEPORT_EXIT_2 ld hl, wFacingDirectionList call PlayerSpinInPlace jr .spinWhileMovingUp @@ -146,7 +151,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld [hli], a ; wFlyAnimCounter ld [hl], $c ; wFlyAnimBirdSpriteImageIndex call DoFlyAnimation - ld a, SFX_FLY + ld a, $a4 ; SFX_FLY call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list @@ -167,7 +172,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) call GBFadeOutToWhite jp RestoreFacingDirectionAndYScreenPos -FlyAnimationScreenCoords1: ; 7064f (1c:464f) +FlyAnimationScreenCoords1: ; 706ad (1c:46ad) ; y, x pairs ; This is the sequence of screen coordinates used by the first part ; of the Fly overworld animation. @@ -184,7 +189,7 @@ FlyAnimationScreenCoords1: ; 7064f (1c:464f) db $2A, $98 db $27, $A0 -FlyAnimationScreenCoords2: ; 70667 (1c:4667) +FlyAnimationScreenCoords2: ; 706c5 (1c:46c5) ; y, x pairs ; This is the sequence of screen coordinates used by the second part ; of the Fly overworld animation. @@ -201,7 +206,7 @@ FlyAnimationScreenCoords2: ; 70667 (1c:4667) db $F0, $00 -LeaveMapThroughHoleAnim: ; 7067d (1c:467d) +LeaveMapThroughHoleAnim: ; 706db (1c:46db) ld a, $ff ld [wUpdateSpritesEnabled], a ; disable UpdateSprites ; shift upper half of player's sprite down 8 pixels and hide lower half @@ -223,7 +228,7 @@ LeaveMapThroughHoleAnim: ; 7067d (1c:467d) ld [wUpdateSpritesEnabled], a ; enable UpdateSprites jp RestoreFacingDirectionAndYScreenPos -DoFlyAnimation: ; 706ae (1c:46ae) +DoFlyAnimation: ; 7070c (1c:470c) ld a, [wFlyAnimBirdSpriteImageIndex] xor $1 ; make the bird flap its wings ld [wFlyAnimBirdSpriteImageIndex], a @@ -247,17 +252,19 @@ DoFlyAnimation: ; 706ae (1c:46ae) jr nz, DoFlyAnimation ret -LoadBirdSpriteGraphics: ; 706d7 (1c:46d7) - ld de, BirdSprite +LoadBirdSpriteGraphics: ; 70735 (1c:4735) + ld de, BirdSprite ; $4d80 + ld b, BANK(BirdSprite) + ld c, $c ld hl, vNPCSprites - lb bc, BANK(BirdSprite), $0c call CopyVideoData - ld de, BirdSprite + $c0 ; moving animation sprite + ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite + ld b, BANK(BirdSprite) + ld c, $0c ld hl, vNPCSprites2 - lb bc, BANK(BirdSprite), $0c jp CopyVideoData -InitFacingDirectionList: ; 706ef (1c:46ef) +InitFacingDirectionList: ; 7074f (1c:474f) ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction (image index is locked to standing images) ld [wSavedPlayerFacingDirection], a ld a, [wSpriteStateData1 + 4] ; player's sprite Y screen position @@ -276,12 +283,12 @@ InitFacingDirectionList: ; 706ef (1c:46ef) dec hl ret -PlayerSpinningFacingOrder: ; 70713 (1c:4713) +PlayerSpinningFacingOrder: ; 70773 (1c:4773) ; The order of the direction the player's sprite is facing when teleporting ; away. Creates a spinning effect. db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT -SpinPlayerSprite: ; 70717 (1c:4717) +SpinPlayerSprite: ; 70777 (1c:4777) ; copy the current value from the list into the sprite data and rotate the list ld a, [hl] ld [wSpriteStateData1 + 2], a ; player's sprite facing direction (image index is locked to standing images) @@ -295,7 +302,7 @@ SpinPlayerSprite: ; 70717 (1c:4717) pop hl ret -PlayerSpinInPlace: ; 70730 (1c:4730) +PlayerSpinInPlace: ; 70790 (1c:4790) call SpinPlayerSprite ld a, [wPlayerSpinInPlaceAnimFrameDelay] ld c, a @@ -316,7 +323,7 @@ PlayerSpinInPlace: ; 70730 (1c:4730) call DelayFrames jr PlayerSpinInPlace -PlayerSpinWhileMovingUpOrDown: ; 70755 (1c:4755) +PlayerSpinWhileMovingUpOrDown: ; 707b5 (1c:47b5) call SpinPlayerSprite ld a, [wPlayerSpinWhileMovingUpOrDownAnimDeltaY] ld c, a @@ -332,7 +339,7 @@ PlayerSpinWhileMovingUpOrDown: ; 70755 (1c:4755) call DelayFrames jr PlayerSpinWhileMovingUpOrDown -RestoreFacingDirectionAndYScreenPos: ; 70772 (1c:4772) +RestoreFacingDirectionAndYScreenPos: ; 707d2 (1c:47d2) ld a, [wSavedPlayerScreenY] ld [wSpriteStateData1 + 4], a ld a, [wSavedPlayerFacingDirection] @@ -340,14 +347,14 @@ RestoreFacingDirectionAndYScreenPos: ; 70772 (1c:4772) ret ; if SGB, 2 frames, else 3 frames -GetPlayerTeleportAnimFrameDelay: ; 7077f (1c:477f) +GetPlayerTeleportAnimFrameDelay: ; 707df (1c:47df) ld a, [wOnSGB] xor $1 inc a inc a ret -IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787) +IsPlayerStandingOnWarpPadOrHole: ; 707e7 (1c:47e7) ld b, 0 ld hl, .warpPadAndHoleData ld a, [W_CURMAPTILESET] @@ -374,21 +381,22 @@ IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787) ret ; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole] -.warpPadAndHoleData: ; 707a9 (1c:47a9) +.warpPadAndHoleData: ; 70809 (1c:4809) db FACILITY, $20, 1 ; warp pad db FACILITY, $11, 2 ; hole db CAVERN, $22, 2 ; hole db INTERIOR, $55, 1 ; warp pad db $FF -FishingAnim: ; 707b6 (1c:47b6) +FishingAnim: ; 70816 (1c:4816) ld c, 10 call DelayFrames ld hl, wd736 - set 6, [hl] ; reserve the last 4 OAM entries - ld de, RedSprite + set 6, [hl] ld hl, vNPCSprites - lb bc, BANK(RedSprite), $0c + ld de, RedSprite ; $4180 + ld b, BANK(RedSprite) + ld c, $c call CopyVideoData ld a, $4 ld hl, RedFishingTiles @@ -406,14 +414,16 @@ FishingAnim: ; 707b6 (1c:47b6) ld a, [wRodResponse] and a ld hl, NoNibbleText +<<<<<<< HEAD jr z, .done cp $2 ld hl, NothingHereText jr z, .done - + ; there was a bite ; shake the player's sprite vertically + ld b, 10 .loop ld hl, wSpriteStateData1 + 4 ; player's sprite Y screen position @@ -423,22 +433,20 @@ FishingAnim: ; 707b6 (1c:47b6) call Delay3 dec b jr nz, .loop - + ; If the player is facing up, hide the fishing rod so it doesn't overlap with ; the exclamation bubble that will be shown next. - ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction + ld a, [wSpriteStateData1 + 2] cp SPRITE_FACING_UP jr nz, .skipHidingFishingRod ld a, $a0 ld [wOAMBuffer + $9c], a - .skipHidingFishingRod ld hl, wEmotionBubbleSpriteIndex xor a ld [hli], a ; player's sprite ld [hl], a ; EXCLAMATION_BUBBLE predef EmotionBubble - ; If the player is facing up, unhide the fishing rod. ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction cp SPRITE_FACING_UP @@ -456,25 +464,25 @@ FishingAnim: ; 707b6 (1c:47b6) call LoadFontTilePatterns ret -.ShakePlayerSprite +.ShakePlayerSprite ; 708a3 (1c:48a3) ld a, [hl] xor $1 ld [hl], a ret -NoNibbleText: ; 70847 (1c:4847) +NoNibbleText: ; 708a8 (1c:48a8) TX_FAR _NoNibbleText db "@" -NothingHereText: ; 7084c (1c:484c) +NothingHereText: ; 708ad (1c:48ad) TX_FAR _NothingHereText db "@" -ItsABiteText: ; 70851 (1c:4851) +ItsABiteText: ; 708b2 (1c:48b2) TX_FAR _ItsABiteText db "@" -FishingRodOAM: ; 70856 (1c:4856) +FishingRodOAM: ; 708b7 (1c:48b7) ; specifies how the fishing rod should be drawn on the screen ; first byte = screen y coordinate ; second byte = screen x coordinate @@ -485,7 +493,7 @@ FishingRodOAM: ; 70856 (1c:4856) db $50, $40, $FE, $00 ; player facing left db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile") -RedFishingTiles: ; 70866 (1c:4866) +RedFishingTiles: ; 708c7 (1c:48c7) dw RedFishingTilesFront db 2, BANK(RedFishingTilesFront) dw vNPCSprites + $20 @@ -502,7 +510,7 @@ RedFishingTiles: ; 70866 (1c:4866) db 3, BANK(RedFishingRodTiles) dw vNPCSprites2 + $7d0 -_HandleMidJump: ; 7087e (1c:487e) +_HandleMidJump: ; 708df (1c:48df) ld a, [wPlayerJumpingYScreenCoordsIndex] ld c, a inc a @@ -534,6 +542,6 @@ _HandleMidJump: ; 7087e (1c:487e) ld [wJoyIgnore], a ret -PlayerJumpingYScreenCoords: ; 708ba (1c:48ba) +PlayerJumpingYScreenCoords: ; 7091b (1c:491b) ; Sequence of y screen coordinates for player's sprite when jumping over a ledge. db $38, $36, $34, $32, $31, $30, $30, $30, $31, $32, $33, $34, $36, $38, $3C, $3C diff --git a/engine/palettes.asm b/engine/palettes.asm index 55d488aa..080998ff 100755 --- a/engine/palettes.asm +++ b/engine/palettes.asm @@ -19,22 +19,30 @@ _RunPaletteCommand: ; 71ddf (1c:5ddf) push de jp [hl] -SetPal_BattleBlack: ; 71dff (1c:5dff) +SetPal_Black: ; 71ed3 (1c:5ed3) ld hl, PalPacket_Black ld de, BlkPacket_Battle ret ; uses PalPacket_Empty to build a packet based on mon IDs and health color -SetPal_Battle: ; 71e06 (1c:5e06) +SetPal_Battle: ; 71eda (1c:5eda) ld hl, PalPacket_Empty ld de, wPalPacket ld bc, $10 call CopyData - ld a, [W_PLAYERBATTSTATUS3] + ;ld a, [W_PLAYERBATTSTATUS3] ld hl, wBattleMonSpecies + ld a, [hl] + and a + jr z, .asm_71ef9 + ld hl, wPartyMon1 + ld a, [wPlayerMonNumber] + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes +.asm_71ef9 call DeterminePaletteID ld b, a - ld a, [W_ENEMYBATTSTATUS3] + ;ld a, [W_ENEMYBATTSTATUS3] ld hl, wEnemyMonSpecies2 call DeterminePaletteID ld c, a @@ -58,13 +66,13 @@ SetPal_Battle: ; 71e06 (1c:5e06) ld [wDefaultPaletteCommand], a ret -SetPal_TownMap: ; 71e48 (1c:5e48) +SetPal_TownMap: ; 71f26 (1c:5f26) ld hl, PalPacket_TownMap ld de, BlkPacket_WholeScreen ret ; uses PalPacket_Empty to build a packet based the mon ID -SetPal_StatusScreen: ; 71e4f (1c:5e4f) +SetPal_StatusScreen: ; 71f2d (1c:5f2d) ld hl, PalPacket_Empty ld de, wPalPacket ld bc, $10 @@ -87,12 +95,12 @@ SetPal_StatusScreen: ; 71e4f (1c:5e4f) ld de, BlkPacket_StatusScreen ret -SetPal_PartyMenu: ; 71e7b (1c:5e7b) +SetPal_PartyMenu: ; 71f59 (1c:5f59) ld hl, PalPacket_PartyMenu ld de, wPartyMenuBlkPacket ret -SetPal_Pokedex: ; 71e82 (1c:5e82) +SetPal_Pokedex: ; 71f60 (1c:5f60) ld hl, PalPacket_Pokedex ld de, wPalPacket ld bc, $10 @@ -105,28 +113,28 @@ SetPal_Pokedex: ; 71e82 (1c:5e82) ld de, BlkPacket_Pokedex ret -SetPal_Slots: ; 71e9f (1c:5e9f) +SetPal_Slots: ; 71f7d (1c:5f7d) ld hl, PalPacket_Slots ld de, BlkPacket_Slots ret -SetPal_TitleScreen: ; 71ea6 (1c:5ea6) +SetPal_Titlescreen: ; 71f84 (1c:5f84) ld hl, PalPacket_Titlescreen ld de, BlkPacket_Titlescreen ret ; used mostly for menus and the Oak intro -SetPal_Generic: ; 71ead (1c:5ead) +SetPal_Generic: ; 71f8b (1c:5f8b) ld hl, PalPacket_Generic ld de, BlkPacket_WholeScreen ret -SetPal_NidorinoIntro: ; 71eb4 (1c:5eb4) +SetPal_NidorinoIntro: ; 71f92 (1c:5f92) ld hl, PalPacket_NidorinoIntro ld de, BlkPacket_NidorinoIntro ret -SetPal_GameFreakIntro: ; 71ebb (1c:5ebb) +SetPal_GameFreakIntro: ; 71f99 (1c:5f99) ld hl, PalPacket_GameFreakIntro ld de, BlkPacket_GameFreakIntro ld a, SET_PAL_GENERIC @@ -134,7 +142,7 @@ SetPal_GameFreakIntro: ; 71ebb (1c:5ebb) ret ; uses PalPacket_Empty to build a packet based on the current map -SetPal_Overworld: ; 71ec7 (1c:5ec7) +SetPal_Overworld: ; 71fa5 (1c:5fa5) ld hl, PalPacket_Empty ld de, wPalPacket ld bc, $10 @@ -155,6 +163,10 @@ SetPal_Overworld: ; 71ec7 (1c:5ec7) jr z, .Lorelei cp BRUNOS_ROOM jr z, .caveOrBruno + cp BATTLE_CENTER + jr z,.asm_71ffd + cp TRADE_CENTER + jr z,.asm_71ffd .normalDungeonOrBuilding ld a, [wLastMap] ; town or route that current dungeon or building is located .townOrRoute @@ -178,10 +190,13 @@ SetPal_Overworld: ; 71ec7 (1c:5ec7) .Lorelei xor a jr .town - +.asm_71ffd + ld a,$18 + jr .town + ; used when a Pokemon is the only thing on the screen ; such as evolution, trading and the Hall of Fame -SetPal_PokemonWholeScreen: ; 71f17 (1c:5f17) +SetPal_PokemonWholeScreen: ; 72001 (1c:6001) push bc ld hl, PalPacket_Empty ld de, wPalPacket @@ -200,7 +215,7 @@ SetPal_PokemonWholeScreen: ; 71f17 (1c:5f17) ld de, BlkPacket_WholeScreen ret -SetPal_TrainerCard: ; 71f3b (1c:5f3b) +SetPal_TrainerCard: ; 72025 (1c:6025) ld hl, BlkPacket_TrainerCard ld de, wTrainerCardBlkPacket ld bc, $40 @@ -240,14 +255,25 @@ SetPal_TrainerCard: ; 71f3b (1c:5f3b) ld de, wTrainerCardBlkPacket ret -SetPalFunctions: ; 71f73 (1c:5f73) - dw SetPal_BattleBlack +<<<<<<< HEAD +SendUnknownPalPacket_7205d:: ; 7205d (1c:605d) + ld hl,UnknownPalPacket_72811 + ld de,BlkPacket_WholeScreen + ret + +SendUnknownPalPacket_72064:: ; 72064 (1c:6064) + ld hl,UnknownPalPacket_72821 + ld de,UnknownPacket_72751 + ret + +SetPalFunctions: ; 7206b (1c:606b) + dw SetPal_Black dw SetPal_Battle dw SetPal_TownMap dw SetPal_StatusScreen dw SetPal_Pokedex dw SetPal_Slots - dw SetPal_TitleScreen + dw SetPal_Titlescreen dw SetPal_NidorinoIntro dw SetPal_Generic dw SetPal_Overworld @@ -255,10 +281,12 @@ SetPalFunctions: ; 71f73 (1c:5f73) dw SetPal_PokemonWholeScreen dw SetPal_GameFreakIntro dw SetPal_TrainerCard + dw SendUnknownPalPacket_7205d + dw SendUnknownPalPacket_72064 ; The length of the blk data of each badge on the Trainer Card. ; The Rainbow Badge has 3 entries because of its many colors. -BadgeBlkDataLengths: ; 71f8f (1c:5f8f) +BadgeBlkDataLengths: ; 7208b (1c:608b) db 6 ; Boulder Badge db 6 ; Cascade Badge db 6 ; Thunder Badge @@ -268,12 +296,9 @@ BadgeBlkDataLengths: ; 71f8f (1c:5f8f) db 6 ; Volcano Badge db 6 ; Earth Badge -DeterminePaletteID: ; 71f97 (1c:5f97) - bit Transformed, a ; a is battle status 3 - ld a, PAL_GREYMON ; if the mon has used Transform, use Ditto's palette - ret nz +DeterminePaletteID: ; 72093 (1c:6093) ld a, [hl] -DeterminePaletteIDOutOfBattle: ; 71f9d (1c:5f9d) +DeterminePaletteIDOutOfBattle: ; 72094 (1c:6094) ld [wd11e], a and a ; is the mon index 0? jr z, .skipDexNumConversion @@ -289,13 +314,134 @@ DeterminePaletteIDOutOfBattle: ; 71f9d (1c:5f9d) ld a, [hl] ret -InitPartyMenuBlkPacket: ; 71fb6 (1c:5fb6) +<<<<<<< HEAD +Func_720ad:: ; 720ad (1c:60ad) + ld a,e + and a + jr nz,Func_720bd + ld hl,PalPacket_Generic + ld a,[hGBC] + and a + jp z,Func_721b4 + jp Func_72346 + +Func_720bd:: ; 720bd (1c:60bd) + ld hl,UnknownPalPacket_72811 + ld a,[hGBC] + and a + jp z,Func_721b4 + call Func_72346 + ld hl,PalPacket_Generic + inc hl + ld a,[hli] + call Func_723fe + ld a,e + ld [wdee4],a + ld a,d + ld [wdee5],a + xor a + call Func_7240f + ld a,$1 + call Func_72470 + ret + +Func_720e3:: ; 720e3 (1c:60e3) + ld hl,PalPacket_Empty + ld de,wcf2d + ld bc,$10 + call CopyData + call Func_7213b + ld hl,wcf2e + ld [hl],a + ld hl,wcf30 + ld a,$26 + ld [hl],a + ld hl,wcf2d + ld a,[hGBC] + and a + jr nz,.asm_72109 + call Func_721b4 + jr .asm_7210c +.asm_72109 + call Func_72346 +.asm_7210c + ld hl,BlkPacket_WholeScreen + ld de,wcf2d + ld bc,$10 + call CopyData + ld hl,wcf30 + ld a,$5 + ld [hli],a + ld a,$7 + ld [hli],a + ld a,$6 + ld [hli],a + ld a,$b + ld [hli],a + ld a,$a + ld [hl],a + ld hl,wcf2d + ld a,[hGBC] + and a + jr nz,.asm_72137 + call Func_721b4 + jr .asm_7213a +.asm_72137 + call Func_72346 +.asm_7213a + ret + +Func_7213b:: ; 7213b (1c:613b) +; similar to SetPal_Overworld + ld a, [W_CURMAPTILESET] + cp CEMETERY + jr z, .PokemonTowerOrAgatha + cp CAVERN + jr z, .caveOrBruno + ld a, [W_CURMAP] + cp REDS_HOUSE_1F + jr c, .townOrRoute + cp UNKNOWN_DUNGEON_2 + jr c, .normalDungeonOrBuilding + cp NAME_RATERS_HOUSE + jr c, .caveOrBruno + cp LORELEIS_ROOM + jr z, .Lorelei + cp BRUNOS_ROOM + jr z, .caveOrBruno + cp BATTLE_CENTER + jr z,.battleOrTradeCenter + cp TRADE_CENTER + jr z,.battleOrTradeCenter +.normalDungeonOrBuilding + ld a, [wLastMap] ; town or route that current dungeon or building is located +.townOrRoute + cp SAFFRON_CITY + 1 + jr c, .town + ld a, PAL_ROUTE - 1 +.town + inc a ; a town's pallete ID is its map ID + 1 + ret +.PokemonTowerOrAgatha + ld a, PAL_GREYMON - 1 + jr .town +.caveOrBruno + ld a, PAL_CAVE - 1 + jr .town +.Lorelei + xor a + jr .town +.battleOrTradeCenter + ld a,$18 + jr .town + +InitPartyMenuBlkPacket: ; 7217f (1c:617f) ld hl, BlkPacket_PartyMenu ld de, wPartyMenuBlkPacket ld bc, $30 jp CopyData -UpdatePartyMenuBlkPacket: ; 71fc2 (1c:5fc2) +UpdatePartyMenuBlkPacket: ; 7218b (1c:618b) ; Update the blk packet with the palette of the HP bar that is ; specified in [wWhichPartyMenuHPBar]. ld hl, wPartyMenuHPBarColors @@ -323,6 +469,17 @@ UpdatePartyMenuBlkPacket: ; 71fc2 (1c:5fc2) ld [hl], e ret +Func_721b4: ; 721b4 (1c:61b4) + ld a,$1 +; load a non-zero value in $fff9 to disable the routine that checks actual +; joypad input (said routine, located at $15f, does nothing if $fff9 is not +; zero) + ld [hReadJoypad],a + call SendSGBPacket + xor a + ld [hReadJoypad],a + ret + SendSGBPacket: ; 71feb (1c:5feb) ;check number of packets ld a,[hl] @@ -333,9 +490,6 @@ SendSGBPacket: ; 71feb (1c:5feb) .loop2 ; save B for later use push bc -; disable ReadJoypad to prevent it from interfering with sending the packet - ld a, 1 - ld [hDisableJoypadPolling], a ; send RESET signal (P14=LOW, P15=LOW) xor a ld [rJOYP],a @@ -376,10 +530,9 @@ SendSGBPacket: ; 71feb (1c:5feb) ; set P14=HIGH,P15=HIGH ld a,$30 ld [rJOYP],a - xor a - ld [hDisableJoypadPolling],a + call Wait7000 ; wait for about 70000 cycles - call Wait7000 +; call Wait7000 ; restore (previously pushed) number of packets pop bc dec b @@ -388,18 +541,21 @@ SendSGBPacket: ; 71feb (1c:5feb) ; else send 16 more bytes jr .loop2 -LoadSGB: ; 7202b (1c:602b) +LoadSGB: ; 721f8 (1c:61f8) xor a ld [wOnSGB], a call CheckSGB - ret nc - ld a, 1 - ld [wOnSGB], a - ld a, [wGBC] + jr c, .onSGB + ld a, [hGBC] and a - jr z, .notGBC + jr z, .onDMG + ld a, $1 + ld [wOnSGB], a +.onDMG ret -.notGBC +.onSGB + ld a, $1 + ld [wOnSGB], a di call PrepareSuperNintendoVRAMTransfer ei @@ -420,9 +576,9 @@ LoadSGB: ; 7202b (1c:602b) call CopyGfxToSuperNintendoVRAM call ClearVram ld hl, MaskEnCancelPacket - jp SendSGBPacket + jp Func_721b4 -PrepareSuperNintendoVRAMTransfer: ; 72075 (1c:6075) +PrepareSuperNintendoVRAMTransfer: ; 72247 (1c:6247) ld hl, .packetPointers ld c, 9 .loop @@ -431,7 +587,7 @@ PrepareSuperNintendoVRAMTransfer: ; 72075 (1c:6075) push hl ld h, [hl] ld l, a - call SendSGBPacket + call Func_721b4 pop hl inc hl pop bc @@ -439,26 +595,21 @@ PrepareSuperNintendoVRAMTransfer: ; 72075 (1c:6075) jr nz, .loop ret -.packetPointers +.packetPointers ; 7225b (1c:625b) ; Only the first packet is needed. dw MaskEnFreezePacket - dw DataSnd_72548 - dw DataSnd_72558 - dw DataSnd_72568 - dw DataSnd_72578 - dw DataSnd_72588 - dw DataSnd_72598 - dw DataSnd_725a8 - dw DataSnd_725b8 - -CheckSGB: ; 7209b (1c:609b) -; Returns whether the game is running on an SGB in carry. + dw DataSnd_728a1 + dw DataSnd_728b1 + dw DataSnd_728c1 + dw DataSnd_728d1 + dw DataSnd_728e1 + dw DataSnd_728f1 + dw DataSnd_72901 + dw DataSnd_72911 + +CheckSGB: ; 7226d (1c:626d) ld hl, MltReq2Packet - di - call SendSGBPacket - ld a, 1 - ld [hDisableJoypadPolling], a - ei + call Func_721b4 call Wait7000 ld a, [rJOYP] and $3 @@ -503,17 +654,18 @@ CheckSGB: ; 7209b (1c:609b) scf ret -SendMltReq1Packet: ; 72102 (1c:6102) +SendMltReq1Packet: ; 722ce (1c:62ce) ld hl, MltReq1Packet - call SendSGBPacket + call Func_721b4 jp Wait7000 -CopyGfxToSuperNintendoVRAM: ; 7210b (1c:610b) +CopyGfxToSuperNintendoVRAM: ; 722d7 (1c:62d7) di push de call DisableLCD ld a, $e4 - ld [rBGP], a + ld [rBGP], a ; $ff47 + call Func_72520 ld de, vChars1 ld a, [wCopyingSGBTileData] and a @@ -541,13 +693,14 @@ CopyGfxToSuperNintendoVRAM: ; 7210b (1c:610b) ld a, $e3 ld [rLCDC], a pop hl - call SendSGBPacket + call Func_721b4 xor a - ld [rBGP], a + ld [rBGP], a ; $ff47 + call Func_72520 ei ret -Wait7000: ; 7214a (1c:614a) +Wait7000: ; 7231c (1c:631c) ; Each loop takes 9 cycles so this routine actually waits 63000 cycles. ld de, 7000 .loop @@ -560,56 +713,451 @@ Wait7000: ; 7214a (1c:614a) jr nz, .loop ret -SendSGBPackets: ; 72156 (1c:6156) - ld a, [wGBC] +SendSGBPackets: ; 72328 (1c:6328) + ld a, [hGBC] and a jr z, .notGBC push de call InitGBCPalettes pop hl - call EmptyFunc5 + call InitGBCPalettes + ld a,[rLCDC] + and rLCDC_ENABLE_MASK + ret z + call Delay3 ret .notGBC push de - call SendSGBPacket + call Func_721b4 pop hl - jp SendSGBPacket + jp Func_721b4 -InitGBCPalettes: ; 7216d (1c:616d) - ld a, $80 ; index 0 with auto-increment - ld [rBGPI], a +InitGBCPalettes: ; 72346 (1c:6346) + ld a,[hl] + and $f8 + cp $20 + jp z,Func_725be inc hl - ld c, $20 -.loop - ld a, [hli] + ld a,[hli] + inc hl + push hl + call Func_723fe + ld a,e + ld [wdee2],a + ld a,d + ld [wdee3],a + + xor a + call Func_7240f + ld a,$0 + call Func_72470 + ld a,$1 + call Func_7240f + ld a,$0 + call Func_724df + ld a,$2 + call Func_7240f + ld a,$4 + call Func_724df + + pop hl + ld a,[hli] + inc hl + push hl + call Func_723fe + ld a,e + ld [wdee4],a + ld a,d + ld [wdee5],a + + xor a + call Func_7240f + ld a,$1 + call Func_72470 + ld a,$1 + call Func_7240f + ld a,$1 + call Func_724df + ld a,$2 + call Func_7240f + ld a,$5 + call Func_724df + + pop hl + ld a,[hli] + inc hl + push hl + call Func_723fe + ld a,e + ld [wdee6],a + ld a,d + ld [wdee7],a + + xor a + call Func_7240f + ld a,$2 + call Func_72470 + ld a,$1 + call Func_7240f + ld a,$2 + call Func_724df + ld a,$2 + call Func_7240f + ld a,$6 + call Func_724df + + pop hl + ld a,[hli] inc hl + call Func_723fe + ld a,e + ld [wdee8],a + ld a,d + ld [wdee9],a + + xor a + call Func_7240f + ld a,$3 + call Func_72470 + ld a,$1 + call Func_7240f + ld a,$3 + call Func_724df + ld a,$2 + call Func_7240f + ld a,$7 + call Func_724df + + ret + +Func_723fe:: ; 723fe (1c:63fe) + push hl + ld l,a + xor a + ld h,a + add hl,hl + add hl,hl + add hl,hl + ld de,Pointer_72af9 ; not exactly sure if actually super palettes + add hl,de + ld a,l + ld e,a + ld a,h + ld d,a + pop hl + ret + +Func_7240f:: ; 7240f (1c:640f) + and a + jr nz,.asm_72419 + ld a,[rBGP] + ld [wdef2],a + jr .asm_72428 +.asm_72419 + dec a + jr nz,.asm_72423 + ld a,[rOBP0] + ld [wdef3],a + jr .asm_72428 +.asm_72423 + ld a,[rOBP1] + ld [wdef4],a +.asm_72428 + ld b,a + and $3 + call Func_7246a + ld a,[hli] + ld [wdeea],a + ld a,[hl] + ld [wdeeb],a + ld a,b + rrca + rrca + ld b,a + and $3 + call Func_7246a + ld a,[hli] + ld [wdeec],a + ld a,[hl] + ld [wdeed],a + ld a,b + rrca + rrca + ld b,a + and $3 + call Func_7246a + ld a,[hli] + ld [wdeee],a + ld a,[hl] + ld [wdeef],a + ld a,b + rrca + rrca + ld b,a + and $3 + call Func_7246a + ld a,[hli] + ld [wdef0],a + ld a,[hl] + ld [wdef1],a + ret + +Func_7246a:: ; 7246a (1c:646a) add a + ld l,a + xor a + ld h,a + add hl,de + ret + +Func_72470:: ; 72470 (1c:6470) + push de add a add a - ld de, SuperPalettes - add e - jr nc, .noCarry - inc d -.noCarry - ld a, [de] - ld [rBGPD], a +<<<<<<< HEAD + add a + or $80 + ld [rBGPI],a + ld de,rBGPD + ld hl,wdeea + ld b,$2 + ld a,[rLCDC] + and rLCDC_ENABLE_MASK + jr nz,.lcdenabled + rept 4 + call Func_7251b + endr + jr .done +.lcdenabled + rept 4 + call Func_72511 + endr +.done + pop de + ret + +Func_724a2:: ; 724a2 (1c:64a2) + push de + add a + add a + add a + ld l,a + xor a + ld h,a + ld de,wdef6 + add hl,de + ld de,wdeea + ld c,$8 +.loop + ld a,[de] + ld [hli],a + inc de dec c - jr nz, .loop + jr nz,.loop + pop de ret -EmptyFunc5: ; 72187 (1c:6187) +PreparePalDataTransfer:: ; 724ba (1c:64ba) +; wait for vblank period unless LCD is disabled + ld a,[rLCDC] + and rLCDC_ENABLE_MASK + jr z,.lcddisabled + di +.waitloop + ld a,[rLY] + cp 144 + jr c,.waitloop +.lcddisabled + call TransferPalData + ei ret -CopySGBBorderTiles: ; 72188 (1c:6188) +TransferPalData: ; 724cc (1c:64cc) + xor a + or $80 + ld [rBGPI], a + ld de,rBGPD + ld hl,wdef6 + ld c,$20 +.loop + ld a,[hli] + ld [de],a + dec c + jr nz,.loop + ret + +Func_724df: ; 724df (1c:64df) + push de + add a + add a + add a + or $80 + ld [rOBPI],a + ld de,rOBPD + ld hl,wdeea + ld b,$2 ; searching oam STAT mode + ld a,[rLCDC] + and rLCDC_ENABLE_MASK + jr nz,.lcdenabled + rept 4 + call Func_7251b + endr + jr .done +.lcdenabled + rept 4 + call Func_72511 + endr +.done + pop de + ret + +Func_72511: ; 72511 (1c:6511) + ld a,[rSTAT] + and b + jr z,Func_72511 ; wait if either in hblank or vblank period +.notinhblank + ld a,[rSTAT] + and b + jr nz,.notinhblank ; wait if transferring oam or data to lcd driver +Func_7251b: ; 7251b (1c:651b) + ld a,[hli] + ld [de],a + ld a,[hli] + ld [de],a + ret + +Func_72520:: ; 72520 (1c:6520) + ld a,[hGBC] + and a + ret z +; fallthrough +Func_72524:: ; 72524 (1c:6524) + ld a,[wdee2] + ld e,a + ld a,[wdee3] + ld d,a + xor a + call Func_7240f + ld a,$0 + call Func_724a2 + ld a,[wdee4] + ld e,a + ld a,[wdee5] + ld d,a + xor a + call Func_7240f + ld a,$1 + call Func_724a2 + ld a,[wdee6] + ld e,a + ld a,[wdee7] + ld d,a + xor a + call Func_7240f + ld a,$2 + call Func_724a2 + ld a,[wdee8] + ld e,a + ld a,[wdee9] + ld d,a + xor a + call Func_7240f + ld a,$3 + call Func_724a2 + call PreparePalDataTransfer + ret + +Func_7256c:: ; 7256c (1c:656c) + ld a,[wdee2] + ld e,a + ld a,[wdee3] + ld d,a + ld a,c + call Func_7240f + ld a,c + dec a + rlca + rlca + call Func_724df + ld a,[wdee4] + ld e,a + ld a,[wdee5] + ld d,a + ld a,c + call Func_7240f + ld a,c + dec a + rlca + rlca + inc a + call Func_724df + ld a,[wdee6] + ld e,a + ld a,[wdee7] + ld d,a + ld a,c + call Func_7240f + ld a,c + dec a + rlca + rlca + add $2 + call Func_724df + ld a,[wdee8] + ld e,a + ld a,[wdee9] + ld d,a + ld a,c + call Func_7240f + ld a,c + dec a + rlca + rlca + add $3 + call Func_724df + ret + +Func_725be:: ; 725be (1c:65be) + push hl + pop de + ld hl,Pointer_725e2 + ld a,[hli] + ld c,a +.asm_725c5 + ld a,e +.loop + cp [hl] + jr z,.asm_725cf + inc hl + inc hl + dec c + jr nz,.loop + ret +.asm_725cf + inc hl + ld a,d + cp [hl] + jr z,.asm_725d9 + inc hl + dec c + jr nz,.asm_725c5 + ret +.asm_725d9 + callba Func_bf450 ; 2f:7250 + ret + +Pointer_725e2:: ; 725e2 (1c:65e2) + db $0c,$11,$66,$21,$66,$41,$66,$51,$66,$61,$66,$81,$66,$a1,$66,$2d + db $cf,$5b,$cc,$31,$67,$2c,$cf,$51,$67 + +CopySGBBorderTiles: ; 725fb (1c:65fb) ; SGB tile data is stored in a 4BPP planar format. ; Each tile is 32 bytes. The first 16 bytes contain bit planes 1 and 2, while ; the second 16 bytes contain bit planes 3 and 4. ; This function converts 2BPP planar data into this format by mapping ; 2BPP colors 0-3 to 4BPP colors 0-3. 4BPP colors 4-15 are not used. ld b, 128 - -.tileLoop - +.loop ; Copy bit planes 1 and 2 of the tile data. ld c, 16 .copyLoop @@ -632,10 +1180,11 @@ CopySGBBorderTiles: ; 72188 (1c:6188) jr nz, .tileLoop ret + ;dr $725e2,$734b9 INCLUDE "data/sgb_packets.asm" INCLUDE "data/mon_palettes.asm" INCLUDE "data/super_palettes.asm" -INCLUDE "data/sgb_border.asm" +INCLUDE "data/sgb_border.asm"
\ No newline at end of file diff --git a/engine/play_time.asm b/engine/play_time.asm deleted file mode 100755 index 74da9c59..00000000 --- a/engine/play_time.asm +++ /dev/null @@ -1,61 +0,0 @@ -TrackPlayTime: ; 18dee (6:4dee) - call CountDownIgnoreInputBitReset - ld a, [wd732] - bit 0, a - ret z - ld a, [W_PLAYTIMEMINUTES] - and a - ret nz - ld a, [W_PLAYTIMEFRAMES] - inc a - ld [W_PLAYTIMEFRAMES], a - cp 60 - ret nz - xor a - ld [W_PLAYTIMEFRAMES], a - ld a, [W_PLAYTIMESECONDS] - inc a - ld [W_PLAYTIMESECONDS], a - cp 60 - ret nz - xor a - ld [W_PLAYTIMESECONDS], a - ld a, [W_PLAYTIMEMINUTES + 1] - inc a - ld [W_PLAYTIMEMINUTES + 1], a - cp 60 - ret nz - xor a - ld [W_PLAYTIMEMINUTES + 1], a - ld a, [W_PLAYTIMEHOURS + 1] - inc a - ld [W_PLAYTIMEHOURS + 1], a - cp $ff - ret nz - ld a, $ff - ld [W_PLAYTIMEMINUTES], a - ret - -CountDownIgnoreInputBitReset: ; 18e36 (6:4e36) - ld a, [wIgnoreInputCounter] - and a - jr nz, .asm_18e40 - ld a, $ff - jr .asm_18e41 -.asm_18e40 - dec a -.asm_18e41 - ld [wIgnoreInputCounter], a - and a - ret nz - ld a, [wd730] - res 1, a - res 2, a - bit 5, a - res 5, a - ld [wd730], a - ret z - xor a - ld [hJoyPressed], a - ld [hJoyHeld], a - ret diff --git a/engine/predefs.asm b/engine/predefs.asm index 16533751..a59f70d8 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -1,4 +1,4 @@ -GetPredefPointer: +GetPredefPointer: ; f67ed (3d:67ed) ; Store the contents of the register ; pairs (hl, de, bc) at wPredefRegisters. ; Then put the bank and address of predef @@ -27,10 +27,10 @@ GetPredefPointer: add a add e ld e,a - jr nc,.next + jr nc,.nocarry inc d -.next +.nocarry add hl,de ld d,h ld e,l @@ -49,105 +49,106 @@ GetPredefPointer: ret -PredefPointers:: ; 4fe79 (13:7e79) +PredefPointers:: ; f681d (3d:681d) ; these are pointers to ASM routines. ; they appear to be used in overworld map scripts. - add_predef DrawPlayerHUDAndHPBar - add_predef CopyUncompressedPicToTilemap - add_predef AnimateSendingOutMon - add_predef ScaleSpriteByTwo - add_predef LoadMonBackPic - add_predef CopyDownscaledMonTiles - add_predef LoadMissableObjects - add_predef HealParty - add_predef MoveAnimation; 08 play move animation - add_predef DivideBCDPredef - add_predef DivideBCDPredef2 - add_predef AddBCDPredef - add_predef SubBCDPredef - add_predef DivideBCDPredef3 - add_predef DivideBCDPredef4 - add_predef InitPlayerData - add_predef FlagActionPredef - add_predef HideObject - add_predef IsObjectHidden - add_predef ApplyOutOfBattlePoisonDamage - add_predef AnyPartyAlive - add_predef ShowObject - add_predef ShowObject2 - add_predef ReplaceTileBlock - add_predef InitPlayerData2 - add_predef LoadTilesetHeader - add_predef LearnMoveFromLevelUp - add_predef LearnMove - add_predef GetQuantityOfItemInBag - dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 - dbw $03,GiveItem - add_predef ChangeBGPalColor0_4Frames - add_predef FindPathToPlayer - add_predef PredefShakeScreenVertically - add_predef CalcPositionOfPlayerRelativeToNPC - add_predef ConvertNPCMovementDirectionsToJoypadMasks - add_predef PredefShakeScreenHorizontally - add_predef UpdateHPBar - add_predef HPBarLength - add_predef Diploma_TextBoxBorder - add_predef DoubleOrHalveSelectedStats - add_predef ShowPokedexMenu - add_predef EvolutionAfterBattle - add_predef SaveSAVtoSRAM0 - add_predef InitOpponent - add_predef CableClub_Run - add_predef DrawBadges - add_predef ExternalClockTradeAnim - add_predef BattleTransition - add_predef CopyTileIDsFromList - add_predef PlayIntro - add_predef GetMoveSoundB - add_predef FlashScreen - add_predef GetTileAndCoordsInFrontOfPlayer - add_predef StatusScreen - add_predef StatusScreen2 - add_predef InternalClockTradeAnim - add_predef TrainerEngage - add_predef IndexToPokedex - add_predef DisplayPicCenteredOrUpperRight - add_predef UsedCut - add_predef ShowPokedexData - add_predef WriteMonMoves - add_predef SaveSAV - add_predef LoadSGB - add_predef MarkTownVisitedAndLoadMissableObjects - add_predef SetPartyMonTypes - add_predef CanLearnTM - add_predef TMToMove - add_predef _RunPaletteCommand - add_predef StarterDex ; 46 - add_predef _AddPartyMon - add_predef UpdateHPBar2 - add_predef DrawEnemyHUDAndHPBar - add_predef LoadTownMap_Nest - add_predef PrintMonType - add_predef EmotionBubble - add_predef EmptyFunc3; return immediately - add_predef AskName - add_predef PewterGuys - add_predef SaveSAVtoSRAM2 - add_predef LoadSAV2 - add_predef LoadSAV - add_predef SaveSAVtoSRAM1 - add_predef DoInGameTradeDialogue - add_predef HallOfFamePC - add_predef DisplayDexRating - dbw $1E, _LeaveMapAnim ; wrong bank - dbw $1E, EnterMapAnim ; wrong bank - add_predef GetTileTwoStepsInFrontOfPlayer - add_predef CheckForCollisionWhenPushingBoulder - add_predef PrintStrengthTxt - add_predef PickUpItem - add_predef PrintMoveType - add_predef LoadMovePPs - add_predef DrawHP ; 5F - add_predef DrawHP2 - add_predef DisplayElevatorFloorMenu - add_predef OaksAideScript + dr $f681d,$f8000 + ;add_predef DrawPlayerHUDAndHPBar + ;add_predef Func_3f0c6 + ;add_predef Func_3f073 + ;add_predef ScaleSpriteByTwo + ;add_predef LoadMonBackPic + ;add_predef Func_79aba + ;add_predef LoadMissableObjects + ;add_predef HealParty + ;add_predef MoveAnimation; 08 play move animation + ;add_predef DivideBCDPredef + ;add_predef DivideBCDPredef2 + ;add_predef AddBCDPredef + ;add_predef SubBCDPredef + ;add_predef DivideBCDPredef3 + ;add_predef DivideBCDPredef4 + ;add_predef InitPlayerData + ;add_predef FlagActionPredef + ;add_predef HideObject + ;add_predef IsObjectHidden + ;add_predef ApplyOutOfBattlePoisonDamage + ;add_predef AnyPartyAlive + ;add_predef ShowObject + ;add_predef ShowObject2 + ;add_predef ReplaceTileBlock + ;add_predef InitPlayerData2 + ;add_predef LoadTilesetHeader + ;add_predef LearnMoveFromLevelUp + ;add_predef LearnMove + ;add_predef IsItemInBag_ + ;dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 + ;dbw $03,GiveItem + ;add_predef ChangeBGPalColor0_4Frames + ;add_predef FindPathToPlayer + ;add_predef Func_480ff + ;add_predef CalcPositionOfPlayerRelativeToNPC + ;add_predef ConvertNPCMovementDirectionsToJoypadMasks + ;add_predef Func_48125 + ;add_predef UpdateHPBar + ;add_predef HPBarLength + ;add_predef Diploma_TextBoxBorder + ;add_predef DoubleOrHalveSelectedStats + ;add_predef ShowPokedexMenu + ;add_predef EvolutionAfterBattle + ;add_predef SaveSAVtoSRAM0 + ;add_predef InitOpponent + ;add_predef CableClub_Run + ;add_predef DrawBadges + ;add_predef ExternalClockTradeAnim + ;add_predef BattleTransition + ;add_predef CopyTileIDsFromList + ;add_predef PlayIntro + ;add_predef Func_79869 + ;add_predef FlashScreen + ;add_predef GetTileAndCoordsInFrontOfPlayer + ;add_predef StatusScreen + ;add_predef StatusScreen2 + ;add_predef InternalClockTradeAnim + ;add_predef TrainerEngage + ;add_predef IndexToPokedex + ;add_predef Predef3B; 3B display pic? + ;add_predef UsedCut + ;add_predef ShowPokedexData + ;add_predef WriteMonMoves + ;add_predef SaveSAV + ;add_predef LoadSGB + ;add_predef MarkTownVisitedAndLoadMissableObjects + ;add_predef SetPartyMonTypes + ;add_predef CanLearnTM + ;add_predef TMToMove + ;add_predef Func_71ddf + ;add_predef StarterDex ; 46 + ;add_predef _AddPartyMon + ;add_predef UpdateHPBar2 + ;add_predef DrawEnemyHUDAndHPBar + ;add_predef LoadTownMap_Nest + ;add_predef PrintMonType + ;add_predef EmotionBubble; 4C player exclamation + ;add_predef EmptyFunc3; return immediately + ;add_predef AskName + ;add_predef PewterGuys + ;add_predef SaveSAVtoSRAM2 + ;add_predef LoadSAVCheckSum2 + ;add_predef LoadSAV + ;add_predef SaveSAVtoSRAM1 + ;add_predef DoInGameTradeDialogue ; 54 initiate trade + ;add_predef HallOfFamePC + ;add_predef DisplayDexRating + ;dbw $1E, _LeaveMapAnim ; wrong bank + ;dbw $1E, EnterMapAnim ; wrong bank + ;add_predef GetTileTwoStepsInFrontOfPlayer + ;add_predef CheckForCollisionWhenPushingBoulder + ;add_predef PrintStrengthTxt + ;add_predef PickupItem + ;add_predef PrintMoveType + ;add_predef LoadMovePPs + ;add_predef DrawHP ; 5F + ;add_predef DrawHP2 + ;add_predef Func_1c9c6 + ;add_predef OaksAideScript
\ No newline at end of file diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 78ce35a2..0b72d7e5 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -882,12 +882,4 @@ SlotMachineMap: ; 378f5 (d:78f5) INCLUDE "data/slot_machine_wheels.asm" SlotMachineTiles1: ; 37a51 (d:7a51) -IF DEF(_RED) - INCBIN "gfx/red/slotmachine1.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/slotmachine1.2bpp" -ENDC -IF DEF(_YELLOW) - INCBIN "gfx/yellow/slotmachine1.2bpp" -ENDC + INCBIN "gfx/slotmachine1.2bpp" diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index b0bf0fb6..8d605c49 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -55,8 +55,8 @@ DisplayTitleScreen: ; 42dd (1:42dd) ld bc, $100 ld a, BANK(PokemonLogoGraphics) call FarCopyData2 ; second chunk - ld hl, Version_GFX - ld de,vChars2 + $600 - (Version_GFXEnd - Version_GFX - $50) + ld hl, Version_GFX ; $402f + ld de,vChars2 + $600 ld bc, Version_GFXEnd - Version_GFX ld a, BANK(Version_GFX) call FarCopyDataDouble @@ -117,12 +117,7 @@ DisplayTitleScreen: ; 42dd (1:42dd) call SaveScreenTilesToBuffer2 call LoadScreenTilesFromBuffer2 call EnableLCD -IF DEF(_RED) ld a,CHARMANDER ; which Pokemon to show first on the title screen -ENDC -IF DEF(_BLUE) - ld a,SQUIRTLE ; which Pokemon to show first on the title screen -ENDC ld [wTitleMonSpecies], a call LoadTitleMonSprite @@ -392,9 +387,4 @@ PrintGameVersionOnTitleScreen: ; 4598 (1:4598) ; these point to special tiles specifically loaded for that purpose and are not usual text VersionOnTitleScreenText: ; 45a1 (1:45a1) -IF DEF(_RED) db $60,$61,$7F,$65,$66,$67,$68,$69,"@" ; "Red Version" -ENDC -IF DEF(_BLUE) - db $61,$62,$63,$64,$65,$66,$67,$68,"@" ; "Blue Version" -ENDC diff --git a/engine/town_map.asm b/engine/town_map.asm index 225de2b8..ee282b49 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -1,4 +1,4 @@ -DisplayTownMap: ; 70e3e (1c:4e3e) +DisplayTownMap: ; 70eb7 (1c:4eb7) call LoadTownMap ld hl, wUpdateSpritesEnabled ld a, [hl] @@ -27,7 +27,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) pop af jr .enterLoop -.townMapLoop +.townMapLoop ; 70ef4 (1c:4ef4) coord hl, 0, 0 lb bc, 1, 20 call ClearScreenArea @@ -37,7 +37,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld b, 0 add hl, bc ld a, [hl] -.enterLoop +.enterLoop ; 70f08 (1c:4f08) ld de, wTownMapCoords call LoadTownMapEntry ld a, [de] @@ -69,7 +69,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld b, a and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - ld a, SFX_TINK + ld a, $8c call PlaySound bit 6, b jr nz, .pressedUp @@ -84,6 +84,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) pop af ld [hl], a ret + .pressedUp ld a, [wWhichTownMapLocation] inc a @@ -103,13 +104,20 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld [wWhichTownMapLocation], a jp .townMapLoop +.asm_70f87 + ld a,[hJoy5] + and D_DOWN | D_UP + ret z + callab Func_f0000 + ret + INCLUDE "data/town_map_order.asm" -TownMapCursor: ; 70f40 (1c:4f40) +TownMapCursor: ; 70fc4 (1c:4fc4) INCBIN "gfx/town_map_cursor.1bpp" TownMapCursorEnd: -LoadTownMap_Nest: ; 70f60 (1c:4f60) +LoadTownMap_Nest: ; 70fe4 (1c:4fe4) call LoadTownMap ld hl, wUpdateSpritesEnabled ld a, [hl] @@ -131,17 +139,20 @@ LoadTownMap_Nest: ; 70f60 (1c:4f60) ld [hl], a ret -MonsNestText: ; 70f89 (1c:4f89) +MonsNestText: ; 7100d (1c:500d) db "'s NEST@" -LoadTownMap_Fly: ; 70f90 (1c:4f90) +LoadTownMap_Fly: ; 71014 (1c:5014) call ClearSprites call LoadTownMap + ld a, $1 + ld [hJoy7], a call LoadPlayerSpriteGraphics call LoadFontTilePatterns - ld de, BirdSprite + ld de, BirdSprite ; $4d80 + ld b, BANK(BirdSprite) + ld c, $c ld hl, vSprites + $40 - lb bc, BANK(BirdSprite), $0c call CopyVideoData ld de, TownMapUpArrow ld hl, vChars1 + $6d0 @@ -179,7 +190,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld c, 15 call DelayFrames coord hl, 18, 0 - ld [hl], $ed + ld [hl], "▶" coord hl, 19, 0 ld [hl], $ee pop hl @@ -194,7 +205,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) jr z, .inputLoop bit 0, b jr nz, .pressedA - ld a, SFX_TINK + ld a, $8c ; SFX_TINK call PlaySound bit 6, b jr nz, .pressedUp @@ -202,7 +213,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) jr nz, .pressedDown jr .pressedB .pressedA - ld a, SFX_HEAL_AILMENT + ld a, $8e ; SFX_HEAL_AILMENT call PlaySound ld a, [hl] ld [wDestinationMap], a @@ -213,6 +224,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) .pressedB xor a ld [wTownMapSpriteBlinkingEnabled], a + ld [hJoy7], a call GBPalWhiteOutWithDelay3 pop hl pop af @@ -243,10 +255,10 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld hl, wFlyLocationsList + 11 jr .pressedDown -ToText: ; 7106d (1c:506d) +ToText: ; 710f8 (1c:50f8) db "To@" -BuildFlyLocationsList: ; 71070 (1c:5070) +BuildFlyLocationsList: ; 710fb (1c:50fb) ld hl, wFlyLocationsList - 1 ld [hl], $ff inc hl @@ -270,25 +282,24 @@ BuildFlyLocationsList: ; 71070 (1c:5070) ld [hl], $ff ret -TownMapUpArrow: ; 71093 (1c:5093) +TownMapUpArrow: ; 7111e (1c:511e) INCBIN "gfx/up_arrow.1bpp" TownMapUpArrowEnd: -LoadTownMap: ; 7109b (1c:509b) +LoadTownMap: ; 71126 (1c:5126) call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites coord hl, 0, 0 - ld b, $12 - ld c, $12 + lb bc, $12, $12 call TextBoxBorder call DisableLCD ld hl, WorldMapTileGraphics ld de, vChars2 + $600 ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics ld a, BANK(WorldMapTileGraphics) - call FarCopyData2 - ld hl, MonNestIcon + call FarCopyData + ld hl, MonNestIcon ; $574b ld de, vSprites + $40 ld bc, MonNestIconEnd - MonNestIcon ld a, BANK(MonNestIcon) @@ -324,11 +335,11 @@ LoadTownMap: ; 7109b (1c:509b) ld [wTownMapSpriteBlinkingEnabled], a ret -CompressedMap: ; 71100 (1c:5100) +CompressedMap: ; 7118a (1c:518a) ; you can decompress this file with the redrle program in the extras/ dir INCBIN "gfx/town_map.rle" -ExitTownMap: ; 711ab (1c:51ab) +ExitTownMap: ; 71235 (1c:5235) ; clear town map graphics data and load usual graphics data xor a ld [wTownMapSpriteBlinkingEnabled], a @@ -340,7 +351,7 @@ ExitTownMap: ; 711ab (1c:51ab) call UpdateSprites jp RunDefaultPaletteCommand -DrawPlayerOrBirdSprite: ; 711c4 (1c:51c4) +DrawPlayerOrBirdSprite: ; 7124e (1c:524e) ; a = map number ; b = OAM base tile push af @@ -355,18 +366,19 @@ DrawPlayerOrBirdSprite: ; 711c4 (1c:51c4) call WritePlayerOrBirdSpriteOAM pop hl ld de, wcd6d -.asm_711dc +.asm_71266 ld a, [hli] ld [de], a inc de - cp $50 - jr nz, .asm_711dc + cp "@" + jr nz, .asm_71266 ld hl, wOAMBuffer ld de, wTileMapBackup ld bc, $a0 jp CopyData -DisplayWildLocations: ; 711ef (1c:51ef) +<<<<<<< HEAD +DisplayWildLocations: ; 71279 (1c:5279) callba FindWildLocationsOfMon call ZeroOutDuplicatesInList ld hl, wOAMBuffer @@ -397,8 +409,7 @@ DisplayWildLocations: ; 711ef (1c:51ef) jr nz, .drawPlayerSprite ; if no OAM entries were written, print area unknown text coord hl, 1, 7 - ld b, $2 - ld c, $f + lb bc, $20f call TextBoxBorder coord hl, 2, 9 ld de, AreaUnknownText @@ -414,10 +425,10 @@ DisplayWildLocations: ; 711ef (1c:51ef) ld bc, $a0 jp CopyData -AreaUnknownText: ; 7124a (1c:524a) +AreaUnknownText: ; 712d3 (1c:52d3) db " AREA UNKNOWN@" -TownMapCoordsToOAMCoords: ; 71258 (1c:5258) +TownMapCoordsToOAMCoords: ; 712e1 (1c:52e1) ; in: lower nybble of a = x, upper nybble of a = y ; out: b and [hl] = (y * 8) + 24, c and [hl+1] = (x * 8) + 24 push af @@ -435,14 +446,14 @@ TownMapCoordsToOAMCoords: ; 71258 (1c:5258) ld [hli], a ret -WritePlayerOrBirdSpriteOAM: ; 7126d (1c:526d) +WritePlayerOrBirdSpriteOAM: ; 712f6 (1c:52f6) ld a, [wOAMBaseTile] and a ld hl, wOAMBuffer + $90 ; for player sprite jr z, WriteTownMapSpriteOAM ld hl, wOAMBuffer + $80 ; for bird sprite -WriteTownMapSpriteOAM: ; 71279 (1c:5279) +WriteTownMapSpriteOAM: ; 71302 (1c:5302) push hl lb hl, -4, -4 add hl, bc ; subtract 4 from c (X coord) and 4 from b (Y coord) @@ -450,8 +461,8 @@ WriteTownMapSpriteOAM: ; 71279 (1c:5279) ld c, l pop hl -WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281) -; Writes 4 OAM blocks for a helix mon party sprite, since it does not have +WriteAsymmetricMonPartySpriteOAM: ; 7130a (1c:530a) +; Writes 4 OAM blocks for a helix mon party sprite, since is does not have ; a vertical line of symmetry. lb de, 2, 2 .loop @@ -483,7 +494,7 @@ WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281) jr nz, .loop ret -WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6) +WriteSymmetricMonPartySpriteOAM: ; 7132f (1c:532f) ; Writes 4 OAM blocks for a mon party sprite other than a helix. All the ; sprites other than the helix one have a vertical line of symmetry which allows ; the X-flip OAM bit to be used so that only 2 rather than 4 tile patterns are @@ -525,7 +536,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6) jr nz, .loop ret -ZeroOutDuplicatesInList: ; 712d9 (1c:52d9) +ZeroOutDuplicatesInList: ; 71362 (1c:5362) ; replace duplicate bytes in the list of wild pokemon locations with 0 ld de, wBuffer .loop @@ -548,7 +559,7 @@ ZeroOutDuplicatesInList: ; 712d9 (1c:52d9) inc hl jr .zeroDuplicatesLoop -LoadTownMapEntry: ; 712f1 (1c:52f1) +LoadTownMapEntry: ; 7137a (1c:537a) ; in: a = map number ; out: lower nybble of [de] = x, upper nybble of [de] = y, hl = address of name cp REDS_HOUSE_1F @@ -577,16 +588,21 @@ LoadTownMapEntry: ; 712f1 (1c:52f1) ld h, [hl] ld l, a ret + +ExternalMapEntries: ; 7139c (1c:539c) + dr $7139c,$7140b +InternalMapEntries: ; 7140b (1c:540b) + dr $7140b,$7174b + +;INCLUDE "data/town_map_entries.asm" -INCLUDE "data/town_map_entries.asm" - -INCLUDE "text/map_names.asm" +;INCLUDE "text/map_names.asm" ; TODO: relabel addresses -MonNestIcon: ; 716be (1c:56be) +MonNestIcon: ; 7174b (1c:574b) INCBIN "gfx/mon_nest_icon.1bpp" MonNestIconEnd: -TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6) +TownMapSpriteBlinkingAnimation: ; 71753 (1c:5753) ld a, [wAnimCounter] inc a cp 25 |