From 96a58ce52ac4b8c4c8b2ecbf0f185d1ebda10a6e Mon Sep 17 00:00:00 2001 From: pikalaxalt Date: Mon, 6 Jun 2016 12:09:36 -0400 Subject: Split out pikachu engine functions; sprite state data macros --- engine/pikachu_emotions.asm | 674 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100755 engine/pikachu_emotions.asm (limited to 'engine/pikachu_emotions.asm') diff --git a/engine/pikachu_emotions.asm b/engine/pikachu_emotions.asm new file mode 100755 index 00000000..fdfb7813 --- /dev/null +++ b/engine/pikachu_emotions.asm @@ -0,0 +1,674 @@ +IsPlayerTalkingToPikachu:: ; fcf0c (3f:4f0c) + ld a, [wd436] + and a + ret z + ld a, [hSpriteIndexOrTextID] + cp $f + ret nz + call InitializePikachuTextID + xor a + ld [hSpriteIndexOrTextID], a + ld [wd436], a + ret + +InitializePikachuTextID: ; fcf20 (3f:4f20) + ld a, $d4 ; display + ld [hSpriteIndexOrTextID], a + xor a + ld [wPlayerMovingDirection], a + ld a, $1 + ld [wAutoTextBoxDrawingControl], a + call DisplayTextID + xor a + ld [wAutoTextBoxDrawingControl], a + ret + +DoStarterPikachuEmotions: ; fcf35 (3f:4f35) + ld e, a + ld d, $0 + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] +.loop + ld a, [de] + inc de + cp $ff + jr z, .done + ld c, a + ld b, $0 + ld hl, StarterPikachuEmotionsJumptable + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + jr .loop +.done + ret + +StarterPikachuEmotionsJumptable: ; fcf54 (3f:4f54) + dw StarterPikachuEmotionCommand_nop ; 0 + dw StarterPikachuEmotionCommand_text ; 1 + dw StarterPikachuEmotionCommand_pcm ; 2 + dw StarterPikachuEmotionCommand_emote ; 3 + dw StarterPikachuEmotionCommand_movement ; 4 + dw StarterPikachuEmotionCommand_pikapic ; 5 + dw StarterPikachuEmotionCommand_subcmd ; 6 + dw StarterPikachuEmotionCommand_delay ; 7 + dw StarterPikachuEmotionCommand_nop2 ; 8 + dw StarterPikachuEmotionCommand_9 ; 9 + dw StarterPikachuEmotionCommand_nop3 ; a + +StarterPikachuEmotionCommand_nop: ; fcf6a (3f:4f6a) +StarterPikachuEmotionCommand_nop3: ; fcf6a (3f:4f6a) + ret + +StarterPikachuEmotionCommand_text: ; fcf6b (3f:4f6b) + ld a, [de] + ld l, a + inc de + ld a, [de] + ld h, a + inc de + push de + call PrintText + pop de + ret + +StarterPikachuEmotionCommand_pcm: ; fcf77 (3f:4f77) + ld a, [de] + inc de + push de + ld e, a + nop + call PlayPikachuSoundClip_ + pop de + ret + +PlayPikachuSoundClip_: ; fcf81 (3f:4f81) + cp $ff + ret z + callab PlayPikachuSoundClip + ret + +StarterPikachuEmotionCommand_emote: ; fcf8d (3f:4f8d) + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, [de] + inc de + push de + call ShowPikachuEmoteBubble + pop de + pop af + ld [wUpdateSpritesEnabled], a + ret + +ShowPikachuEmoteBubble: ; fcfa2 (3f:4fa2) + ld [wWhichEmotionBubble], a + ld a, $f + ld [wEmotionBubbleSpriteIndex], a + predef EmotionBubble + ret + +StarterPikachuEmotionCommand_movement: ; fcfb0 (3f:4fb0) + ld a, [de] + inc de + ld l, a + ld a, [de] + inc de + ld h, a + push de + ld b, BANK(DoStarterPikachuEmotions) + call ApplyPikachuMovementData_ + pop de + ret + +StarterPikachuEmotionCommand_delay: ; fcfbe (3f:4fbe) + ld a, [de] + inc de + push de + ld c, a + call DelayFrames + pop de + ret + +StarterPikachuEmotionCommand_subcmd: ; fcfc7 (3f:4fc7) + ld a, [de] + inc de + push de + ld e, a + ld d, $0 + ld hl, Jumptable_fcfda + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + pop de + ret + +Jumptable_fcfda: + dw LoadPikachuSpriteIntoVRAM + dw LoadFontTilePatterns + dw Pikachu_LoadCurrentMapViewUpdateSpritesAndDelay3 + dw WaitForTextScrollButtonPress + dw PikachuPewterPokecenterCheck + dw PikachuFanClubCheck + dw PikachuBillsHouseCheck + +StarterPikachuEmotionCommand_nop2: ; fcfe8 (3f:4fe8) + ret + +StarterPikachuEmotionCommand_9: ; fcfe9 (3f:4fe9) + push de + call StarterPikachuEmotionCommand_turnawayfromplayer + call UpdateSprites + pop de + ret + +StarterPikachuEmotionCommand_turnawayfromplayer: ; fcff2 (3f:4ff2) + ld a, [wPlayerFacingDirection] + xor $4 + ld [wPikachuFacingDirection], a + ret + +DeletedFunction_fcffb: ; fcffb (3f:4ffb) +; Inexplicably empty. + rept 5 + nop + endr + ret + +Func_fd001:: ; fd001 (3f:5001) + ld a, e + jr load_expression + +Func_fd004:: ; fd004 (3f:5004) + call MapSpecificPikachuExpression + jr c, load_expression + call GetPikaPicAnimationScriptIndex + call DeletedFunction_fcffb +load_expression: ; fd00f (3f:500f) + ld [wExpressionNumber], a + ld hl, PikachuEmotionTable + call DoStarterPikachuEmotions + ret + +PikachuEmotionTable: ; fd019 (3f:4019) + dw PikachuEmotion0_fd115 + dw PikachuEmotion1_fd141 + dw PikachuEmotion2_fd116 + dw PikachuEmotion3_fd160 + dw PikachuEmotion4_fd136 + dw PikachuEmotion5_fd14d + dw PikachuEmotion6_fd153 + dw PikachuEmotion7_fd128 + dw PikachuEmotion8_fd147 + dw PikachuEmotion9_fd166 + dw PikachuEmotion10_fd11e + dw PikachuEmotion11_fd173 + dw PikachuEmotion12_fd17a + dw PikachuEmotion13_fd180 + dw PikachuEmotion14_fd189 + dw PikachuEmotion15_fd191 + dw PikachuEmotion16_fd197 + dw PikachuEmotion17_fd19d + dw PikachuEmotion18_fd1a3 + dw PikachuEmotion19_fd1a9 + dw PikachuEmotion20_fd1b1 + dw PikachuEmotion21_fd1b9 ; used a fishing rod + dw PikachuEmotion22_fd1c1 + dw PikachuEmotion23_fd1c7 + dw PikachuEmotion24_fd1cf + dw PikachuEmotion25_fd1d7 + dw PikachuEmotion26_fd1df ; wake up pikachu in pewter pokemon center + dw PikachuEmotion27_fd1eb + dw PikachuEmotion28_fd1f1 + dw PikachuEmotion29_fd1f7 + dw PikachuEmotion30_fd1fc + dw PikachuEmotion31_fd20a + dw PikachuEmotion32_fd213 + dw PikachuEmotion33_fd05d + +PikachuEmotion33_fd05d: ; fd05d (3f:505d) + db $ff + +MapSpecificPikachuExpression: ; fd05e (3f:505e) + ld a, [wCurMap] + cp POKEMON_FAN_CLUB + jr nz, .notFanClub + ld hl, wd492 + bit 7, [hl] + ld a, $1d + jr z, .set_carry + call CheckPikachuFollowingPlayer + ld a, $1e + jr nz, .set_carry + jr .asm_fd096 + +.notFanClub + ld a, [wCurMap] + cp PEWTER_POKECENTER + jr nz, .notPewterPokecenter + call CheckPikachuFollowingPlayer + ld a, $1a + jr nz, .set_carry + jr .asm_fd096 + +.notPewterPokecenter + callab Func_f24ae + ld a, e + cp $ff + jr nz, .set_carry + jr .asm_fd096 + +.asm_fd096 + call IsPlayerPikachuAsleepInParty + ld a, $b + jr c, .set_carry + callab Func_fce73 ; same bank + ld a, $1c + jr c, .set_carry + ld a, [wCurMap] + cp POKEMONTOWER_1 + jr c, .notInLavenderTower + cp POKEMONTOWER_7 + 1 + ld a, $16 + jr c, .set_carry +.notInLavenderTower + ld a, [wd49c] + and a + jr z, .no_carry + dec a + ld c, a + ld b, $0 + ld hl, Pointer_fd0cb + add hl, bc + ld a, [hl] + jr .set_carry + +.no_carry + and a + ret + +.set_carry + scf + ret + +Pointer_fd0cb: + db $12, $15, $17, $18, $19 + +IsPlayerPikachuAsleepInParty:: ; fd0d0 (3f:50d0) + xor a + ld [wWhichPokemon], a +.loop + ld a, [wWhichPokemon] + ld c, a + ld b, $0 + ld hl, wPartySpecies + add hl, bc + ld a, [hl] + cp $ff + jr z, .done + cp PIKACHU + jr nz, .curMonNotStarterPikachu + callab IsThisPartymonStarterPikachu + jr nc, .curMonNotStarterPikachu + ld a, [wWhichPokemon] + ld hl, wPartyMon1Status + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld a, [hl] + and SLP + jr z, .done + jr .curMonSleepingPikachu +.curMonNotStarterPikachu + ld a, [wWhichPokemon] + cp PARTY_LENGTH - 1 + jr z, .done + inc a + ld [wWhichPokemon], a + jr .loop +.curMonSleepingPikachu + scf + ret +.done + and a + ret + +PikachuEmotion0_fd115: ; fd115 (3f:5115) + db $ff + +PikachuEmotion2_fd116: ; fd116 (3f:5116) + pikaemotion_dummy2 + pikaemotion_emotebubble SMILE_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic $2 + db $ff + +PikachuEmotion10_fd11e: ; fd11e (3f:511e) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $a + db $ff + +PikachuEmotion7_fd128: ; fd128 (3f:5128) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd224 + pikaemotion_pcm PikachuCry1 + pikaemotion_movement Pointer_fd224 + pikaemotion_pikapic $7 + db $ff + +PikachuEmotion4_fd136: ; fd136 (3f:5136) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd230 + pikaemotion_pcm PikachuCry29 + pikaemotion_pikapic $4 + db $ff + +PikachuEmotion1_fd141: ; fd141 (3f:5141) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $1 + db $ff + +PikachuEmotion8_fd147: ; fd147 (3f:5147) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry39 + pikaemotion_pikapic $8 + db $ff + +PikachuEmotion5_fd14d: ; fd14d (3f:514d) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry31 + pikaemotion_pikapic $5 + db $ff + +PikachuEmotion6_fd153: ; fd153 (3f:5153) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm + pikaemotion_movement Pointer_fd21e + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic $6 + db $ff + +PikachuEmotion3_fd160: ; fd160 (3f:5160) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry40 + pikaemotion_pikapic $3 + db $ff + +PikachuEmotion9_fd166: ; fd166 (3f:5166) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm PikachuCry6 + pikaemotion_movement Pointer_fd218 + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic $9 + db $ff + +PikachuEmotion11_fd173: ; fd173 (3f:5173) + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic $b + db $ff + +PikachuEmotion12_fd17a: ; fd17a (3f:517a) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $c + db $ff + +PikachuEmotion13_fd180: ; fd180 (3f:5180) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd21e + pikaemotion_pikapic $d + db $ff + +PikachuEmotion14_fd189: ; fd189 (3f:5189) + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry10 + pikaemotion_pikapic $e + db $ff + +PikachuEmotion15_fd191: ; fd191 (3f:5191) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry34 + pikaemotion_pikapic $f + db $ff + +PikachuEmotion16_fd197: ; fd197 (3f:5197) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic $10 + db $ff + +PikachuEmotion17_fd19d: ; fd19d (3f:519d) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry13 + pikaemotion_pikapic $11 + db $ff + +PikachuEmotion18_fd1a3: ; fd1a3 (3f:51a3) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $12 + db $ff + +PikachuEmotion19_fd1a9: ; fd1a9 (3f:51a9) + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic $13 + db $ff + +PikachuEmotion20_fd1b1: ; fd1b1 (3f:51b1) + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $14 + db $ff + +PikachuEmotion21_fd1b9: ; fd1b9 (3f:51b9) + pikaemotion_dummy2 + pikaemotion_emotebubble FISH_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic $15 + db $ff + +PikachuEmotion22_fd1c1: ; fd1c1 (3f:51c1) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry4 + pikaemotion_pikapic $16 + db $ff + +PikachuEmotion23_fd1c7: ; fd1c7 (3f:51c7) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic $17 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + db $ff + +PikachuEmotion24_fd1cf: ; fd1cf (3f:51cf) + pikaemotion_dummy2 + pikaemotion_emotebubble EXCLAMATION_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic $18 + db $ff + +PikachuEmotion25_fd1d7: ; fd1d7 (3f:51d7) + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic $19 + db $ff + +PikachuEmotion26_fd1df: ; fd1df (3f:51df) + pikaemotion_dummy2 + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic $1a + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER + db $ff + +PikachuEmotion27_fd1eb: ; fd1eb (3f:51eb) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry9 + pikaemotion_pikapic $1b + db $ff + +PikachuEmotion28_fd1f1: ; fd1f1 (3f:51f1) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry15 + pikaemotion_pikapic $1c + db $ff + +PikachuEmotion29_fd1f7: ; fd1f7 (3f:51f7) + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $a + db $ff + +PikachuEmotion30_fd1fc: ; fd1fc (3f:51fc) + pikaemotion_9 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $14 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADFONT + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER + db $ff + +PikachuEmotion31_fd20a: ; fd20a (3f:520a) + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic $17 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE + db $ff + +PikachuEmotion32_fd213: ; fd213 (3f:5213) + pikaemotion_pcm PikachuCry26 + pikaemotion_pikapic $17 + db $ff + +Pointer_fd218: ; fd218 (3f:5218) + db $00 + db $39, $01 + db $3e, $1e + db $3f + +Pointer_fd21e: ; fd21e (3f:521e) + db $00 + db $39, $00 + db $3e, $1e + db $3f + +Pointer_fd224: ; fd224 (3f:5224) + db $00 + db $3c, $07, $2f + db $3c, $07, $2f + db $3f + +Pointer_fd22c: ; fd22c (3f:522c) + db $3b, $1f, $03 + db $3f + +Pointer_fd230: ; fd230 (3f:5230) + db $00 + db $3c, $0f, $1f + db $3c, $0f, $1f + db $3f + +Pointer_fd238: ; fd238 (3f:5238) + db $00 + db $05, $07 + db $39, $00 + db $05, $07 + db $06, $07 + db $39, $00 + db $06, $07 + db $08, $07 + db $39, $00 + db $08, $07 + db $07, $07 + db $39, $00 + db $07, $07 + db $3f + +Func_fd252: ; fd252 (3f:5252) + ld a, $40 + ld [h_0xFFFC], a + call LoadPikachuSpriteIntoVRAM + call Func_fd266 + and a + jr z, .asm_fd262 + call ApplyPikachuMovementData +.asm_fd262 + xor a + ld [h_0xFFFC], a + ret + +Func_fd266: + ld a, [wSpriteStateData2 + 15 * 16 + 4] + ld e, a + ld a, [wSpriteStateData2 + 15 * 16 + 5] + ld d, a + ld a, [wYCoord] + add 4 + cp e + jr z, .asm_fd280 + jr nc, .asm_fd27e + ld hl, Data_fd294 + ld a, 1 + ret + +.asm_fd27e + xor a + ret + +.asm_fd280 + ld a, [wXCoord] + add 4 + cp d + jr c, .asm_fd28e + ld hl, Data_fd299 + ld a, 2 + ret + +.asm_fd28e + ld hl, Data_fd29d + ld a, 3 + ret + +Data_fd294: + db $00 + db $36 + db $2b + db $34 + db $3f + +Data_fd299: + db $00 + db $36 + db $34 + db $3f + +Data_fd29d: + db $00 + db $36 + db $33 + db $3f -- cgit v1.3.1-sl0p From 5630392f9f96c5dfeca785005bfa0f317fdb3905 Mon Sep 17 00:00:00 2001 From: pikalaxalt Date: Mon, 6 Jun 2016 15:21:01 -0400 Subject: More Pikachu function documentation --- engine/bank3f.asm | 1835 +-------------------------------------- engine/battle/end_of_battle.asm | 2 +- engine/pikachu_emotions.asm | 10 +- engine/pikachu_follow.asm | 1577 +++++++++++++++++++++++++++++++++ engine/pikachu_status.asm | 258 ++++++ scripts/billshouse.asm | 2 +- scripts/fanclub.asm | 2 +- scripts/pewterpokecenter2.asm | 2 +- 8 files changed, 1846 insertions(+), 1842 deletions(-) create mode 100755 engine/pikachu_follow.asm create mode 100755 engine/pikachu_status.asm (limited to 'engine/pikachu_emotions.asm') diff --git a/engine/bank3f.asm b/engine/bank3f.asm index 37aca92f..23eadbb1 100644 --- a/engine/bank3f.asm +++ b/engine/bank3f.asm @@ -1,1839 +1,8 @@ INCLUDE "data/map_songs.asm" INCLUDE "data/map_header_pointers.asm" INCLUDE "data/map_header_banks.asm" - -Func_fc4dd:: ; fc4dd (3f:44dd) -; possibly to test if pika should be out? - ld a, [wPikachuOverworldStateFlags] - bit 5, a - jr nz, .hide ; 3f:44f8 - ld a, [wPikachuOverworldStateFlags] - bit 7, a - jr nz, .hide - call IsStarterPikachuInOurParty - jr nc, .hide - ld a, [wWalkBikeSurfState] - and a - jr nz, .hide - scf - ret - -.hide - and a - ret - -Func_fc4fa:: ; fc4fa (3f:44fa) - ld hl, wPikachuOverworldStateFlags - bit 4, [hl] - res 4, [hl] - jr nz, .normal_spawn_state - call EnablePikachuFollowingPlayer - call ClearPikachuSpriteStateData - ld a, $ff - ld [wPikachuSpriteImageIdx], a - call ClearPikachuFollowCommandBuffer - call CalculatePikachuFacingDirection - ret - -.normal_spawn_state - call CalculatePikachuPlacementCoords - xor a - ld [wPikachuSpawnState], a - ld a, [wPlayerFacingDirection] - ld [wPikachuFacingDirection], a - ret - -ClearPikachuSpriteStateData:: ; fc523 (3f:4523) - ld hl, wPikachuPictureID - call .clear - ld hl, wPikachuSpriteStateData2 -.clear - ld bc, $10 - xor a - call FillMemory - ret - -Func_fc534:: ; fc534 (3f:4534) - call CalculatePikachuPlacementCoords - call CalculatePikachuFacingDirection - xor a - ld [wPikachuSpawnState], a - ret - -CalculatePikachuPlacementCoords:: ; fc53f (3f:453f) - ld bc, wPikachuPictureID - ld a, [wYCoord] - add $4 - ld e, a - ld a, [wXCoord] - add $4 - ld d, a - ld a, [wPikachuSpawnState] - and a - jr z, .load_coords - cp $1 - jr z, .right_of_player - cp $2 - jr z, .check_player_facing2 - cp $3 - jr z, .load_coords - cp $4 - jr z, .below_player - cp $5 - jr z, .above_player - cp $6 - jr z, .left_of_player - cp $7 - jr z, .check_player_facing - jr .right_of_player - -.check_player_facing - ld a, [wPlayerFacingDirection] - and a ; SPRITE_FACING_DOWN - jr z, .below_player - cp SPRITE_FACING_UP - jr z, .above_player - cp SPRITE_FACING_LEFT - jr z, .left_of_player - cp SPRITE_FACING_RIGHT - jr z, .right_of_player -.check_player_facing2 - ld a, [wPlayerFacingDirection] - and a - jr nz, .check_up - dec e - jr .load_coords - -.check_up - cp SPRITE_FACING_UP - jr nz, .check_left - inc e - jr .load_coords - -.check_left - cp SPRITE_FACING_LEFT - jr nz, .left_of_player_2 - inc d - jr .load_coords - -.left_of_player_2 - dec d - jr .load_coords - -.right_of_player - inc d - jr .load_coords - -.left_of_player - dec d - jr .load_coords - -.below_player - inc e - jr .load_coords - -.above_player - dec e - jr .load_coords ; useless jr -.load_coords - ld hl, wPlayerMapY - wPlayerSpriteStateData1 - add hl, bc - ld [hl], e - inc hl - ld [hl], d - inc hl - ld [hl], $fe - push hl - ld hl, wd472 - set 5, [hl] - pop hl - ret - -CalculatePikachuFacingDirection:: ; fc5bc (3f:45bc) - ld a, $49 - ld [wPikachuPictureID], a - ld a, $ff - ld [wPikachuSpriteImageIdx], a - ld a, [wPikachuSpawnState] - and a - jr z, .copy_player_facing - cp $1 - jr z, .copy_player_facing - cp $3 - jr z, .force_facing_down - cp $4 - jr z, .copy_player_facing - cp $6 - jr z, .copy_player_facing - cp $7 - jr z, .face_the_other_way - call Func_fccb2 - ret - -.copy_player_facing - ld a, [wPlayerFacingDirection] - ld [wPikachuFacingDirection], a - ret - -.force_facing_down - ld a, SPRITE_FACING_DOWN - ld [wPikachuFacingDirection], a - ret - -.face_the_other_way - ld a, [wPlayerFacingDirection] - xor $4 - ld [wPikachuFacingDirection], a - ret - -CalculatePikachuSpawnState1:: ; fc5fa (3f:45fa) - ld a, [wCurMap] - cp OAKS_LAB - jr z, .oaks_lab - cp ROUTE_22_GATE - jr z, .route_22_gate - cp MT_MOON_2 - jr z, .mt_moon_2 - cp ROCK_TUNNEL_1 - jr z, .rock_tunnel_1 - ld a, [wCurMap] - ld hl, Pointer_fc64b - call Pikachu_IsInArray ; similar to IsInArray, but not the same - jr c, .map_list_1 - ld a, [wCurMap] - ld hl, Pointer_fc653 - call Pikachu_IsInArray - jr nc, .not_map_list_2 - ld a, [wPlayerFacingDirection] - and a - jr nz, .not_map_list_2 - ld a, $3 - jr .load - -.route_22_gate - ld a, [wPlayerFacingDirection] - and a - jr z, .rock_tunnel_1 - jr .not_map_list_2 - -.mt_moon_2 - ld a, $3 - jr .load - -.map_list_1 - ld a, $4 - jr .load - -.oaks_lab - ld a, $6 - jr .load - -.not_map_list_2 - ld a, $1 - jr .load - -.rock_tunnel_1 - ld a, $3 -.load - ld [wPikachuSpawnState], a - ret - -Pointer_fc64b:: ; fc64b (3f:464b) - db VICTORY_ROAD_2 - db ROUTE_7_GATE - db ROUTE_8_GATE - db ROUTE_16_GATE_1F - db ROUTE_18_GATE_1F - db ROUTE_15_GATE_1F - db ROUTE_11_GATE_1F - db $ff - -Pointer_fc653:: ; fc653 (3f:4653) - db VIRIDIAN_FOREST_EXIT - db CERULEAN_HOUSE_2 - db TRASHED_HOUSE - db VERMILION_DOCK - db CELADON_MANSION_1 - db ROUTE_2_GATE - db FUCHSIA_HOUSE_3 - db $ff - -CalculatePikachuSpawnState2:: ; fc65b (3f:465b) - ld a, [wCurMap] - cp VIRIDIAN_FOREST_EXIT - jr z, .viridian_forest_exit - cp VIRIDIAN_FOREST_ENTRANCE - jr z, .viridian_forest_entrance - ld a, [wCurMap] - ld hl, Pointer_fc68e - call Pikachu_IsInArray - jr c, .in_array - jr .not_in_array - -.viridian_forest_exit - ld a, [wPlayerFacingDirection] - cp SPRITE_FACING_UP - jr z, .in_array - jr .not_in_array - -.viridian_forest_entrance - ld a, [wPlayerFacingDirection] - and a ; SPRITE_FACING_DOWN - jr z, .not_in_array - jr .in_array - -.not_in_array - ld a, $0 - jr .load_spawn_state - -.in_array - ld a, $1 -.load_spawn_state - ld [wPikachuSpawnState], a - ret - -Pointer_fc68e:: ; fc68e (3f:468e) - db VIRIDIAN_FOREST - db SAFARI_ZONE_REST_HOUSE_1 - db SAFARI_ZONE_REST_HOUSE_2 - db SAFARI_ZONE_REST_HOUSE_3 - db SAFARI_ZONE_REST_HOUSE_4 - db SAFARI_ZONE_SECRET_HOUSE - db SILPH_CO_ELEVATOR - db CELADON_MART_ELEVATOR - db CINNABAR_LAB_2 - db CINNABAR_LAB_3 - db CINNABAR_LAB_4 - db $ff - -CalculatePikachuSpawnState3:: ; fc69a (3f:469a) - ld a, [wCurMap] - cp ROUTE_22_GATE - jr z, .asm_fc6a7 - cp ROUTE_2_GATE - jr z, .asm_fc6b0 - jr .asm_fc6bd - -.asm_fc6a7 - ld a, [wPlayerFacingDirection] - cp SPRITE_FACING_UP - jr z, .asm_fc6b9 - jr .asm_fc6bd - -.asm_fc6b0 - ld a, [wPlayerFacingDirection] - 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 [wPikachuSpawnState], a - ret - -Func_fc6c5:: ; fc6c5 (3f:46c5) - push hl - ld hl, wPikachuOverworldStateFlags - set 2, [hl] - pop hl - ret - -Func_fc6cd:: ; fc6cd (3f:46cd) - push hl - ld hl, wPikachuOverworldStateFlags - res 2, [hl] - pop hl - ret - -SpawnPikachu_:: ; fc6d5 (3f:46d5) - call Func_fc6cd - call Func_fc727 - ret nc - push bc - call Func_fcd25 - pop bc - ret c - ld bc, wPikachuPictureID - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - bit 7, [hl] - jp nz, asm_fc745 - ld a, [wFontLoaded] - bit 0, a - jp nz, asm_fc76a - call CheckPikachuFollowingPlayer - jp nz, asm_fc76a - ld a, [hl] - and $7f - cp $a - jr c, .asm_fc704 - xor a -.asm_fc704 - add a - ld e, a - ld d, 0 - ld hl, PointerTable_fc710 - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - jp hl - -PointerTable_fc710: ; fc710 (3f:4710) - dw Func_fc793 - dw Func_fc7aa - dw Func_fc803 - dw asm_fc9c3 - dw asm_fca1c - dw asm_fc9ee - dw asm_fc87f - dw asm_fc904 - dw asm_fc937 - dw asm_fc969 - dw Func_fc726 - -Func_fc726: ; fc726 (3f:4726) - ret - -Func_fc727: ; fc727 (3f:4727) - call Func_fc4dd - jr nc, .dont_spawn - ld a, [wPikachuMovementStatus] - and a - jr nz, .already_spawned - push bc - push hl - call Func_fc534 - pop hl - pop bc -.already_spawned - scf - ret - -.dont_spawn - ld hl, wPikachuSpriteImageIdx - ld [hl], $ff - dec hl - ld [hl], $0 - xor a - ret - -asm_fc745: ; fc745 (3f:4745) - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - res 7, [hl] - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a - call CheckPikachuFollowingPlayer - jr nz, .asm_fc75f - ld a, [wPlayerFacingDirection] - xor $4 - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a -.asm_fc75f - xor a - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hli], a - ld [hl], a - call Func_fca99 - ret - -asm_fc76a: ; fc76a (3f:476a) - xor a - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hli], a - ld [hl], a - call Func_fca99 - call Func_fc82e - jr c, .asm_fc783 - push bc - callab InitializeSpriteScreenPosition - pop bc -.asm_fc783 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $1 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $0 - call RefreshPikachuFollow - ret - -Func_fc793: ; fc793 (3f:4793) - call RefreshPikachuFollow - push bc - callab InitializeSpriteScreenPosition - pop bc - ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $ff - dec hl - ld [hl], $1 - ret - -Func_fc7aa: ; fc7aa (3f:47aa) - call Func_fcc92 - jp c, Func_fc803 - dec a - ld l, a - ld h, $0 - add hl, hl - add hl, hl - ld de, Pointer_fc7e3 - add hl, de - ld d, h - ld e, l - ld a, [de] - inc de - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a - ld a, [de] - inc de - ld hl, wSprite01XStepVector - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a - dec hl - dec hl - ld a, [de] - ld [hl], a - inc de - ld a, [de] - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a - cp $4 - jp z, Func_fca0a - call Func_fcd17 - jp c, Func_fc9df - jp Func_fc9b4 - -Pointer_fc7e3: ; fc7e3 (3f:47e3) - db 0, 0 - db 1, 3 - db 4, 0 - db -1, 3 - db 8, -1 - db 0, 3 - db 12, 1 - db 0, 3 - db 0, 0 - db 1, 4 - db 4, 0 - db -1, 4 - db 8, -1 - db 0, 4 - db 12, 1 - db 0, 4 - -Func_fc803: ; fc803 (3f:4803) - call Func_fcae2 - ret c - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - jr nz, .asm_fc823 - push hl - call Func_fccee - pop hl - cp $5 - jr nc, Func_fc842 - ld [hl], $20 - call Random - and $c - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a -.asm_fc823 - xor a - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hli], a - ld [hl], a - call Func_fca99 - ret - -Func_fc82e: ; fc82e (3f:482e) - ld a, [wWalkCounter] - and a - ret z - scf - ret - -Func_fc835: ; fc835 (3f:4835) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $10 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $1 - ret - -Func_fc842: ; fc842 (3f:4842) - ld hl, $0 - push af - call Random - ld a, [hRandomAdd] - and %11 - ld e, a - ld d, $0 - ld hl, PointerTable_fc85a - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - pop af - jp hl - -PointerTable_fc85a: ; fc85a (3f:485a) - dw Func_fc862 - dw Func_fc8f8 - dw Func_fc92b - dw Func_fc95d - -Func_fc862: ; fc862 (3f:4862) - dec a - add a - add a - and $c - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld [hl], a - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $6 - xor a - ld [wd432], a - ld [wd433], a - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $11 -asm_fc87f: ; fc87f (3f:487f) - ld a, [wd432] - ld e, a - ld a, [wd433] - ld d, a - call Func_fc82e - jr c, Func_fc8c7 - call Func_fc6c5 - ld hl, wSprite01YPixels - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - sub e - ld e, a - inc hl - inc hl - ld a, [hl] - sub d - ld d, a - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - dec a - add a - add Pointer_fc8d6 % $100 - ld l, a - ld a, Pointer_fc8d6 / $100 - adc $0 - ld h, a - ld a, [hli] - ld [wd432], a - add e - ld e, a - ld a, [hl] - ld [wd433], a - add d - ld d, a - ld hl, wSprite01YPixels - wSprite01SpriteStateData1 - add hl, bc - ld [hl], e - inc hl - inc hl - ld [hl], d - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - jp Func_fc835 - -Func_fc8c7: ; fc8c7 (3f:48c7) - ld hl, wSprite01YPixels - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - sub e - ld [hl], a - inc hl - inc hl - ld a, [hl] - sub d - ld [hl], a - jp Func_fc835 - -Pointer_fc8d6: ; fc8d6 (3f:48d6) - db 0, 0 - db -2, 1 - db -4, 2 - db -2, 3 - db 0, 4 - db -2, 3 - db -4, 2 - db -2, 1 - db 0, 0 - db -2, -1 - db -4, -2 - db -2, -3 - db 0, -4 - db -2, -3 - db -4, -2 - db -2, -1 - db 0, 0 - -Func_fc8f8: ; fc8f8 (3f:48f8) - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $7 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $30 -asm_fc904: ; fc904 (3f:4904) - call Func_fc82e - jp c, Func_fc835 - call Func_fc6c5 - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - inc a - cp $8 - ld [hl], a - jr nz, .asm_fc91f - xor a - ld [hli], a - ld a, [hl] - inc a - and %11 - ld [hl], a -.asm_fc91f - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - jp Func_fc835 - -Func_fc92b: ; fc92b (3f:492b) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $20 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $8 -asm_fc937: ; fc937 (3f:4937) - call Func_fc82e - jp c, Func_fc835 - call Func_fc6c5 - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - inc a - cp $8 - ld [hl], a - jr nz, .asm_fc951 - xor a - ld [hli], a - ld a, [hl] - xor $1 - ld [hl], a -.asm_fc951 - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - jp Func_fc835 - -Func_fc95d: ; fc95d (3f:495d) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $20 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $9 -asm_fc969: ; fc969 (3f:4969) - call Func_fc82e - jp c, Func_fc835 - call Func_fc6c5 - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - inc a - cp $8 - ld [hl], a - jr nz, .asm_fc988 - xor a - ld [hl], a - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - call Func_fc994 - ld [hl], a -.asm_fc988 - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - jp Func_fc835 - -Func_fc994: ; fc994 (3f:4994) - push hl - ld hl, Pointer_fc9ac - ld d, a -.loop - ld a, [hli] - cp d - jr nz, .loop - ld a, [hl] - pop hl - ret - -Func_fc9a0: ; fc9a0 (3f:49a0) - push hl - ld hl, Pointer_fc9ac_End - ld d, a -.loop - ld a, [hld] - cp d - jr nz, .loop - ld a, [hl] - pop hl - ret - -Pointer_fc9ac: ; fc9ac (3f:49ac) - db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT - db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT -Pointer_fc9ac_End: - -Func_fc9b4: ; fc9b4 (3f:49b4) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $8 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $3 - call Func_fca38 -asm_fc9c3: ; fc9c3 (3f:49c3) - call Func_fca4b - call Func_fca7e - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - call Func_fca75 - call Func_fccb2 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $1 - ret - -Func_fc9df: ; fc9df (3f:49df) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $4 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $5 - call Func_fca38 -asm_fc9ee: ; fc9ee (3f:49ee) - call asm_fca59 - call Func_fca7e - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - call Func_fca75 - call Func_fccb2 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $1 - ret - -Func_fca0a: ; fca0a (3f:4a0a) - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $8 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $4 - call Func_fca38 - call Func_fca38 -asm_fca1c: ; fca1c (3f:4a1c) - call asm_fca59 - call Func_fca7e - call Func_fca99 - ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 - add hl, bc - dec [hl] - ret nz - call Func_fca75 - call Func_fccb2 - ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $1 - ret - -Func_fca38: ; fca38 (3f:4a38) - ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 - add hl, bc - ld e, [hl] - inc hl - inc hl - ld d, [hl] - ld hl, wSprite01MapY - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - add e - ld [hli], a - ld a, [hl] - add d - ld [hl], a - ret - -Func_fca4b: ; fca4b (3f:4a4b) - ld a, [wWalkBikeSurfState] - cp $1 - jr nz, Func_fca68 - ld a, [wd736] - bit 6, a - jr nz, Func_fca68 -asm_fca59: ; fca59 (3f:4a59) - ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 - add hl, bc - ld a, [hli] - add a - add a - add [hl] - ld [hli], a - ld a, [hli] - add a - add a - add [hl] - ld [hl], a - ret - -Func_fca68: ; fca68 (3f:4a68) - ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 - add hl, bc - ld a, [hli] - add a - add [hl] - ld [hli], a - ld a, [hli] - add a - add [hl] - ld [hli], a - ret - -Func_fca75: ; fca75 (3f:4a75) - ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 - add hl, bc - xor a - ld [hli], a - inc hl - ld [hl], a - ret - -Func_fca7e: ; fca7e (3f:4a7e) - call Func_fcdad - ld d, $2 - jr nc, .asm_fca87 - ld d, $5 -.asm_fca87 - ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - inc a - cp d - jr nz, .asm_fca91 - xor a -.asm_fca91 - ld [hli], a - ret nz - ld a, [hl] - inc a - and $3 - ld [hl], a - ret - -Func_fca99: ; fca99 (3f:4a99) - ld a, [wPikachuOverworldStateFlags] - bit 3, a - jr nz, .asm_fcad1 - ld hl, wSprite01SpriteImageBaseOffset - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - dec a - swap a - ld d, a - ld a, [wd736] - bit 7, a - jr nz, .asm_fcad8 - ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 - add hl, bc - ld a, [hl] - or d - ld d, a - ld a, [wFontLoaded] - bit 0, a - jr z, .asm_fcac4 - call Func_fcae2 - ret c - jr .asm_fcacb - -.asm_fcac4 - ld hl, wSprite01AnimFrameCounter - wSprite01SpriteStateData1 - add hl, bc - ld a, d - or [hl] - ld d, a -.asm_fcacb - ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 - add hl, bc - ld [hl], d - ret - -.asm_fcad1 - ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $ff - ret - -.asm_fcad8 - ld a, [wPlayerSpriteImageIdx] - and $f - or d - ld [wPikachuSpriteImageIdx], a - ret - -Func_fcae2: ; fcae2 (3f:4ae2) - ld hl, wSprite01MapY - wSprite01SpriteStateData1 - add hl, bc - ld a, [wYCoord] - add $4 - cp [hl] - jr nz, .asm_fcaff - inc hl - ld a, [wXCoord] - add $4 - cp [hl] - jr nz, .asm_fcaff - ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 - add hl, bc - ld [hl], $ff - scf - ret - -.asm_fcaff - and a - ret - -IsPikachuRightNextToPlayer: ; fcb01 (3f:4b01) - push bc - push de - push hl - ld bc, wPikachuPictureID - ld a, [wXCoord] - add $4 - ld d, a - ld a, [wYCoord] - add $4 - ld e, a - ld hl, wPlayerMapY - wPlayerSpriteStateData1 - add hl, bc - ld a, [hl] - sub e - and a - jr z, .equal - cp $ff - jr z, .one_away - cp $1 - jr z, .one_away - jr .bad - -.one_away - ld hl, wPlayerMapX - wPlayerSpriteStateData1 - add hl, bc - ld a, [hl] - sub d - jr z, .good - jr .bad - -.equal - ld hl, wPlayerMapX - wPlayerSpriteStateData1 - add hl, bc - ld a, [hl] - sub d - cp $ff - jr z, .good - cp $1 - jr z, .good - and a - jr z, .good - jr .bad - -.good - pop hl - pop de - pop bc - scf - ret - -.bad - pop hl - pop de - pop bc - xor a - ret - -GetPikachuFacingDirectionAndReturnToE: ; fcb4d (3f:4b4d) - call GetPikachuFacingDirection - ld e, a - ret - -GetPikachuFacingDirection: ; fcb52 (3f:4b52) - ld bc, wPikachuPictureID - ld a, [wXCoord] - add $4 - ld d, a - ld a, [wYCoord] - add $4 - ld e, a - ld hl, wPlayerMapY - wPlayerSpriteStateData1 - add hl, bc - ld a, [hl] - cp e - jr z, .asm_fcb71 - jr nc, .asm_fcb6e - ld a, SPRITE_FACING_UP - ret - -.asm_fcb6e - ld a, SPRITE_FACING_DOWN - ret - -.asm_fcb71 - ld hl, wPlayerMapX - wPlayerSpriteStateData1 - add hl, bc - ld a, [hl] - cp d - jr z, .asm_fcb81 - jr nc, .asm_fcb7e - ld a, SPRITE_FACING_LEFT - ret - -.asm_fcb7e - ld a, SPRITE_FACING_RIGHT - ret - -.asm_fcb81 - ld a, $ff ; standing - ret - -ClearPikachuFollowCommandBuffer: ; fcb84 (3f:4b84) - push bc - ld hl, wPikachuFollowCommandBufferSize - ld [hl], $ff - inc hl - ld bc, $10 - xor a - call FillMemory - pop bc - ret - -AppendPikachuFollowCommandToBuffer: ; fcb94 (3f:4b94) - ld hl, wPikachuFollowCommandBufferSize - inc [hl] - ld e, [hl] - ld d, 0 - ld hl, wPikachuFollowCommandBuffer - add hl, de - ld [hl], a - ret - -RefreshPikachuFollow: ; fcba1 (3f:4ba1) - call ClearPikachuFollowCommandBuffer - call GetPikachuFollowCommand - ret c - call AppendPikachuFollowCommandToBuffer - ret - -GetPikachuFollowCommand: ; fcbac (3f:4bac) - ld bc, wPikachuPictureID - ld hl, wPlayerMapY - wPlayerSpriteStateData1 - add hl, bc - ld a, [wYCoord] - add $4 - sub [hl] - jr z, .checkXCoord - jr c, .pikaAbovePlayer - call CheckAbsoluteValueLessThan2 - jr c, .return1 - ld a, $5 - and a - ret - -.return1 - ld a, $1 - and a - ret - -.pikaAbovePlayer - call CheckAbsoluteValueLessThan2 - jr c, .return2 - ld a, $6 - and a - ret - -.return2 - ld a, $2 - and a - ret - -.checkXCoord - ld hl, wPlayerMapX - wPlayerSpriteStateData1 - add hl, bc - ld a, [wXCoord] - add $4 - sub [hl] - jr z, .pikachuOnTopOfPlayer - jr c, .pikaToLeftOfPlayer - call CheckAbsoluteValueLessThan2 - jr c, .return4 - ld a, $8 - and a - ret - -.return4 - ld a, $4 - and a - ret - -.pikaToLeftOfPlayer - call CheckAbsoluteValueLessThan2 - jr c, .return3 - ld a, $7 - and a - ret - -.return3 - ld a, $3 - and a - ret - -.pikachuOnTopOfPlayer - scf - ret - -CheckAbsoluteValueLessThan2: ; fcc01 (3f:4c01) - jr nc, .positive - cpl - inc a -.positive - cp $2 - ret - -Func_fcc08:: ; fcc08 (3f:4c08) - call Func_fcc23 - ret nc - ld a, [wd736] - bit 6, a - jr nz, .asm_fcc1b - call Func_fcc42 - ret c - call AppendPikachuFollowCommandToBuffer - ret - -.asm_fcc1b - call Func_fcc64 - ret c - call AppendPikachuFollowCommandToBuffer - ret - -Func_fcc23: ; fcc23 (3f:4c28) - ld a, [wPikachuOverworldStateFlags] - bit 5, a - jr nz, .asm_fcc40 - ld a, [wPikachuOverworldStateFlags] - bit 7, a - jr nz, .asm_fcc40 - ld a, [wd472] - bit 7, a - jr z, .asm_fcc40 - ld a, [wWalkBikeSurfState] - and a - jr nz, .asm_fcc40 - scf - ret - -.asm_fcc40 - and a - ret - -Func_fcc42: ; fcc42 (3f:4c42) - xor a - ld a, [wPlayerDirection] - bit 3, a - jr nz, .asm_fcc58 - bit 2, a - jr nz, .asm_fcc5b - bit 1, a - jr nz, .asm_fcc5e - bit 0, a - jr nz, .asm_fcc61 - scf - ret - -.asm_fcc58 - ld a, $2 - ret - -.asm_fcc5b - ld a, $1 - ret - -.asm_fcc5e - ld a, $3 - ret - -.asm_fcc61 - ld a, $4 - ret - -Func_fcc64: ; fcc64 (3f:4c64) - ld hl, wPikachuOverworldStateFlags - bit 6, [hl] - jr z, .asm_fcc6e - res 6, [hl] - ret - -.asm_fcc6e - set 6, [hl] - xor a - ld a, [wPlayerDirection] - bit 3, a - jr nz, .asm_fcc86 - bit 2, a - jr nz, .asm_fcc89 - bit 1, a - jr nz, .asm_fcc8c - bit 0, a - jr nz, .asm_fcc8f - scf - ret - -.asm_fcc86 - ld a, $6 - ret - -.asm_fcc89 - ld a, $5 - ret - -.asm_fcc8c - ld a, $7 - ret - -.asm_fcc8f - ld a, $8 - ret - -Func_fcc92: ; fcc92 (3f:4c92) - ld hl, wPikachuFollowCommandBufferSize - ld a, [hl] - cp $ff - jr z, .asm_fccb0 - and a - jr z, .asm_fccb0 - dec [hl] - ld e, a - ld d, 0 - ld hl, wPikachuFollowCommandBuffer - add hl, de - inc e - ld a, $ff -.asm_fcca8 - ld d, [hl] - ldd [hl], a - ld a, d - dec e - jr nz, .asm_fcca8 - and a - ret - -.asm_fccb0 - scf - ret - -Func_fccb2:: ; fccb2 (3f:4cb2) - call Func_fcd01 - and a - jr z, .asm_fccbf - dec a - and $3 - add a - add a - jr .asm_fccea - -.asm_fccbf - ld a, [wYCoord] - add $4 - ld d, a - ld a, [wXCoord] - add $4 - ld e, a - ld a, [wPikachuMapY] - cp d - jr z, .asm_fccd9 - ld a, SPRITE_FACING_DOWN - jr c, .asm_fccea - ld a, SPRITE_FACING_UP - jr .asm_fccea - -.asm_fccd9 - ld a, [wPikachuMapX] - cp e - jr z, .asm_fcce7 - ld a, SPRITE_FACING_RIGHT - jr c, .asm_fccea - ld a, SPRITE_FACING_LEFT - jr .asm_fccea - -.asm_fcce7 - ld a, [wPlayerFacingDirection] -.asm_fccea - ld [wPikachuFacingDirection], a - ret - -Func_fccee: ; fccee (3f:4cee) - ld hl, wPikachuFollowCommandBufferSize - ld a, [hl] - cp $ff - jr z, .asm_fccff - ld e, a - ld d, 0 - ld hl, wPikachuFollowCommandBuffer - add hl, de - ld a, [hl] - ret - -.asm_fccff - xor a - ret - -Func_fcd01: ; fcd01 (3f:4d01) - ld hl, wPikachuFollowCommandBufferSize - ld a, [hl] - cp $ff - jr z, .asm_fcd15 - and a - jr z, .asm_fcd15 - ld e, a - ld d, 0 - ld hl, wPikachuFollowCommandBuffer - add hl, de - ld a, [hl] - ret - -.asm_fcd15 - xor a - ret - -Func_fcd17: ; fcd17 (3f:4d17) - ld a, [wPikachuFollowCommandBufferSize] - cp $ff - ret z - cp $2 - jr nc, .asm_fcd23 - and a - ret - -.asm_fcd23 - scf - ret - -Func_fcd25: ; fcd25 (3f:4d25) - ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add $4 - ld l, a - ld b, [hl] - ld a, [wYCoord] - cp b - jr z, .asm_fcd3a - jr nc, .asm_fcd63 - add $8 - cp b - jr c, .asm_fcd63 -.asm_fcd3a - inc l - ld b, [hl] - ld a, [wXCoord] - cp b - jr z, .asm_fcd49 - jr nc, .asm_fcd63 - add $9 - cp b - jr c, .asm_fcd63 -.asm_fcd49 - call Func_fcd83 - ld d, $60 - ld a, [hli] - ld e, a - cp d - jr nc, .asm_fcd63 - ld a, [hld] - cp d - jr nc, .asm_fcd63 - ld bc, -20 - add hl, bc - ld a, [hli] - cp d - jr nc, .asm_fcd63 - ld a, [hl] - cp d - jr c, .asm_fcd6f -.asm_fcd63 - ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add $2 - ld l, a - ld [hl], $ff - scf - jr .asm_fcd82 - -.asm_fcd6f - ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add $7 - ld l, a - ld a, [wGrassTile] - cp e - ld a, $0 - jr nz, .asm_fcd80 - ld a, $80 -.asm_fcd80 - ld [hl], a - and a -.asm_fcd82 - ret - -Func_fcd83: ; fcd83 (3f:4d83) - ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add $4 - ld l, a - ld a, [hli] - add $4 - and $f0 - srl a - ld c, a - ld b, $0 - inc l - ld a, [hl] - add $2 - srl a - srl a - srl a - add SCREEN_WIDTH - ld d, 0 - ld e, a - ld hl, wTileMap - rept 5 - add hl, bc - endr - add hl, de - ret - -Func_fcdad: ; fcdad (3f:4dad) - push bc - push af - ld a, [wPikachuHappiness] - cp $50 - pop bc - ld a, b - pop bc - ret - -IsStarterPikachuInOurParty:: ; fcdb8 (3f:4db8) - ld hl, wPartySpecies - ld de, wPartyMon1OTID - ld bc, wPartyMonOT - push hl -.loop - pop hl - ld a, [hli] - push hl - inc a - jr z, .noPlayerPikachu - cp PIKACHU + 1 - jr nz, .curMonNotPlayerPikachu - ld h, d - ld l, e - ld a, [wPlayerID] - cp [hl] - jr nz, .curMonNotPlayerPikachu - inc hl - ld a, [wPlayerID+1] - cp [hl] - jr nz, .curMonNotPlayerPikachu - push de - push bc - ld hl, wPlayerName - ld d, $6 ; possible player length - 1 -.nameCompareLoop - dec d - jr z, .sameOT - ld a, [bc] - inc bc - cp [hl] - inc hl - jr z, .nameCompareLoop - pop bc - pop de -.curMonNotPlayerPikachu - ld hl, wPartyMon2 - wPartyMon1 - add hl, de - ld d, h - ld e, l - ld hl, NAME_LENGTH - add hl, bc - ld b, h - ld c, l - jr .loop - -.sameOT - pop bc - pop de - ld h, d - ld l, e - ld bc, -NAME_LENGTH - add hl, bc - ld a, [hli] - or [hl] - jr z, .noPlayerPikachu ; XXX how is this determined? - pop hl - scf - ret - -.noPlayerPikachu - pop hl - and a - ret - -IsThisPartymonStarterPikachu_Box:: ; fce0d (3f:4e0d) - ld hl, wBoxMon1 - ld bc, wBoxMon2 - wBoxMon1 - ld de, wBoxMonOT - jr asm_fce21 - -IsThisPartymonStarterPikachu_Party:: ; fce18 (3f:4e18) -IsThisPartymonStarterPikachu:: - ld hl, wPartyMon1 - ld bc, wPartyMon2 - wPartyMon1 - ld de, wPartyMonOT -asm_fce21: ; fce21 (3f:4e21) - ld a, [wWhichPokemon] - call AddNTimes - ld a, [hl] - cp PIKACHU - jr nz, .notPlayerPikachu - ld bc, wPartyMon1OTID - wPartyMon1 - add hl, bc - ld a, [wPlayerID] - cp [hl] - jr nz, .notPlayerPikachu - inc hl - ld a, [wPlayerID+1] - cp [hl] - jr nz, .notPlayerPikachu - ld h, d - ld l, e - ld a, [wWhichPokemon] - ld bc, NAME_LENGTH - call AddNTimes - ld de, wPlayerName - ld b, $6 -.loop - dec b - jr z, .isPlayerPikachu - ld a, [de] - inc de - cp [hl] - inc hl - jr z, .loop -.notPlayerPikachu - and a - ret - -.isPlayerPikachu - scf - ret - -Func_fce5a:: ; fce5a (3f:4e5a) - push de - call IsStarterPikachuInOurParty - pop de - ret nc - ld a, d - cp $80 - ld a, [wPikachuMood] - jr c, .asm_fce6c - cp d - jr c, .asm_fce6e - ret - -.asm_fce6c - cp d - ret c -.asm_fce6e - ld a, d - ld [wPikachuMood], a - ret - -Func_fce73:: ; fce73 (3f:4e73) -; function to test if Pikachu is alive? - xor a - ld [wWhichPokemon], a - ld hl, wPartyCount -.loop - inc hl - ld a, [hl] - cp $ff - jr z, .asm_fcea9 - push hl - call IsThisPartymonStarterPikachu_Party - pop hl - jr nc, .asm_fce9e - ld a, [wWhichPokemon] - ld hl, wPartyMon1HP - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld a, [hli] - or [hl] - ld d, a - inc hl - inc hl - ld a, [hl] - and a - jr nz, .asm_fcea7 - jr .asm_fcea9 - -.asm_fce9e - ld a, [wWhichPokemon] - inc a - ld [wWhichPokemon], a - jr .loop - -.asm_fcea7 - scf - ret - -.asm_fcea9 - and a - ret - -IsSurfingPikachuInThePlayersParty:: ; fceab (3f:4eab) - ld hl, wPartySpecies - ld de, wPartyMon1Moves - ld bc, wPartyMonOT - push hl -.loop - pop hl - ld a, [hli] - push hl - inc a - jr z, .noSurfingPlayerPikachu - cp PIKACHU+1 - jr nz, .curMonNotSurfingPlayerPikachu - ld h, d - ld l, e - push hl - push bc - ld b, NUM_MOVES -.moveSearchLoop - ld a, [hli] - cp SURF - jr z, .foundSurfingPikachu - dec b - jr nz, .moveSearchLoop - pop bc - pop hl - jr .curMonNotSurfingPlayerPikachu - -.foundSurfingPikachu - pop bc - pop hl - inc hl - inc hl - inc hl - inc hl - ld a, [wPlayerID] - cp [hl] - jr nz, .curMonNotSurfingPlayerPikachu - inc hl - ld a, [wPlayerID+1] - cp [hl] - jr nz, .curMonNotSurfingPlayerPikachu - push de - push bc - ld hl, wPlayerName - ld d, $6 -.nameCompareLoop - dec d - jr z, .foundSurfingPlayerPikachu - ld a, [bc] - inc bc - cp [hl] - inc hl - jr z, .nameCompareLoop - pop bc - pop de -.curMonNotSurfingPlayerPikachu - ld hl, wPartyMon2 - wPartyMon1 - add hl, de - ld d, h - ld e, l - ld hl, NAME_LENGTH - add hl, bc - ld b, h - ld c, l - jr .loop - -.foundSurfingPlayerPikachu - pop bc - pop de - pop hl - scf - ret - -.noSurfingPlayerPikachu - pop hl - and a - ret - +INCLUDE "engine/pikachu_follow.asm" +INCLUDE "engine/pikachu_status.asm" INCLUDE "engine/pikachu_emotions.asm" INCLUDE "engine/pikachu_movement.asm" INCLUDE "engine/pikachu_pic_animation.asm" diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 53a68b64..f4c99e3d 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -46,7 +46,7 @@ EndOfBattle: ; 13765 (4:7765) ld [wForceEvolution], a predef EvolutionAfterBattle ld d, $82 - callab Func_fce5a + callab UpdatePikachuMoodAfterBattle .resetVariables xor a ld [wLowHealthAlarm], a ;disable low health alarm diff --git a/engine/pikachu_emotions.asm b/engine/pikachu_emotions.asm index fdfb7813..b474770e 100755 --- a/engine/pikachu_emotions.asm +++ b/engine/pikachu_emotions.asm @@ -250,7 +250,7 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) call CheckPikachuFollowingPlayer ld a, $1e jr nz, .set_carry - jr .asm_fd096 + jr .check_pikachu_status .notFanClub ld a, [wCurMap] @@ -259,20 +259,20 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) call CheckPikachuFollowingPlayer ld a, $1a jr nz, .set_carry - jr .asm_fd096 + jr .check_pikachu_status .notPewterPokecenter callab Func_f24ae ld a, e cp $ff jr nz, .set_carry - jr .asm_fd096 + jr .check_pikachu_status ; useless -.asm_fd096 +.check_pikachu_status call IsPlayerPikachuAsleepInParty ld a, $b jr c, .set_carry - callab Func_fce73 ; same bank + callab CheckPikachuFaintedOrStatused ; same bank ld a, $1c jr c, .set_carry ld a, [wCurMap] diff --git a/engine/pikachu_follow.asm b/engine/pikachu_follow.asm new file mode 100755 index 00000000..a715b0a3 --- /dev/null +++ b/engine/pikachu_follow.asm @@ -0,0 +1,1577 @@ +Func_fc4dd:: ; fc4dd (3f:44dd) +; possibly to test if pika should be out? + ld a, [wPikachuOverworldStateFlags] + bit 5, a + jr nz, .hide ; 3f:44f8 + ld a, [wPikachuOverworldStateFlags] + bit 7, a + jr nz, .hide + call IsStarterPikachuInOurParty + jr nc, .hide + ld a, [wWalkBikeSurfState] + and a + jr nz, .hide + scf + ret + +.hide + and a + ret + +Func_fc4fa:: ; fc4fa (3f:44fa) + ld hl, wPikachuOverworldStateFlags + bit 4, [hl] + res 4, [hl] + jr nz, .normal_spawn_state + call EnablePikachuFollowingPlayer + call ClearPikachuSpriteStateData + ld a, $ff + ld [wPikachuSpriteImageIdx], a + call ClearPikachuFollowCommandBuffer + call CalculatePikachuFacingDirection + ret + +.normal_spawn_state + call CalculatePikachuPlacementCoords + xor a + ld [wPikachuSpawnState], a + ld a, [wPlayerFacingDirection] + ld [wPikachuFacingDirection], a + ret + +ClearPikachuSpriteStateData:: ; fc523 (3f:4523) + ld hl, wPikachuPictureID + call .clear + ld hl, wPikachuSpriteStateData2 +.clear + ld bc, $10 + xor a + call FillMemory + ret + +Func_fc534:: ; fc534 (3f:4534) + call CalculatePikachuPlacementCoords + call CalculatePikachuFacingDirection + xor a + ld [wPikachuSpawnState], a + ret + +CalculatePikachuPlacementCoords:: ; fc53f (3f:453f) + ld bc, wPikachuPictureID + ld a, [wYCoord] + add $4 + ld e, a + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wPikachuSpawnState] + and a + jr z, .load_coords + cp $1 + jr z, .right_of_player + cp $2 + jr z, .check_player_facing2 + cp $3 + jr z, .load_coords + cp $4 + jr z, .below_player + cp $5 + jr z, .above_player + cp $6 + jr z, .left_of_player + cp $7 + jr z, .check_player_facing + jr .right_of_player + +.check_player_facing + ld a, [wPlayerFacingDirection] + and a ; SPRITE_FACING_DOWN + jr z, .below_player + cp SPRITE_FACING_UP + jr z, .above_player + cp SPRITE_FACING_LEFT + jr z, .left_of_player + cp SPRITE_FACING_RIGHT + jr z, .right_of_player +.check_player_facing2 + ld a, [wPlayerFacingDirection] + and a + jr nz, .check_up + dec e + jr .load_coords + +.check_up + cp SPRITE_FACING_UP + jr nz, .check_left + inc e + jr .load_coords + +.check_left + cp SPRITE_FACING_LEFT + jr nz, .left_of_player_2 + inc d + jr .load_coords + +.left_of_player_2 + dec d + jr .load_coords + +.right_of_player + inc d + jr .load_coords + +.left_of_player + dec d + jr .load_coords + +.below_player + inc e + jr .load_coords + +.above_player + dec e + jr .load_coords ; useless jr +.load_coords + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld [hl], e + inc hl + ld [hl], d + inc hl + ld [hl], $fe + push hl + ld hl, wd472 + set 5, [hl] + pop hl + ret + +CalculatePikachuFacingDirection:: ; fc5bc (3f:45bc) + ld a, $49 + ld [wPikachuPictureID], a + ld a, $ff + ld [wPikachuSpriteImageIdx], a + ld a, [wPikachuSpawnState] + and a + jr z, .copy_player_facing + cp $1 + jr z, .copy_player_facing + cp $3 + jr z, .force_facing_down + cp $4 + jr z, .copy_player_facing + cp $6 + jr z, .copy_player_facing + cp $7 + jr z, .face_the_other_way + call ComputePikachuFacingDirection + ret + +.copy_player_facing + ld a, [wPlayerFacingDirection] + ld [wPikachuFacingDirection], a + ret + +.force_facing_down + ld a, SPRITE_FACING_DOWN + ld [wPikachuFacingDirection], a + ret + +.face_the_other_way + ld a, [wPlayerFacingDirection] + xor $4 + ld [wPikachuFacingDirection], a + ret + +CalculatePikachuSpawnState1:: ; fc5fa (3f:45fa) + ld a, [wCurMap] + cp OAKS_LAB + jr z, .oaks_lab + cp ROUTE_22_GATE + jr z, .route_22_gate + cp MT_MOON_2 + jr z, .mt_moon_2 + cp ROCK_TUNNEL_1 + jr z, .rock_tunnel_1 + ld a, [wCurMap] + ld hl, Pointer_fc64b + call Pikachu_IsInArray ; similar to IsInArray, but not the same + jr c, .map_list_1 + ld a, [wCurMap] + ld hl, Pointer_fc653 + call Pikachu_IsInArray + jr nc, .not_map_list_2 + ld a, [wPlayerFacingDirection] + and a + jr nz, .not_map_list_2 + ld a, $3 + jr .load + +.route_22_gate + ld a, [wPlayerFacingDirection] + and a + jr z, .rock_tunnel_1 + jr .not_map_list_2 + +.mt_moon_2 + ld a, $3 + jr .load + +.map_list_1 + ld a, $4 + jr .load + +.oaks_lab + ld a, $6 + jr .load + +.not_map_list_2 + ld a, $1 + jr .load + +.rock_tunnel_1 + ld a, $3 +.load + ld [wPikachuSpawnState], a + ret + +Pointer_fc64b:: ; fc64b (3f:464b) + db VICTORY_ROAD_2 + db ROUTE_7_GATE + db ROUTE_8_GATE + db ROUTE_16_GATE_1F + db ROUTE_18_GATE_1F + db ROUTE_15_GATE_1F + db ROUTE_11_GATE_1F + db $ff + +Pointer_fc653:: ; fc653 (3f:4653) + db VIRIDIAN_FOREST_EXIT + db CERULEAN_HOUSE_2 + db TRASHED_HOUSE + db VERMILION_DOCK + db CELADON_MANSION_1 + db ROUTE_2_GATE + db FUCHSIA_HOUSE_3 + db $ff + +CalculatePikachuSpawnState2:: ; fc65b (3f:465b) + ld a, [wCurMap] + cp VIRIDIAN_FOREST_EXIT + jr z, .viridian_forest_exit + cp VIRIDIAN_FOREST_ENTRANCE + jr z, .viridian_forest_entrance + ld a, [wCurMap] + ld hl, Pointer_fc68e + call Pikachu_IsInArray + jr c, .in_array + jr .not_in_array + +.viridian_forest_exit + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jr z, .in_array + jr .not_in_array + +.viridian_forest_entrance + ld a, [wPlayerFacingDirection] + and a ; SPRITE_FACING_DOWN + jr z, .not_in_array + jr .in_array + +.not_in_array + ld a, $0 + jr .load_spawn_state + +.in_array + ld a, $1 +.load_spawn_state + ld [wPikachuSpawnState], a + ret + +Pointer_fc68e:: ; fc68e (3f:468e) + db VIRIDIAN_FOREST + db SAFARI_ZONE_REST_HOUSE_1 + db SAFARI_ZONE_REST_HOUSE_2 + db SAFARI_ZONE_REST_HOUSE_3 + db SAFARI_ZONE_REST_HOUSE_4 + db SAFARI_ZONE_SECRET_HOUSE + db SILPH_CO_ELEVATOR + db CELADON_MART_ELEVATOR + db CINNABAR_LAB_2 + db CINNABAR_LAB_3 + db CINNABAR_LAB_4 + db $ff + +CalculatePikachuSpawnState3:: ; fc69a (3f:469a) + ld a, [wCurMap] + cp ROUTE_22_GATE + jr z, .asm_fc6a7 + cp ROUTE_2_GATE + jr z, .asm_fc6b0 + jr .asm_fc6bd + +.asm_fc6a7 + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jr z, .asm_fc6b9 + jr .asm_fc6bd + +.asm_fc6b0 + ld a, [wPlayerFacingDirection] + 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 [wPikachuSpawnState], a + ret + +SetPikachuOverworldStateFlag2:: ; fc6c5 (3f:46c5) + push hl + ld hl, wPikachuOverworldStateFlags + set 2, [hl] + pop hl + ret + +ResetPikachuOverworldStateFlag2:: ; fc6cd (3f:46cd) + push hl + ld hl, wPikachuOverworldStateFlags + res 2, [hl] + pop hl + ret + +SpawnPikachu_:: ; fc6d5 (3f:46d5) + call ResetPikachuOverworldStateFlag2 + call Func_fc727 + ret nc + + push bc + call WillPikachuSpawnOnTheScreen + pop bc + ret c + + ld bc, wPikachuPictureID + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + bit 7, [hl] + jp nz, asm_fc745 + ld a, [wFontLoaded] + bit 0, a + jp nz, asm_fc76a + call CheckPikachuFollowingPlayer + jp nz, asm_fc76a + ld a, [hl] + and $7f + cp $a + jr c, .valid + xor a +.valid + add a + ld e, a + ld d, 0 + ld hl, PointerTable_fc710 + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +PointerTable_fc710: ; fc710 (3f:4710) + dw Func_fc793 + dw Func_fc7aa + dw Func_fc803 + dw asm_fc9c3 + dw asm_fca1c + dw asm_fc9ee + dw asm_fc87f + dw asm_fc904 + dw asm_fc937 + dw asm_fc969 + dw Func_fc726 + +Func_fc726: ; fc726 (3f:4726) + ret + +Func_fc727: ; fc727 (3f:4727) + call Func_fc4dd + jr nc, .dont_spawn + ld a, [wPikachuMovementStatus] + and a + jr nz, .already_spawned + push bc + push hl + call Func_fc534 + pop hl + pop bc +.already_spawned + scf + ret + +.dont_spawn + ld hl, wPikachuSpriteImageIdx + ld [hl], $ff + dec hl + ld [hl], $0 + xor a + ret + +asm_fc745: ; fc745 (3f:4745) + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + res 7, [hl] + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a + call CheckPikachuFollowingPlayer + jr nz, .asm_fc75f + ld a, [wPlayerFacingDirection] + xor $4 + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a +.asm_fc75f + xor a + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + ret + +asm_fc76a: ; fc76a (3f:476a) + xor a + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + call Func_fc82e + jr c, .asm_fc783 + push bc + callab InitializeSpriteScreenPosition + pop bc +.asm_fc783 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $1 + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $0 + call RefreshPikachuFollow + ret + +Func_fc793: ; fc793 (3f:4793) + call RefreshPikachuFollow + push bc + callab InitializeSpriteScreenPosition + pop bc + ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $ff + dec hl + ld [hl], $1 + ret + +Func_fc7aa: ; fc7aa (3f:47aa) + call Func_fcc92 + jp c, Func_fc803 + dec a + ld l, a + ld h, $0 + add hl, hl + add hl, hl + ld de, Pointer_fc7e3 + add hl, de + ld d, h + ld e, l + ld a, [de] + inc de + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a + ld a, [de] + inc de + ld hl, wSprite01XStepVector - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a + dec hl + dec hl + ld a, [de] + ld [hl], a + inc de + ld a, [de] + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a + cp $4 + jp z, Func_fca0a + call AreThereAtLeastTwoStepsInPikachuFollowCommandBuffer + jp c, FastPikachuFollow + jp NormalPikachuFollow + +Pointer_fc7e3: ; fc7e3 (3f:47e3) + db 0, 0 + db 1, 3 + db 4, 0 + db -1, 3 + db 8, -1 + db 0, 3 + db 12, 1 + db 0, 3 + db 0, 0 + db 1, 4 + db 4, 0 + db -1, 4 + db 8, -1 + db 0, 4 + db 12, 1 + db 0, 4 + +Func_fc803: ; fc803 (3f:4803) + call Func_fcae2 + ret c + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + jr nz, .asm_fc823 + push hl + call GetPikachuFollowCommand + pop hl + cp $5 + jr nc, Func_fc842 + ld [hl], $20 + call Random + and $c + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a +.asm_fc823 + xor a + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + ret + +Func_fc82e: ; fc82e (3f:482e) + ld a, [wWalkCounter] + and a + ret z + scf + ret + +Func_fc835: ; fc835 (3f:4835) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $10 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +Func_fc842: ; fc842 (3f:4842) + ld hl, $0 + push af + call Random + ld a, [hRandomAdd] + and %11 + ld e, a + ld d, $0 + ld hl, PointerTable_fc85a + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + pop af + jp hl + +PointerTable_fc85a: ; fc85a (3f:485a) + dw Func_fc862 + dw Func_fc8f8 + dw Func_fc92b + dw Func_fc95d + +Func_fc862: ; fc862 (3f:4862) + dec a + add a + add a + and $c + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld [hl], a + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $6 + xor a + ld [wd432], a + ld [wd433], a + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $11 +asm_fc87f: ; fc87f (3f:487f) + ld a, [wd432] + ld e, a + ld a, [wd433] + ld d, a + call Func_fc82e + jr c, Func_fc8c7 + call SetPikachuOverworldStateFlag2 + ld hl, wSprite01YPixels - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + sub e + ld e, a + inc hl + inc hl + ld a, [hl] + sub d + ld d, a + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + dec a + add a + add Pointer_fc8d6 % $100 + ld l, a + ld a, Pointer_fc8d6 / $100 + adc $0 + ld h, a + ld a, [hli] + ld [wd432], a + add e + ld e, a + ld a, [hl] + ld [wd433], a + add d + ld d, a + ld hl, wSprite01YPixels - wSprite01SpriteStateData1 + add hl, bc + ld [hl], e + inc hl + inc hl + ld [hl], d + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc8c7: ; fc8c7 (3f:48c7) + ld hl, wSprite01YPixels - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + sub e + ld [hl], a + inc hl + inc hl + ld a, [hl] + sub d + ld [hl], a + jp Func_fc835 + +Pointer_fc8d6: ; fc8d6 (3f:48d6) + db 0, 0 + db -2, 1 + db -4, 2 + db -2, 3 + db 0, 4 + db -2, 3 + db -4, 2 + db -2, 1 + db 0, 0 + db -2, -1 + db -4, -2 + db -2, -3 + db 0, -4 + db -2, -3 + db -4, -2 + db -2, -1 + db 0, 0 + +Func_fc8f8: ; fc8f8 (3f:48f8) + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $7 + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $30 +asm_fc904: ; fc904 (3f:4904) + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .asm_fc91f + xor a + ld [hli], a + ld a, [hl] + inc a + and %11 + ld [hl], a +.asm_fc91f + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc92b: ; fc92b (3f:492b) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $20 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $8 +asm_fc937: ; fc937 (3f:4937) + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .asm_fc951 + xor a + ld [hli], a + ld a, [hl] + xor $1 + ld [hl], a +.asm_fc951 + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc95d: ; fc95d (3f:495d) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $20 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $9 +asm_fc969: ; fc969 (3f:4969) + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .asm_fc988 + xor a + ld [hl], a + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + call Func_fc994 + ld [hl], a +.asm_fc988 + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc994: ; fc994 (3f:4994) + push hl + ld hl, Pointer_fc9ac + ld d, a +.loop + ld a, [hli] + cp d + jr nz, .loop + ld a, [hl] + pop hl + ret + +Func_fc9a0: ; fc9a0 (3f:49a0) + push hl + ld hl, Pointer_fc9ac_End + ld d, a +.loop + ld a, [hld] + cp d + jr nz, .loop + ld a, [hl] + pop hl + ret + +Pointer_fc9ac: ; fc9ac (3f:49ac) + db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT + db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT +Pointer_fc9ac_End: + +NormalPikachuFollow: ; fc9b4 (3f:49b4) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $8 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $3 + call AddPikachuStepVector +asm_fc9c3: ; fc9c3 (3f:49c3) + call TryDoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +FastPikachuFollow: ; fc9df (3f:49df) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $4 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $5 + call AddPikachuStepVector +asm_fc9ee: ; fc9ee (3f:49ee) + call DoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +Func_fca0a: ; fca0a (3f:4a0a) + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $8 + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $4 + call AddPikachuStepVector + call AddPikachuStepVector +asm_fca1c: ; fca1c (3f:4a1c) + call DoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wSprite01WalkAnimationCounter - wSprite01SpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wSprite01MovementStatus - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +AddPikachuStepVector: ; fca38 (3f:4a38) + ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 + add hl, bc + ld e, [hl] + inc hl + inc hl + ld d, [hl] + ld hl, wSprite01MapY - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + add e + ld [hli], a + ld a, [hl] + add d + ld [hl], a + ret + +TryDoubleAddPikachuStepVectorToScreenPixelCoords: ; fca4b (3f:4a4b) + ld a, [wWalkBikeSurfState] + cp $1 ; biking + jr nz, AddPikachuStepVectorToScreenPixelCoords + ld a, [wd736] + bit 6, a + jr nz, AddPikachuStepVectorToScreenPixelCoords +DoubleAddPikachuStepVectorToScreenPixelCoords: ; fca59 (3f:4a59) + ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 + add hl, bc + ld a, [hli] + add a + add a + add [hl] + ld [hli], a + ld a, [hli] + add a + add a + add [hl] + ld [hl], a + ret + +AddPikachuStepVectorToScreenPixelCoords: ; fca68 (3f:4a68) + ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 + add hl, bc + ld a, [hli] + add a + add [hl] + ld [hli], a + ld a, [hli] + add a + add [hl] + ld [hli], a + ret + +ResetPikachuStepVector: ; fca75 (3f:4a75) + ld hl, wSprite01YStepVector - wSprite01SpriteStateData1 + add hl, bc + xor a + ld [hli], a + inc hl + ld [hl], a + ret + +GetPikachuWalkingAnimationSpeed: ; fca7e (3f:4a7e) + call ComparePikachuHappinessTo80 + ld d, $2 + jr nc, .happy + ld d, $5 +.happy + ld hl, wSprite01IntraAnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp d + jr nz, .dont_reset + xor a +.dont_reset + ld [hli], a + ret nz + ld a, [hl] + inc a + and $3 + ld [hl], a + ret + +UpdatePikachuWalkingSprite: ; fca99 (3f:4a99) + ld a, [wPikachuOverworldStateFlags] + bit 3, a + jr nz, .uninitialized + ld hl, wSprite01SpriteImageBaseOffset - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + dec a + swap a + ld d, a + ld a, [wd736] + bit 7, a + jr nz, .copy_player + ld hl, wSprite01FacingDirection - wSprite01SpriteStateData1 + add hl, bc + ld a, [hl] + or d + ld d, a + ld a, [wFontLoaded] + bit 0, a + jr z, .normal_get_sprite_index + call Func_fcae2 + ret c + jr .load_sprite_index + +.normal_get_sprite_index + ld hl, wSprite01AnimFrameCounter - wSprite01SpriteStateData1 + add hl, bc + ld a, d + or [hl] + ld d, a +.load_sprite_index + ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 + add hl, bc + ld [hl], d + ret + +.uninitialized + ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $ff + ret + +.copy_player + ld a, [wPlayerSpriteImageIdx] + and $f + or d + ld [wPikachuSpriteImageIdx], a + ret + +Func_fcae2: ; fcae2 (3f:4ae2) + ld hl, wSprite01MapY - wSprite01SpriteStateData1 + add hl, bc + ld a, [wYCoord] + add $4 + cp [hl] + jr nz, .on_screen + inc hl + ld a, [wXCoord] + add $4 + cp [hl] + jr nz, .on_screen + ld hl, wSprite01SpriteImageIdx - wSprite01SpriteStateData1 + add hl, bc + ld [hl], $ff + scf + ret + +.on_screen + and a + ret + +IsPikachuRightNextToPlayer: ; fcb01 (3f:4b01) + push bc + push de + push hl + ld bc, wPikachuPictureID + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wYCoord] + add $4 + ld e, a + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub e + and a + jr z, .equal + cp $ff + jr z, .one_away + cp $1 + jr z, .one_away + jr .bad + +.one_away + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub d + jr z, .good + jr .bad + +.equal + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub d + cp $ff + jr z, .good + cp $1 + jr z, .good + and a + jr z, .good + jr .bad + +.good + pop hl + pop de + pop bc + scf + ret + +.bad + pop hl + pop de + pop bc + xor a + ret + +GetPikachuFacingDirectionAndReturnToE: ; fcb4d (3f:4b4d) + call GetPikachuFacingDirection + ld e, a + ret + +GetPikachuFacingDirection: ; fcb52 (3f:4b52) + ld bc, wPikachuPictureID + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wYCoord] + add $4 + ld e, a + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + cp e + jr z, .asm_fcb71 + jr nc, .asm_fcb6e + ld a, SPRITE_FACING_UP + ret + +.asm_fcb6e + ld a, SPRITE_FACING_DOWN + ret + +.asm_fcb71 + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + cp d + jr z, .asm_fcb81 + jr nc, .asm_fcb7e + ld a, SPRITE_FACING_LEFT + ret + +.asm_fcb7e + ld a, SPRITE_FACING_RIGHT + ret + +.asm_fcb81 + ld a, $ff ; standing + ret + +ClearPikachuFollowCommandBuffer: ; fcb84 (3f:4b84) + push bc + ld hl, wPikachuFollowCommandBufferSize + ld [hl], $ff + inc hl + ld bc, $10 + xor a + call FillMemory + pop bc + ret + +AppendPikachuFollowCommandToBuffer: ; fcb94 (3f:4b94) + ld hl, wPikachuFollowCommandBufferSize + inc [hl] + ld e, [hl] + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld [hl], a + ret + +RefreshPikachuFollow: ; fcba1 (3f:4ba1) + call ClearPikachuFollowCommandBuffer + call ComputePikachuFollowCommand + ret c + call AppendPikachuFollowCommandToBuffer + ret + +ComputePikachuFollowCommand: ; fcbac (3f:4bac) + ld bc, wPikachuPictureID + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [wYCoord] + add $4 + sub [hl] + jr z, .checkXCoord + jr c, .pikaAbovePlayer + call CheckAbsoluteValueLessThan2 + jr c, .return1 + ld a, $5 + and a + ret + +.return1 + ld a, $1 + and a + ret + +.pikaAbovePlayer + call CheckAbsoluteValueLessThan2 + jr c, .return2 + ld a, $6 + and a + ret + +.return2 + ld a, $2 + and a + ret + +.checkXCoord + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [wXCoord] + add $4 + sub [hl] + jr z, .pikachuOnTopOfPlayer + jr c, .pikaToLeftOfPlayer + call CheckAbsoluteValueLessThan2 + jr c, .return4 + ld a, $8 + and a + ret + +.return4 + ld a, $4 + and a + ret + +.pikaToLeftOfPlayer + call CheckAbsoluteValueLessThan2 + jr c, .return3 + ld a, $7 + and a + ret + +.return3 + ld a, $3 + and a + ret + +.pikachuOnTopOfPlayer + scf + ret + +CheckAbsoluteValueLessThan2: ; fcc01 (3f:4c01) + jr nc, .positive + cpl + inc a +.positive + cp $2 + ret + +Func_fcc08:: ; fcc08 (3f:4c08) + call Func_fcc23 + ret nc + ld a, [wd736] + bit 6, a + jr nz, .asm_fcc1b + call Func_fcc42 + ret c + call AppendPikachuFollowCommandToBuffer + ret + +.asm_fcc1b + call Func_fcc64 + ret c + call AppendPikachuFollowCommandToBuffer + ret + +Func_fcc23: ; fcc23 (3f:4c28) + ld a, [wPikachuOverworldStateFlags] + bit 5, a + jr nz, .asm_fcc40 + ld a, [wPikachuOverworldStateFlags] + bit 7, a + jr nz, .asm_fcc40 + ld a, [wd472] + bit 7, a + jr z, .asm_fcc40 + ld a, [wWalkBikeSurfState] + and a + jr nz, .asm_fcc40 + scf + ret + +.asm_fcc40 + and a + ret + +Func_fcc42: ; fcc42 (3f:4c42) + xor a + ld a, [wPlayerDirection] + bit 3, a + jr nz, .asm_fcc58 + bit 2, a + jr nz, .asm_fcc5b + bit 1, a + jr nz, .asm_fcc5e + bit 0, a + jr nz, .asm_fcc61 + scf + ret + +.asm_fcc58 + ld a, $2 + ret + +.asm_fcc5b + ld a, $1 + ret + +.asm_fcc5e + ld a, $3 + ret + +.asm_fcc61 + ld a, $4 + ret + +Func_fcc64: ; fcc64 (3f:4c64) + ld hl, wPikachuOverworldStateFlags + bit 6, [hl] + jr z, .asm_fcc6e + res 6, [hl] + ret + +.asm_fcc6e + set 6, [hl] + xor a + ld a, [wPlayerDirection] + bit 3, a + jr nz, .asm_fcc86 + bit 2, a + jr nz, .asm_fcc89 + bit 1, a + jr nz, .asm_fcc8c + bit 0, a + jr nz, .asm_fcc8f + scf + ret + +.asm_fcc86 + ld a, $6 + ret + +.asm_fcc89 + ld a, $5 + ret + +.asm_fcc8c + ld a, $7 + ret + +.asm_fcc8f + ld a, $8 + ret + +Func_fcc92: ; fcc92 (3f:4c92) + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .asm_fccb0 + and a + jr z, .asm_fccb0 + dec [hl] + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + inc e + ld a, $ff +.asm_fcca8 + ld d, [hl] + ldd [hl], a + ld a, d + dec e + jr nz, .asm_fcca8 + and a + ret + +.asm_fccb0 + scf + ret + +ComputePikachuFacingDirection:: ; fccb2 (3f:4cb2) + call GetPikachuFollowCommandIfBufferSizeNonzero + and a + jr z, .check_y + dec a + and $3 + add a + add a + jr .load + +.check_y + ld a, [wYCoord] + add $4 + ld d, a + ld a, [wXCoord] + add $4 + ld e, a + ld a, [wPikachuMapY] + cp d + jr z, .check_x + ld a, SPRITE_FACING_DOWN + jr c, .load + ld a, SPRITE_FACING_UP + jr .load + +.check_x + ld a, [wPikachuMapX] + cp e + jr z, .copy_from_player + ld a, SPRITE_FACING_RIGHT + jr c, .load + ld a, SPRITE_FACING_LEFT + jr .load + +.copy_from_player + ld a, [wPlayerFacingDirection] +.load + ld [wPikachuFacingDirection], a + ret + +GetPikachuFollowCommand: ; fccee (3f:4cee) + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .asm_fccff + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld a, [hl] + ret + +.asm_fccff + xor a + ret + +GetPikachuFollowCommandIfBufferSizeNonzero: ; fcd01 (3f:4d01) + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .default + and a + jr z, .default + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld a, [hl] + ret + +.default + xor a + ret + +AreThereAtLeastTwoStepsInPikachuFollowCommandBuffer: ; fcd17 (3f:4d17) + ld a, [wPikachuFollowCommandBufferSize] + cp $ff + ret z + cp $2 + jr nc, .set_carry + and a + ret + +.set_carry + scf + ret + +WillPikachuSpawnOnTheScreen: ; fcd25 (3f:4d25) + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] ; If we're here, this can only be $f0 + add wPikachuMapY - wPikachuSpriteStateData2 + ld l, a + ld b, [hl] + ld a, [wYCoord] + cp b + jr z, .same_y + jr nc, .not_on_screen + add (SCREEN_HEIGHT / 2) - 1 + cp b + jr c, .not_on_screen +.same_y + inc l + ld b, [hl] + ld a, [wXCoord] + cp b + jr z, .same_x + jr nc, .not_on_screen + add (SCREEN_WIDTH / 2) - 1 + cp b + jr c, .not_on_screen +.same_x + call .GetNPCCurrentTile + ld d, $60 + ld a, [hli] + ld e, a + cp d + jr nc, .not_on_screen + ld a, [hld] + cp d + jr nc, .not_on_screen + ld bc, -20 + add hl, bc + ld a, [hli] + cp d + jr nc, .not_on_screen + ld a, [hl] + cp d + jr c, .on_screen +.not_on_screen + ld h, wSpriteStateData1 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + ld l, a + ld [hl], $ff + scf + jr .return + +.on_screen + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuGrassPriority - wPikachuSpriteStateData2 + ld l, a + ld a, [wGrassTile] + cp e + ld a, $0 + jr nz, .priority + ld a, $80 +.priority + ld [hl], a + and a +.return + ret + +.GetNPCCurrentTile: ; fcd83 (3f:4d83) + ld h, wSpriteStateData1 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuYPixels - wPikachuSpriteStateData1 + ld l, a + ld a, [hli] + add $4 + and $f0 + srl a + ld c, a + ld b, $0 + inc l + ld a, [hl] + add $2 + srl a + srl a + srl a + add SCREEN_WIDTH + ld d, 0 + ld e, a + ld hl, wTileMap + rept 5 + add hl, bc + endr + add hl, de + ret + +ComparePikachuHappinessTo80: ; fcdad (3f:4dad) +; preserves a and bc + push bc + push af + ld a, [wPikachuHappiness] + cp 80 + pop bc + ld a, b + pop bc + ret diff --git a/engine/pikachu_status.asm b/engine/pikachu_status.asm new file mode 100755 index 00000000..17330645 --- /dev/null +++ b/engine/pikachu_status.asm @@ -0,0 +1,258 @@ +IsStarterPikachuInOurParty:: ; fcdb8 (3f:4db8) + ld hl, wPartySpecies + ld de, wPartyMon1OTID + ld bc, wPartyMonOT + push hl +.loop + pop hl + ld a, [hli] + push hl + inc a + jr z, .noPlayerPikachu + cp PIKACHU + 1 + jr nz, .curMonNotPlayerPikachu + ld h, d + ld l, e + ld a, [wPlayerID] + cp [hl] + jr nz, .curMonNotPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .curMonNotPlayerPikachu + push de + push bc + ld hl, wPlayerName + ld d, $6 ; possible player length - 1 +.nameCompareLoop + dec d + jr z, .sameOT + ld a, [bc] + inc bc + cp [hl] + inc hl + jr z, .nameCompareLoop + pop bc + pop de +.curMonNotPlayerPikachu + ld hl, wPartyMon2 - wPartyMon1 + add hl, de + ld d, h + ld e, l + ld hl, NAME_LENGTH + add hl, bc + ld b, h + ld c, l + jr .loop + +.sameOT + pop bc + pop de + ld h, d + ld l, e + ld bc, -NAME_LENGTH + add hl, bc + ld a, [hli] + or [hl] + jr z, .noPlayerPikachu ; XXX how is this determined? + pop hl + scf + ret + +.noPlayerPikachu + pop hl + and a + ret + +IsThisPartymonStarterPikachu_Box:: ; fce0d (3f:4e0d) + ld hl, wBoxMon1 + ld bc, wBoxMon2 - wBoxMon1 + ld de, wBoxMonOT + jr asm_fce21 + +IsThisPartymonStarterPikachu_Party:: ; fce18 (3f:4e18) +IsThisPartymonStarterPikachu:: + ld hl, wPartyMon1 + ld bc, wPartyMon2 - wPartyMon1 + ld de, wPartyMonOT +asm_fce21: ; fce21 (3f:4e21) + ld a, [wWhichPokemon] + call AddNTimes + ld a, [hl] + cp PIKACHU + jr nz, .notPlayerPikachu + ld bc, wPartyMon1OTID - wPartyMon1 + add hl, bc + ld a, [wPlayerID] + cp [hl] + jr nz, .notPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .notPlayerPikachu + ld h, d + ld l, e + ld a, [wWhichPokemon] + ld bc, NAME_LENGTH + call AddNTimes + ld de, wPlayerName + ld b, $6 +.loop + dec b + jr z, .isPlayerPikachu + ld a, [de] + inc de + cp [hl] + inc hl + jr z, .loop +.notPlayerPikachu + and a + ret + +.isPlayerPikachu + scf + ret + +UpdatePikachuMoodAfterBattle:: ; fce5a (3f:4e5a) +; because d is always $82 at this function, it serves to +; ensure Pikachu's mood is at least 130 after battle + push de + call IsStarterPikachuInOurParty + pop de + ret nc + ld a, d + cp 128 + ld a, [wPikachuMood] + jr c, .d_less_than_128 ; we never jump + cp d + jr c, .load_d_into_mood + ret + +.d_less_than_128 + cp d + ret c +.load_d_into_mood + ld a, d + ld [wPikachuMood], a + ret + +CheckPikachuFaintedOrStatused:: ; fce73 (3f:4e73) +; function to test if Pikachu is alive? + xor a + ld [wWhichPokemon], a + ld hl, wPartyCount +.loop + inc hl + ld a, [hl] + cp $ff + jr z, .dead_or_not_in_party + push hl + call IsThisPartymonStarterPikachu_Party + pop hl + jr nc, .next + ld a, [wWhichPokemon] + ld hl, wPartyMon1HP + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld a, [hli] + or [hl] + ld d, a + inc hl + inc hl + ld a, [hl] ; status + and a + jr nz, .alive + jr .dead_or_not_in_party + +.next + ld a, [wWhichPokemon] + inc a + ld [wWhichPokemon], a + jr .loop + +.alive + scf + ret + +.dead_or_not_in_party + and a + ret + +IsSurfingPikachuInThePlayersParty:: ; fceab (3f:4eab) + ld hl, wPartySpecies + ld de, wPartyMon1Moves + ld bc, wPartyMonOT + push hl +.loop + pop hl + ld a, [hli] + push hl + inc a + jr z, .noSurfingPlayerPikachu + cp PIKACHU+1 + jr nz, .curMonNotSurfingPlayerPikachu + ld h, d + ld l, e + push hl + push bc + ld b, NUM_MOVES +.moveSearchLoop + ld a, [hli] + cp SURF + jr z, .foundSurfingPikachu + dec b + jr nz, .moveSearchLoop + pop bc + pop hl + jr .curMonNotSurfingPlayerPikachu + +.foundSurfingPikachu + pop bc + pop hl + inc hl + inc hl + inc hl + inc hl + ld a, [wPlayerID] + cp [hl] + jr nz, .curMonNotSurfingPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .curMonNotSurfingPlayerPikachu + push de + push bc + ld hl, wPlayerName + ld d, $6 +.nameCompareLoop + dec d + jr z, .foundSurfingPlayerPikachu + ld a, [bc] + inc bc + cp [hl] + inc hl + jr z, .nameCompareLoop + pop bc + pop de +.curMonNotSurfingPlayerPikachu + ld hl, wPartyMon2 - wPartyMon1 + add hl, de + ld d, h + ld e, l + ld hl, NAME_LENGTH + add hl, bc + ld b, h + ld c, l + jr .loop + +.foundSurfingPlayerPikachu + pop bc + pop de + pop hl + scf + ret + +.noSurfingPlayerPikachu + pop hl + and a + ret diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index c93d86df..a3a86d74 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -42,7 +42,7 @@ BillsHouseScript0: ; 1e782 (7:6782) ld a, [wd472] bit 7, a jr z, .asm_1e0d2 - callab Func_fce73 + callab CheckPikachuFaintedOrStatused jr c, .asm_1e0d2 callab Func_f24d5 .asm_1e0d2 diff --git a/scripts/fanclub.asm b/scripts/fanclub.asm index fbc6d959..d1dffea6 100755 --- a/scripts/fanclub.asm +++ b/scripts/fanclub.asm @@ -36,7 +36,7 @@ FanClubScript_59a44: ld a, [wd472] bit 7, a ret z - callab Func_fce73 + callab CheckPikachuFaintedOrStatused ret c ld a, $1 ld [W_FANCLUBCURSCRIPT], a diff --git a/scripts/pewterpokecenter2.asm b/scripts/pewterpokecenter2.asm index c884ad65..e424071a 100755 --- a/scripts/pewterpokecenter2.asm +++ b/scripts/pewterpokecenter2.asm @@ -55,7 +55,7 @@ Func_f1da4: ld a, [wd472] bit 7, a ret z - callab Func_fce73 + callab CheckPikachuFaintedOrStatused ret c call DisablePikachuFollowingPlayer ret -- cgit v1.3.1-sl0p From 48fce68a828602239d8aa7c03a726d0a2e2a591a Mon Sep 17 00:00:00 2001 From: pikalaxalt Date: Mon, 6 Jun 2016 15:42:12 -0400 Subject: Split out Pikachu-related data --- data/pikachu_emotions.asm | 266 +++++++++++++++++++++ data/pikachu_pic_animation.asm | 397 +++++++++++++++++++++++++++++++ engine/pikachu_emotions.asm | 267 +-------------------- engine/pikachu_pic_animation.asm | 489 ++------------------------------------- macros.asm | 6 + wram.asm | 15 +- 6 files changed, 701 insertions(+), 739 deletions(-) create mode 100755 data/pikachu_emotions.asm create mode 100755 data/pikachu_pic_animation.asm (limited to 'engine/pikachu_emotions.asm') diff --git a/data/pikachu_emotions.asm b/data/pikachu_emotions.asm new file mode 100755 index 00000000..a1d902c3 --- /dev/null +++ b/data/pikachu_emotions.asm @@ -0,0 +1,266 @@ +PikachuEmotion0_fd115: ; fd115 (3f:5115) + db $ff + +PikachuEmotion2_fd116: ; fd116 (3f:5116) + pikaemotion_dummy2 + pikaemotion_emotebubble SMILE_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic $2 + db $ff + +PikachuEmotion10_fd11e: ; fd11e (3f:511e) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $a + db $ff + +PikachuEmotion7_fd128: ; fd128 (3f:5128) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd224 + pikaemotion_pcm PikachuCry1 + pikaemotion_movement Pointer_fd224 + pikaemotion_pikapic $7 + db $ff + +PikachuEmotion4_fd136: ; fd136 (3f:5136) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd230 + pikaemotion_pcm PikachuCry29 + pikaemotion_pikapic $4 + db $ff + +PikachuEmotion1_fd141: ; fd141 (3f:5141) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $1 + db $ff + +PikachuEmotion8_fd147: ; fd147 (3f:5147) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry39 + pikaemotion_pikapic $8 + db $ff + +PikachuEmotion5_fd14d: ; fd14d (3f:514d) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry31 + pikaemotion_pikapic $5 + db $ff + +PikachuEmotion6_fd153: ; fd153 (3f:5153) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm + pikaemotion_movement Pointer_fd21e + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic $6 + db $ff + +PikachuEmotion3_fd160: ; fd160 (3f:5160) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry40 + pikaemotion_pikapic $3 + db $ff + +PikachuEmotion9_fd166: ; fd166 (3f:5166) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm PikachuCry6 + pikaemotion_movement Pointer_fd218 + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic $9 + db $ff + +PikachuEmotion11_fd173: ; fd173 (3f:5173) + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic $b + db $ff + +PikachuEmotion12_fd17a: ; fd17a (3f:517a) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $c + db $ff + +PikachuEmotion13_fd180: ; fd180 (3f:5180) + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement Pointer_fd21e + pikaemotion_pikapic $d + db $ff + +PikachuEmotion14_fd189: ; fd189 (3f:5189) + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry10 + pikaemotion_pikapic $e + db $ff + +PikachuEmotion15_fd191: ; fd191 (3f:5191) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry34 + pikaemotion_pikapic $f + db $ff + +PikachuEmotion16_fd197: ; fd197 (3f:5197) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic $10 + db $ff + +PikachuEmotion17_fd19d: ; fd19d (3f:519d) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry13 + pikaemotion_pikapic $11 + db $ff + +PikachuEmotion18_fd1a3: ; fd1a3 (3f:51a3) + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic $12 + db $ff + +PikachuEmotion19_fd1a9: ; fd1a9 (3f:51a9) + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic $13 + db $ff + +PikachuEmotion20_fd1b1: ; fd1b1 (3f:51b1) + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $14 + db $ff + +PikachuEmotion21_fd1b9: ; fd1b9 (3f:51b9) + pikaemotion_dummy2 + pikaemotion_emotebubble FISH_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic $15 + db $ff + +PikachuEmotion22_fd1c1: ; fd1c1 (3f:51c1) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry4 + pikaemotion_pikapic $16 + db $ff + +PikachuEmotion23_fd1c7: ; fd1c7 (3f:51c7) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic $17 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + db $ff + +PikachuEmotion24_fd1cf: ; fd1cf (3f:51cf) + pikaemotion_dummy2 + pikaemotion_emotebubble EXCLAMATION_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic $18 + db $ff + +PikachuEmotion25_fd1d7: ; fd1d7 (3f:51d7) + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic $19 + db $ff + +PikachuEmotion26_fd1df: ; fd1df (3f:51df) + pikaemotion_dummy2 + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic $1a + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER + db $ff + +PikachuEmotion27_fd1eb: ; fd1eb (3f:51eb) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry9 + pikaemotion_pikapic $1b + db $ff + +PikachuEmotion28_fd1f1: ; fd1f1 (3f:51f1) + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry15 + pikaemotion_pikapic $1c + db $ff + +PikachuEmotion29_fd1f7: ; fd1f7 (3f:51f7) + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $a + db $ff + +PikachuEmotion30_fd1fc: ; fd1fc (3f:51fc) + pikaemotion_9 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic $14 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADFONT + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER + db $ff + +PikachuEmotion31_fd20a: ; fd20a (3f:520a) + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic $17 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE + db $ff + +PikachuEmotion32_fd213: ; fd213 (3f:5213) + pikaemotion_pcm PikachuCry26 + pikaemotion_pikapic $17 + db $ff + +Pointer_fd218: ; fd218 (3f:5218) + db $00 + db $39, $01 + db $3e, $1e + db $3f + +Pointer_fd21e: ; fd21e (3f:521e) + db $00 + db $39, $00 + db $3e, $1e + db $3f + +Pointer_fd224: ; fd224 (3f:5224) + db $00 + db $3c, $07, $2f + db $3c, $07, $2f + db $3f + +Pointer_fd22c: ; fd22c (3f:522c) + db $3b, $1f, $03 + db $3f + +Pointer_fd230: ; fd230 (3f:5230) + db $00 + db $3c, $0f, $1f + db $3c, $0f, $1f + db $3f + +Pointer_fd238: ; fd238 (3f:5238) + db $00 + db $05, $07 + db $39, $00 + db $05, $07 + db $06, $07 + db $39, $00 + db $06, $07 + db $08, $07 + db $39, $00 + db $08, $07 + db $07, $07 + db $39, $00 + db $07, $07 + db $3f diff --git a/data/pikachu_pic_animation.asm b/data/pikachu_pic_animation.asm new file mode 100755 index 00000000..f1f6bd68 --- /dev/null +++ b/data/pikachu_pic_animation.asm @@ -0,0 +1,397 @@ +Data_fe242: + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db $ff + +Data_fe26b: ; fe26b (3f:626b) + pikapic_loadgfx Pic_e4000 + pikapic_loadgfx Pic_e49d1 + pikapic_loadgfx PikachuSprite + pikapic_object $1, $80, $0, $0 + pikapic_object $2, $b2, $5, $5 + pikapic_object $3, $b6, $5, $5 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe28a: ; fe28a (3f:628a) + pikapic_setduration 40 + pikapic_loadgfx Pic_e4000 + pikapic_loadgfx GFX_e40cc + pikapic_object $4, $80, $0, $0 + pikapic_object $6, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry3 + pikapic_looptofinish + +Data_fe2a4: ; fe2a4 (3f:62a4) + pikapic_setduration 44 + pikapic_loadgfx Pic_e411c + pikapic_loadgfx GFX_e41d2 + pikapic_object $4, $80, $0, $0 + pikapic_object $7, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe2be: ; fe2be (3f:62be) + pikapic_setduration 80 + pikapic_loadgfx Pic_e4272 + pikapic_loadgfx GFX_e4323 + pikapic_object $4, $80, $0, $0 + pikapic_object $8, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe2d8: ; fe2d8 (3f:62d8) + pikapic_setduration 70 + pikapic_loadgfx Pic_e4383 + pikapic_loadgfx GFX_e444b + pikapic_object $4, $80, $0, $0 + pikapic_object $9, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe2f2: ; fe2f2 (3f:62f2) + pikapic_setduration 32 + pikapic_loadgfx Pic_e458b + pikapic_loadgfx GFX_e463b + pikapic_object $4, $80, $0, $0 + pikapic_object $a, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe30c: ; fe30c (3f:630c) + pikapic_setduration 50 + pikapic_loadgfx Pic_e467b + pikapic_loadgfx GFX_e472e + pikapic_object $4, $80, $0, $0 + pikapic_object $b, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry38 + pikapic_looptofinish + +Data_fe326: ; fe326 (3f:6326) + pikapic_setduration 58 + pikapic_loadgfx Pic_e476e + pikapic_loadgfx GFX_e4841 + pikapic_object $4, $80, $0, $0 + pikapic_object $c, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe340: ; fe340 (3f:6340) + pikapic_setduration 44 + pikapic_loadgfx Pic_e49d1 + pikapic_loadgfx GFX_e4a99 + pikapic_object $4, $80, $0, $0 + pikapic_object $d, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe35a: ; fe35a (3f:635a) + pikapic_setduration 56 + pikapic_loadgfx Pic_e4b39 + pikapic_loadgfx GFX_e4bde + pikapic_object $4, $80, $0, $0 + pikapic_object $e, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe374: ; fe374 (3f:6374) + pikapic_setduration 56 + pikapic_loadgfx Pic_e4c3e + pikapic_loadgfx GFX_e4ce0 + pikapic_loadgfx GFX_e4e70 + pikapic_object $4, $80, $0, $0 + pikapic_object $10, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe390: ; fe390 (3f:6390) + pikapic_setduration 100 + pikapic_loadgfx Pic_e5000 + pikapic_loadgfx GFX_e50af + pikapic_object $4, $80, $0, $0 + pikapic_object $11, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe3aa: ; fe3aa (3f:63aa) + pikapic_setduration 50 + pikapic_loadgfx Pic_e523f + pikapic_loadgfx GFX_e52fe + pikapic_object $4, $80, $0, $0 + pikapic_object $12, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry25 + pikapic_looptofinish + +Data_fe3c4: ; fe3c4 (3f:63c4) + pikapic_setduration 50 + pikapic_loadgfx Pic_e548e + pikapic_loadgfx GFX_e5541 + pikapic_object $4, $80, $0, $0 + pikapic_object $13, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe3de: ; fe3de (3f:63de) + pikapic_setduration 40 + pikapic_loadgfx Pic_e56d1 + pikapic_loadgfx GFX_e5794 + pikapic_object $4, $80, $0, $0 + pikapic_object $14, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe3f8: ; fe3f8 (3f:63f8) + pikapic_setduration 50 + pikapic_loadgfx Pic_e5924 + pikapic_loadgfx GFX_e59ed + pikapic_object $4, $80, $0, $0 + pikapic_object $15, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe412: ; fe412 (3f:6412) + pikapic_setduration 32 + pikapic_loadgfx Pic_e5b7d + pikapic_loadgfx GFX_e5c4d + pikapic_object $4, $80, $0, $0 + pikapic_object $16, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe42c: ; fe42c (3f:642c) + pikapic_setduration 100 + pikapic_loadgfx Pic_e5ddd + pikapic_loadgfx GFX_e5e90 + pikapic_object $4, $80, $0, $0 + pikapic_object $17, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe446: ; fe446 (3f:6446) + pikapic_setduration 32 + pikapic_loadgfx GFX_e6020 + pikapic_loadgfx GFX_e61b0 + pikapic_object $5, $80, $0, $0 + pikapic_object $18, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry18 + pikapic_looptofinish + +Data_fe460: ; fe460 (3f:6460) + pikapic_setduration 44 + pikapic_loadgfx Pic_e6340 + pikapic_loadgfx GFX_e63f7 + pikapic_object $4, $80, $0, $0 + pikapic_object $19, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe47a: ; fe47a (3f:647a) + pikapic_setduration 50 + pikapic_loadgfx Pic_e6587 + pikapic_loadgfx GFX_e6646 + pikapic_object $4, $80, $0, $0 + pikapic_object $1a, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe494: ; fe494 (3f:6494) + pikapic_setduration 40 + pikapic_loadgfx Pic_e67d6 + pikapic_loadgfx GFX_e682f + pikapic_loadgfx GFX_e69bf + pikapic_loadgfx GFX_e6b4f + pikapic_loadgfx GFX_e6cdf + pikapic_object $4, $80, $0, $0 + pikapic_object $1b, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry20 + pikapic_looptofinish + +Data_fe4b4: ; fe4b4 (3f:64b4) + pikapic_setduration 40 + pikapic_loadgfx GFX_e6e6f + pikapic_loadgfx GFX_e6fff + pikapic_object $5, $80, $0, $0 + pikapic_object $1c, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe4ce: ; fe4ce (3f:64ce) + pikapic_setduration 70 + pikapic_loadgfx GFX_e718f + pikapic_loadgfx GFX_e731f + pikapic_object $5, $80, $0, $0 + pikapic_object $1d, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe4e8: ; fe4e8 (3f:64e8) + pikapic_setduration 60 + pikapic_loadgfx GFX_e74af + pikapic_loadgfx GFX_e763f + pikapic_object $5, $80, $0, $0 + pikapic_object $1e, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe502: ; fe502 (3f:6502) + pikapic_setduration 50 + pikapic_loadgfx Pic_e77cf + pikapic_loadgfx GFX_e7863 + pikapic_loadgfx GFX_e79f3 + pikapic_object $4, $80, $0, $0 + pikapic_object $1f, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_writebyte 13 + pikapic_waitbgmap + pikapic_thunderbolt + pikapic_ret + +Data_fe51f: ; fe51f (3f:651f) + pikapic_waitbgmap + +Data_fe520: ; fe520 (3f:6520) + pikapic_setduration 100 + pikapic_loadgfx Pic_e5000 + pikapic_loadgfx GFX_e50af + pikapic_loadgfx GFX_e7b83 + pikapic_loadgfx GFX_e7d13 + pikapic_object $4, $80, $0, $0 + pikapic_object $20, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe53e: ; fe53e (3f:653e) + pikapic_setduration 30 + pikapic_loadgfx Pic_f0abf + pikapic_loadgfx GFX_f0b64 + pikapic_object $4, $80, $0, $0 + pikapic_object $21, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +Data_fe558: ; fe558 (3f:6558) + pikapic_setduration 64 + pikapic_loadgfx Pic_f0cf4 + pikapic_loadgfx GFX_f0d82 + pikapic_object $4, $80, $0, $0 + pikapic_object $22, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimGFXHeaders: +pikapicanimgfx: MACRO +\2_id:: + db \1 ; size + dba \2 ; pointer + endm + + dbbw 1, $39,$0000 ; 00 + pikapicanimgfx -1, Pic_e4000 ; 01 + pikapicanimgfx 5, GFX_e40cc ; 02 + pikapicanimgfx -1, Pic_e411c ; 03 + pikapicanimgfx 10, GFX_e41d2 ; 04 + pikapicanimgfx -1, Pic_e4272 ; 05 + pikapicanimgfx 6, GFX_e4323 ; 06 + pikapicanimgfx -1, Pic_e4383 ; 07 + pikapicanimgfx 20, GFX_e444b ; 08 + pikapicanimgfx -1, Pic_e458b ; 09 + pikapicanimgfx 4, GFX_e463b ; 0a + pikapicanimgfx -1, Pic_e467b ; 0b + pikapicanimgfx 4, GFX_e472e ; 0c + pikapicanimgfx -1, Pic_e476e ; 0d + pikapicanimgfx 25, GFX_e4841 ; 0e + pikapicanimgfx -1, Pic_e49d1 ; 0f + pikapicanimgfx 10, GFX_e4a99 ; 00 + pikapicanimgfx -1, Pic_e4b39 ; 11 + pikapicanimgfx 6, GFX_e4bde ; 12 + pikapicanimgfx -1, Pic_e4c3e ; 13 + pikapicanimgfx 25, GFX_e4ce0 ; 14 + pikapicanimgfx 25, GFX_e4e70 ; 15 + pikapicanimgfx -1, Pic_e5000 ; 16 + pikapicanimgfx 25, GFX_e50af ; 17 + pikapicanimgfx -1, Pic_e523f ; 18 + pikapicanimgfx 25, GFX_e52fe ; 19 + pikapicanimgfx -1, Pic_e548e ; 1a + pikapicanimgfx 25, GFX_e5541 ; 1b + pikapicanimgfx -1, Pic_e56d1 ; 1c + pikapicanimgfx 25, GFX_e5794 ; 1d + pikapicanimgfx -1, Pic_e5924 ; 1e + pikapicanimgfx 25, GFX_e59ed ; 1f + pikapicanimgfx -1, Pic_e5b7d ; 20 + pikapicanimgfx 25, GFX_e5c4d ; 21 + pikapicanimgfx -1, Pic_e5ddd ; 22 + pikapicanimgfx 25, GFX_e5e90 ; 23 + pikapicanimgfx 25, GFX_e6020 ; 24 + pikapicanimgfx 25, GFX_e61b0 ; 25 + pikapicanimgfx -1, Pic_e6340 ; 26 + pikapicanimgfx 25, GFX_e63f7 ; 27 + pikapicanimgfx -1, Pic_e6587 ; 28 + pikapicanimgfx 25, GFX_e6646 ; 29 + pikapicanimgfx -1, Pic_e67d6 ; 2a + pikapicanimgfx 25, GFX_e682f ; 2b + pikapicanimgfx 25, GFX_e69bf ; 2c + pikapicanimgfx 25, GFX_e6b4f ; 2d + pikapicanimgfx 25, GFX_e6cdf ; 2e + pikapicanimgfx 25, GFX_e6e6f ; 2f + pikapicanimgfx 25, GFX_e6fff ; 30 + pikapicanimgfx 25, GFX_e718f ; 31 + pikapicanimgfx 25, GFX_e731f ; 32 + pikapicanimgfx 25, GFX_e74af ; 33 + pikapicanimgfx 25, GFX_e763f ; 34 + pikapicanimgfx -1, Pic_e77cf ; 35 + pikapicanimgfx 25, GFX_e7863 ; 36 + pikapicanimgfx 25, GFX_e79f3 ; 37 + pikapicanimgfx 25, GFX_e7b83 ; 38 + pikapicanimgfx 25, GFX_e7d13 ; 39 + pikapicanimgfx -1, Pic_f0abf ; 3a + pikapicanimgfx 25, GFX_f0b64 ; 3b + pikapicanimgfx -1, Pic_f0cf4 ; 3c + pikapicanimgfx 25, GFX_f0d82 ; 3d + pikapicanimgfx 24, PikachuSprite ; 3e diff --git a/engine/pikachu_emotions.asm b/engine/pikachu_emotions.asm index b474770e..9040e612 100755 --- a/engine/pikachu_emotions.asm +++ b/engine/pikachu_emotions.asm @@ -342,272 +342,7 @@ IsPlayerPikachuAsleepInParty:: ; fd0d0 (3f:50d0) and a ret -PikachuEmotion0_fd115: ; fd115 (3f:5115) - db $ff - -PikachuEmotion2_fd116: ; fd116 (3f:5116) - pikaemotion_dummy2 - pikaemotion_emotebubble SMILE_BUBBLE - pikaemotion_pcm PikachuCry35 - pikaemotion_pikapic $2 - db $ff - -PikachuEmotion10_fd11e: ; fd11e (3f:511e) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_emotebubble HEART_BUBBLE - pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $a - db $ff - -PikachuEmotion7_fd128: ; fd128 (3f:5128) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd224 - pikaemotion_pcm PikachuCry1 - pikaemotion_movement Pointer_fd224 - pikaemotion_pikapic $7 - db $ff - -PikachuEmotion4_fd136: ; fd136 (3f:5136) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd230 - pikaemotion_pcm PikachuCry29 - pikaemotion_pikapic $4 - db $ff - -PikachuEmotion1_fd141: ; fd141 (3f:5141) - pikaemotion_dummy2 - pikaemotion_pcm - pikaemotion_pikapic $1 - db $ff - -PikachuEmotion8_fd147: ; fd147 (3f:5147) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry39 - pikaemotion_pikapic $8 - db $ff - -PikachuEmotion5_fd14d: ; fd14d (3f:514d) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry31 - pikaemotion_pikapic $5 - db $ff - -PikachuEmotion6_fd153: ; fd153 (3f:5153) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_pcm - pikaemotion_movement Pointer_fd21e - pikaemotion_emotebubble SKULL_BUBBLE - pikaemotion_pikapic $6 - db $ff - -PikachuEmotion3_fd160: ; fd160 (3f:5160) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry40 - pikaemotion_pikapic $3 - db $ff - -PikachuEmotion9_fd166: ; fd166 (3f:5166) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_pcm PikachuCry6 - pikaemotion_movement Pointer_fd218 - pikaemotion_emotebubble SKULL_BUBBLE - pikaemotion_pikapic $9 - db $ff - -PikachuEmotion11_fd173: ; fd173 (3f:5173) - pikaemotion_emotebubble ZZZ_BUBBLE - pikaemotion_pcm PikachuCry37 - pikaemotion_pikapic $b - db $ff - -PikachuEmotion12_fd17a: ; fd17a (3f:517a) - pikaemotion_dummy2 - pikaemotion_pcm - pikaemotion_pikapic $c - db $ff - -PikachuEmotion13_fd180: ; fd180 (3f:5180) - pikaemotion_dummy2 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd21e - pikaemotion_pikapic $d - db $ff - -PikachuEmotion14_fd189: ; fd189 (3f:5189) - pikaemotion_dummy2 - pikaemotion_emotebubble BOLT_BUBBLE - pikaemotion_pcm PikachuCry10 - pikaemotion_pikapic $e - db $ff - -PikachuEmotion15_fd191: ; fd191 (3f:5191) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry34 - pikaemotion_pikapic $f - db $ff - -PikachuEmotion16_fd197: ; fd197 (3f:5197) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry33 - pikaemotion_pikapic $10 - db $ff - -PikachuEmotion17_fd19d: ; fd19d (3f:519d) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry13 - pikaemotion_pikapic $11 - db $ff - -PikachuEmotion18_fd1a3: ; fd1a3 (3f:51a3) - pikaemotion_dummy2 - pikaemotion_pcm - pikaemotion_pikapic $12 - db $ff - -PikachuEmotion19_fd1a9: ; fd1a9 (3f:51a9) - pikaemotion_dummy2 - pikaemotion_emotebubble HEART_BUBBLE - pikaemotion_pcm PikachuCry33 - pikaemotion_pikapic $13 - db $ff - -PikachuEmotion20_fd1b1: ; fd1b1 (3f:51b1) - pikaemotion_dummy2 - pikaemotion_emotebubble HEART_BUBBLE - pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $14 - db $ff - -PikachuEmotion21_fd1b9: ; fd1b9 (3f:51b9) - pikaemotion_dummy2 - pikaemotion_emotebubble FISH_BUBBLE - pikaemotion_pcm - pikaemotion_pikapic $15 - db $ff - -PikachuEmotion22_fd1c1: ; fd1c1 (3f:51c1) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry4 - pikaemotion_pikapic $16 - db $ff - -PikachuEmotion23_fd1c7: ; fd1c7 (3f:51c7) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry19 - pikaemotion_pikapic $17 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW - db $ff - -PikachuEmotion24_fd1cf: ; fd1cf (3f:51cf) - pikaemotion_dummy2 - pikaemotion_emotebubble EXCLAMATION_BUBBLE - pikaemotion_pcm - pikaemotion_pikapic $18 - db $ff - -PikachuEmotion25_fd1d7: ; fd1d7 (3f:51d7) - pikaemotion_dummy2 - pikaemotion_emotebubble BOLT_BUBBLE - pikaemotion_pcm PikachuCry35 - pikaemotion_pikapic $19 - db $ff - -PikachuEmotion26_fd1df: ; fd1df (3f:51df) - pikaemotion_dummy2 - pikaemotion_emotebubble ZZZ_BUBBLE - pikaemotion_pcm PikachuCry37 - pikaemotion_pikapic $1a - pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW - pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER - db $ff - -PikachuEmotion27_fd1eb: ; fd1eb (3f:51eb) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry9 - pikaemotion_pikapic $1b - db $ff - -PikachuEmotion28_fd1f1: ; fd1f1 (3f:51f1) - pikaemotion_dummy2 - pikaemotion_pcm PikachuCry15 - pikaemotion_pikapic $1c - db $ff - -PikachuEmotion29_fd1f7: ; fd1f7 (3f:51f7) - pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $a - db $ff - -PikachuEmotion30_fd1fc: ; fd1fc (3f:51fc) - pikaemotion_9 - pikaemotion_emotebubble HEART_BUBBLE - pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $14 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW - pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADFONT - pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER - db $ff - -PikachuEmotion31_fd20a: ; fd20a (3f:520a) - pikaemotion_pcm PikachuCry19 - pikaemotion_pikapic $17 - pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW - pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE - db $ff - -PikachuEmotion32_fd213: ; fd213 (3f:5213) - pikaemotion_pcm PikachuCry26 - pikaemotion_pikapic $17 - db $ff - -Pointer_fd218: ; fd218 (3f:5218) - db $00 - db $39, $01 - db $3e, $1e - db $3f - -Pointer_fd21e: ; fd21e (3f:521e) - db $00 - db $39, $00 - db $3e, $1e - db $3f - -Pointer_fd224: ; fd224 (3f:5224) - db $00 - db $3c, $07, $2f - db $3c, $07, $2f - db $3f - -Pointer_fd22c: ; fd22c (3f:522c) - db $3b, $1f, $03 - db $3f - -Pointer_fd230: ; fd230 (3f:5230) - db $00 - db $3c, $0f, $1f - db $3c, $0f, $1f - db $3f - -Pointer_fd238: ; fd238 (3f:5238) - db $00 - db $05, $07 - db $39, $00 - db $05, $07 - db $06, $07 - db $39, $00 - db $06, $07 - db $08, $07 - db $39, $00 - db $08, $07 - db $07, $07 - db $39, $00 - db $07, $07 - db $3f +INCLUDE "data/pikachu_emotions.asm" Func_fd252: ; fd252 (3f:5252) ld a, $40 diff --git a/engine/pikachu_pic_animation.asm b/engine/pikachu_pic_animation.asm index 226049f2..1ec102f1 100755 --- a/engine/pikachu_pic_animation.asm +++ b/engine/pikachu_pic_animation.asm @@ -62,26 +62,26 @@ StarterPikachuEmotionCommand_pikapic: ; fd9d0 (3f:59d0) ret Func_fd9e4: - call Func_fda2c + call PlacePikapicTextBoxBorder callab LoadOverworldPikachuFrontpicPalettes - call Func_fd9ff + call ResetPikaPicAnimBuffer call LoadCurrentPikaPicAnimScriptPointer call Func_fda9a - call Func_fda2c + call PlacePikapicTextBoxBorder call RunDefaultPaletteCommand ret -Func_fd9ff: - ld hl, wPikaPicAnimPointer - ld bc, $11 +ResetPikaPicAnimBuffer: + ld hl, wCurPikaMovementData + ld bc, wCurPikaMovementDataEnd - wCurPikaMovementData xor a call FillMemory ld hl, wPikaPicAnimObjectDataBufferSize - ld bc, $21 + ld bc, wPikaPicAnimObjectDataBufferEnd - wPikaPicAnimObjectDataBufferSize xor a call FillMemory - call Func_fe15c - ld hl, $64 + call ClearPikaPicUsedGFXBuffer + ld hl, 100 ld a, l ld [wPikaPicAnimTimer], a ld a, h @@ -92,7 +92,7 @@ Func_fd9ff: ld [wPikaPicTextboxStartY], a ret -Func_fda2c: +PlacePikapicTextBoxBorder: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 6, 5 @@ -1121,9 +1121,9 @@ DecompressRequestPikaPicAnimGFX: ; fe128 .failed ret -Func_fe15c: - ld hl, wNPCMovementDirections - ld bc, $11 +ClearPikaPicUsedGFXBuffer: + ld hl, wPikaPicUsedGFXCount + ld bc, wPikaPicUsedGFXEnd - wPikaPicUsedGFXCount xor a call FillMemory ret @@ -1146,7 +1146,7 @@ GetPikaPicVRAMAddressForNewGFX: CheckIfThereIsRoomForPikaPicAnimGFX: push bc push hl - ld hl, wNPCMovementDirections + 1 + ld hl, wPikaPicUsedGFX ld c, 8 .loop ld a, [hl] @@ -1169,12 +1169,12 @@ CheckIfThereIsRoomForPikaPicAnimGFX: .empty ld [hl], d inc hl - ld a, [wNPCMovementDirections] + ld a, [wPikaPicUsedGFXCount] add $80 ld [hl], a - ld a, [wNPCMovementDirections] + ld a, [wPikaPicUsedGFXCount] add e - ld [wNPCMovementDirections], a + ld [wPikaPicUsedGFXCount], a cp $80 jr z, .asm_fe1a7 jr nc, .failed @@ -1194,7 +1194,7 @@ LookUpTileOffsetForCurrentPikaPicAnimGFX: push bc push hl ld b, a - ld hl, wNPCMovementDirections + 1 + ld hl, wPikaPicUsedGFX ld c, 8 .loop ld a, [hli] @@ -1284,455 +1284,4 @@ GetDMGBGPalForPikaThunderbolt: call DelayFrames ret -Data_fe242: - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db 4, %11000000 - db 4, %11100100 - db $ff - -Data_fe26b: ; fe26b (3f:626b) - pikapic_loadgfx Pic_e4000 - pikapic_loadgfx Pic_e49d1 - pikapic_loadgfx PikachuSprite - pikapic_object $1, $80, $0, $0 - pikapic_object $2, $b2, $5, $5 - pikapic_object $3, $b6, $5, $5 - pikapic_waitbgmap - pikapic_cry -Data_fe286: ; fe286 (3f:6286) - pikapic_waitbgmap - pikapic_jump Data_fe286 - -Data_fe28a: ; fe28a (3f:628a) - pikapic_setduration 40 - pikapic_loadgfx Pic_e4000 - pikapic_loadgfx GFX_e40cc - pikapic_object $4, $80, $0, $0 - pikapic_object $6, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry PikachuCry3 -Data_fe2a0: ; fe2a0 (3f:62a0) - pikapic_waitbgmap - pikapic_jump Data_fe2a0 - -Data_fe2a4: ; fe2a4 (3f:62a4) - pikapic_setduration 44 - pikapic_loadgfx Pic_e411c - pikapic_loadgfx GFX_e41d2 - pikapic_object $4, $80, $0, $0 - pikapic_object $7, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe2ba: ; fe2ba (3f:62ba) - pikapic_waitbgmap - pikapic_jump Data_fe2ba - -Data_fe2be: ; fe2be (3f:62be) - pikapic_setduration 80 - pikapic_loadgfx Pic_e4272 - pikapic_loadgfx GFX_e4323 - pikapic_object $4, $80, $0, $0 - pikapic_object $8, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe2d4: ; fe2d4 (3f:62d4) - pikapic_waitbgmap - pikapic_jump Data_fe2d4 - -Data_fe2d8: ; fe2d8 (3f:62d8) - pikapic_setduration 70 - pikapic_loadgfx Pic_e4383 - pikapic_loadgfx GFX_e444b - pikapic_object $4, $80, $0, $0 - pikapic_object $9, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe2ee: ; fe2ee (3f:62ee) - pikapic_waitbgmap - pikapic_jump Data_fe2ee - -Data_fe2f2: ; fe2f2 (3f:62f2) - pikapic_setduration 32 - pikapic_loadgfx Pic_e458b - pikapic_loadgfx GFX_e463b - pikapic_object $4, $80, $0, $0 - pikapic_object $a, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe308: ; fe308 (3f:6308) - pikapic_waitbgmap - pikapic_jump Data_fe308 - -Data_fe30c: ; fe30c (3f:630c) - pikapic_setduration 50 - pikapic_loadgfx Pic_e467b - pikapic_loadgfx GFX_e472e - pikapic_object $4, $80, $0, $0 - pikapic_object $b, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry PikachuCry38 -Data_fe322: ; fe322 (3f:6322) - pikapic_waitbgmap - pikapic_jump Data_fe322 - -Data_fe326: ; fe326 (3f:6326) - pikapic_setduration 58 - pikapic_loadgfx Pic_e476e - pikapic_loadgfx GFX_e4841 - pikapic_object $4, $80, $0, $0 - pikapic_object $c, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe33c: ; fe33c (3f:633c) - pikapic_waitbgmap - pikapic_jump Data_fe33c - -Data_fe340: ; fe340 (3f:6340) - pikapic_setduration 44 - pikapic_loadgfx Pic_e49d1 - pikapic_loadgfx GFX_e4a99 - pikapic_object $4, $80, $0, $0 - pikapic_object $d, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe356: ; fe356 (3f:6356) - pikapic_waitbgmap - pikapic_jump Data_fe356 - -Data_fe35a: ; fe35a (3f:635a) - pikapic_setduration 56 - pikapic_loadgfx Pic_e4b39 - pikapic_loadgfx GFX_e4bde - pikapic_object $4, $80, $0, $0 - pikapic_object $e, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe370: ; fe370 (3f:6370) - pikapic_waitbgmap - pikapic_jump Data_fe370 - -Data_fe374: ; fe374 (3f:6374) - pikapic_setduration 56 - pikapic_loadgfx Pic_e4c3e - pikapic_loadgfx GFX_e4ce0 - pikapic_loadgfx GFX_e4e70 - pikapic_object $4, $80, $0, $0 - pikapic_object $10, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe38c: ; fe38c (3f:638c) - pikapic_waitbgmap - pikapic_jump Data_fe38c - -Data_fe390: ; fe390 (3f:6390) - pikapic_setduration 100 - pikapic_loadgfx Pic_e5000 - pikapic_loadgfx GFX_e50af - pikapic_object $4, $80, $0, $0 - pikapic_object $11, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe3a6: ; fe3a6 (3f:63a6) - pikapic_waitbgmap - pikapic_jump Data_fe3a6 - -Data_fe3aa: ; fe3aa (3f:63aa) - pikapic_setduration 50 - pikapic_loadgfx Pic_e523f - pikapic_loadgfx GFX_e52fe - pikapic_object $4, $80, $0, $0 - pikapic_object $12, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry PikachuCry25 -Data_fe3c0: ; fe3c0 (3f:63c0) - pikapic_waitbgmap - pikapic_jump Data_fe3c0 - -Data_fe3c4: ; fe3c4 (3f:63c4) - pikapic_setduration 50 - pikapic_loadgfx Pic_e548e - pikapic_loadgfx GFX_e5541 - pikapic_object $4, $80, $0, $0 - pikapic_object $13, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe3da: ; fe3da (3f:63da) - pikapic_waitbgmap - pikapic_jump Data_fe3da - -Data_fe3de: ; fe3de (3f:63de) - pikapic_setduration 40 - pikapic_loadgfx Pic_e56d1 - pikapic_loadgfx GFX_e5794 - pikapic_object $4, $80, $0, $0 - pikapic_object $14, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe3f4: ; fe3f4 (3f:63f4) - pikapic_waitbgmap - pikapic_jump Data_fe3f4 - -Data_fe3f8: ; fe3f8 (3f:63f8) - pikapic_setduration 50 - pikapic_loadgfx Pic_e5924 - pikapic_loadgfx GFX_e59ed - pikapic_object $4, $80, $0, $0 - pikapic_object $15, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe40e: ; fe40e (3f:640e) - pikapic_waitbgmap - pikapic_jump Data_fe40e - -Data_fe412: ; fe412 (3f:6412) - pikapic_setduration 32 - pikapic_loadgfx Pic_e5b7d - pikapic_loadgfx GFX_e5c4d - pikapic_object $4, $80, $0, $0 - pikapic_object $16, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe428: ; fe428 (3f:6428) - pikapic_waitbgmap - pikapic_jump Data_fe428 - -Data_fe42c: ; fe42c (3f:642c) - pikapic_setduration 100 - pikapic_loadgfx Pic_e5ddd - pikapic_loadgfx GFX_e5e90 - pikapic_object $4, $80, $0, $0 - pikapic_object $17, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe442: ; fe442 (3f:6442) - pikapic_waitbgmap - pikapic_jump Data_fe442 - -Data_fe446: ; fe446 (3f:6446) - pikapic_setduration 32 - pikapic_loadgfx GFX_e6020 - pikapic_loadgfx GFX_e61b0 - pikapic_object $5, $80, $0, $0 - pikapic_object $18, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry PikachuCry18 -Data_fe45c: ; fe45c (3f:645c) - pikapic_waitbgmap - pikapic_jump Data_fe45c - -Data_fe460: ; fe460 (3f:6460) - pikapic_setduration 44 - pikapic_loadgfx Pic_e6340 - pikapic_loadgfx GFX_e63f7 - pikapic_object $4, $80, $0, $0 - pikapic_object $19, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe476: ; fe476 (3f:6476) - pikapic_waitbgmap - pikapic_jump Data_fe476 - -Data_fe47a: ; fe47a (3f:647a) - pikapic_setduration 50 - pikapic_loadgfx Pic_e6587 - pikapic_loadgfx GFX_e6646 - pikapic_object $4, $80, $0, $0 - pikapic_object $1a, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe490: ; fe490 (3f:6490) - pikapic_waitbgmap - pikapic_jump Data_fe490 - -Data_fe494: ; fe494 (3f:6494) - pikapic_setduration 40 - pikapic_loadgfx Pic_e67d6 - pikapic_loadgfx GFX_e682f - pikapic_loadgfx GFX_e69bf - pikapic_loadgfx GFX_e6b4f - pikapic_loadgfx GFX_e6cdf - pikapic_object $4, $80, $0, $0 - pikapic_object $1b, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry PikachuCry20 -Data_fe4b0: ; fe4b0 (3f:64b0) - pikapic_waitbgmap - pikapic_jump Data_fe4b0 - -Data_fe4b4: ; fe4b4 (3f:64b4) - pikapic_setduration 40 - pikapic_loadgfx GFX_e6e6f - pikapic_loadgfx GFX_e6fff - pikapic_object $5, $80, $0, $0 - pikapic_object $1c, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe4ca: ; fe4ca (3f:64ca) - pikapic_waitbgmap - pikapic_jump Data_fe4ca - -Data_fe4ce: ; fe4ce (3f:64ce) - pikapic_setduration 70 - pikapic_loadgfx GFX_e718f - pikapic_loadgfx GFX_e731f - pikapic_object $5, $80, $0, $0 - pikapic_object $1d, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe4e4: ; fe4e4 (3f:64e4) - pikapic_waitbgmap - pikapic_jump Data_fe4e4 - -Data_fe4e8: ; fe4e8 (3f:64e8) - pikapic_setduration 60 - pikapic_loadgfx GFX_e74af - pikapic_loadgfx GFX_e763f - pikapic_object $5, $80, $0, $0 - pikapic_object $1e, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe4fe: ; fe4fe (3f:64fe) - pikapic_waitbgmap - pikapic_jump Data_fe4fe - -Data_fe502: ; fe502 (3f:6502) - pikapic_setduration 50 - pikapic_loadgfx Pic_e77cf - pikapic_loadgfx GFX_e7863 - pikapic_loadgfx GFX_e79f3 - pikapic_object $4, $80, $0, $0 - pikapic_object $1f, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry - pikapic_writebyte 13 - pikapic_waitbgmap - pikapic_thunderbolt - pikapic_ret - -Data_fe51f: ; fe51f (3f:651f) - pikapic_waitbgmap -Data_fe520: ; fe520 (3f:6520) - pikapic_setduration 100 - pikapic_loadgfx Pic_e5000 - pikapic_loadgfx GFX_e50af - pikapic_loadgfx GFX_e7b83 - pikapic_loadgfx GFX_e7d13 - pikapic_object $4, $80, $0, $0 - pikapic_object $20, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe53a: ; fe53a (3f:653a) - pikapic_waitbgmap - pikapic_jump Data_fe53a - -Data_fe53e: ; fe53e (3f:653e) - pikapic_setduration 30 - pikapic_loadgfx Pic_f0abf - pikapic_loadgfx GFX_f0b64 - pikapic_object $4, $80, $0, $0 - pikapic_object $21, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe554: ; fe554 (3f:6554) - pikapic_waitbgmap - pikapic_jump Data_fe554 - -Data_fe558: ; fe558 (3f:6558) - pikapic_setduration 64 - pikapic_loadgfx Pic_f0cf4 - pikapic_loadgfx GFX_f0d82 - pikapic_object $4, $80, $0, $0 - pikapic_object $22, $99, $0, $0 - pikapic_waitbgmap - pikapic_cry -Data_fe56e: ; fe56e (3f:656e) - pikapic_waitbgmap - pikapic_jump Data_fe56e - -PikaPicAnimGFXHeaders: -pikapicanimgfx: MACRO -\2_id:: - db \1 - dba \2 - endm - - dbbw $01, $39, $0000 - pikapicanimgfx -1, Pic_e4000 ; 01 - pikapicanimgfx 5, GFX_e40cc ; 02 - pikapicanimgfx -1, Pic_e411c ; 03 - pikapicanimgfx 10, GFX_e41d2 ; 04 - pikapicanimgfx -1, Pic_e4272 ; 05 - pikapicanimgfx 6, GFX_e4323 ; 06 - pikapicanimgfx -1, Pic_e4383 ; 07 - pikapicanimgfx 20, GFX_e444b ; 08 - pikapicanimgfx -1, Pic_e458b ; 09 - pikapicanimgfx 4, GFX_e463b ; 0a - pikapicanimgfx -1, Pic_e467b ; 0b - pikapicanimgfx 4, GFX_e472e ; 0c - pikapicanimgfx -1, Pic_e476e ; 0d - pikapicanimgfx 25, GFX_e4841 ; 0e - pikapicanimgfx -1, Pic_e49d1 ; 0f - pikapicanimgfx 10, GFX_e4a99 ; 00 - pikapicanimgfx -1, Pic_e4b39 ; 11 - pikapicanimgfx 6, GFX_e4bde ; 12 - pikapicanimgfx -1, Pic_e4c3e ; 13 - pikapicanimgfx 25, GFX_e4ce0 ; 14 - pikapicanimgfx 25, GFX_e4e70 ; 15 - pikapicanimgfx -1, Pic_e5000 ; 16 - pikapicanimgfx 25, GFX_e50af ; 17 - pikapicanimgfx -1, Pic_e523f ; 18 - pikapicanimgfx 25, GFX_e52fe ; 19 - pikapicanimgfx -1, Pic_e548e ; 1a - pikapicanimgfx 25, GFX_e5541 ; 1b - pikapicanimgfx -1, Pic_e56d1 ; 1c - pikapicanimgfx 25, GFX_e5794 ; 1d - pikapicanimgfx -1, Pic_e5924 ; 1e - pikapicanimgfx 25, GFX_e59ed ; 1f - pikapicanimgfx -1, Pic_e5b7d ; 20 - pikapicanimgfx 25, GFX_e5c4d ; 21 - pikapicanimgfx -1, Pic_e5ddd ; 22 - pikapicanimgfx 25, GFX_e5e90 ; 23 - pikapicanimgfx 25, GFX_e6020 ; 24 - pikapicanimgfx 25, GFX_e61b0 ; 25 - pikapicanimgfx -1, Pic_e6340 ; 26 - pikapicanimgfx 25, GFX_e63f7 ; 27 - pikapicanimgfx -1, Pic_e6587 ; 28 - pikapicanimgfx 25, GFX_e6646 ; 29 - pikapicanimgfx -1, Pic_e67d6 ; 2a - pikapicanimgfx 25, GFX_e682f ; 2b - pikapicanimgfx 25, GFX_e69bf ; 2c - pikapicanimgfx 25, GFX_e6b4f ; 2d - pikapicanimgfx 25, GFX_e6cdf ; 2e - pikapicanimgfx 25, GFX_e6e6f ; 2f - pikapicanimgfx 25, GFX_e6fff ; 30 - pikapicanimgfx 25, GFX_e718f ; 31 - pikapicanimgfx 25, GFX_e731f ; 32 - pikapicanimgfx 25, GFX_e74af ; 33 - pikapicanimgfx 25, GFX_e763f ; 34 - pikapicanimgfx -1, Pic_e77cf ; 35 - pikapicanimgfx 25, GFX_e7863 ; 36 - pikapicanimgfx 25, GFX_e79f3 ; 37 - pikapicanimgfx 25, GFX_e7b83 ; 38 - pikapicanimgfx 25, GFX_e7d13 ; 39 - pikapicanimgfx -1, Pic_f0abf ; 3a - pikapicanimgfx 25, GFX_f0b64 ; 3b - pikapicanimgfx -1, Pic_f0cf4 ; 3c - pikapicanimgfx 25, GFX_f0d82 ; 3d - pikapicanimgfx 24, PikachuSprite ; 3e +INCLUDE "data/pikachu_pic_animation.asm" diff --git a/macros.asm b/macros.asm index b0c38140..3d51f030 100644 --- a/macros.asm +++ b/macros.asm @@ -942,3 +942,9 @@ pikapic_waitbgmap: macro ; d pikapic_ret: macro ; e db pikapic_ret_command endm + +pikapic_looptofinish: macro +.loop\@ + pikapic_waitbgmap + pikapic_jump .loop\@ + endm diff --git a/wram.asm b/wram.asm index 6dd0cdba..3136ffd8 100755 --- a/wram.asm +++ b/wram.asm @@ -790,8 +790,11 @@ wAnimationType:: ; cc5b ; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... wNPCMovementDirections:: ; cc5b + +wPikaPicUsedGFXCount:: ; cc5b ds 1 +wPikaPicUsedGFX:: ; cc5c wDexRatingNumMonsOwned:: ; cc5c ds 1 @@ -804,7 +807,9 @@ wSlotMachineSavedROMBank:: ; cc5e ; ROM back to return to when the player is done with the slot machine ds 1 - ds 26 + ds 13 +wPikaPicUsedGFXEnd:: ; cc6c + ds 13 wAnimPalette:: ; cc79 ds 1 @@ -833,7 +838,9 @@ wPikaPicAnimObjectDataBuffer:: ; cc98 wNumStepsToTake:: ; cca1 ; used in Pallet Town scripted movement - ds 49 + ds 23 +wPikaPicAnimObjectDataBufferEnd:: ;ccb8 + ds 26 wRLEByteCount:: ; ccd2 ds 1 @@ -2834,7 +2841,9 @@ wd458:: ds 1 ; d458 wCurPikaPicAnimObject:: ; d459 wCurPikaPicAnimObjectIndex:: ds 1 wCurPikaPicAnimObjectGraphicID:: dw - ds 19 + ds 2 +wCurPikaMovementDataEnd:: + ds 17 wPikachuHappiness:: ds 1 ; d46f wPikachuMood:: ds 1 ; d470 -- cgit v1.3.1-sl0p