diff options
-rw-r--r-- | constants/pikachu_emotion_constants.asm | 126 | ||||
-rwxr-xr-x | data/pikachu_emotions.asm | 154 | ||||
-rw-r--r-- | engine/bank3c.asm | 158 | ||||
-rwxr-xr-x | engine/hidden_object_functions17.asm | 2 | ||||
-rwxr-xr-x | engine/items/items.asm | 4 | ||||
-rwxr-xr-x | engine/overworld/pokecenter.asm | 2 | ||||
-rwxr-xr-x | engine/pikachu_emotions.asm | 171 | ||||
-rwxr-xr-x | engine/pikachu_pic_animation.asm | 4 | ||||
-rwxr-xr-x | engine/vermilion_gym_trash_cans.asm | 108 | ||||
-rw-r--r-- | home.asm | 6 | ||||
-rw-r--r-- | home/overworld.asm | 4 | ||||
-rw-r--r-- | macros.asm | 118 | ||||
-rwxr-xr-x | scripts/celadongamecorner2.asm | 12 | ||||
-rwxr-xr-x | scripts/pokemontower2_2.asm | 12 |
14 files changed, 449 insertions, 432 deletions
diff --git a/constants/pikachu_emotion_constants.asm b/constants/pikachu_emotion_constants.asm index c34a08f7..a8ed4cea 100644 --- a/constants/pikachu_emotion_constants.asm +++ b/constants/pikachu_emotion_constants.asm @@ -1,3 +1,19 @@ +dpikapic: macro + db (\1_id - PikaPicAnimPointers) / 2 + endm + +ldpikapic: macro + ld \1, (\2_id - PikaPicAnimPointers) / 2 + endm + +dpikaemotion: macro + db (\1_id - PikachuEmotionTable) / 2 + endm + +ldpikaemotion: macro + ld \1, (\2_id - PikachuEmotionTable) / 2 + endm + ; Starter Pikachu emotion commands constants const_value = 0 @@ -54,7 +70,7 @@ ENDM pikaemotion_pikapic: MACRO db PIKAEMOTION_5 - db \1 + dpikapic \1 ENDM pikaemotion_subcmd: MACRO @@ -77,4 +93,110 @@ ENDM pikaemotion_dummy3: MACRO db PIKAEMOTION_DUMMY3 -ENDM
\ No newline at end of file +ENDM + +pikacry_def: MACRO +\1_id:: dba \1 +endm + +dpikacry: MACRO + db (\1_id - PikachuCriesPointerTable) / 3 + endm + +ldpikacry: MACRO + ld \1, (\2_id - PikachuCriesPointerTable) / 3 + ENDM + +pikacry: MACRO + ldpikacry a, \1 + endm + + + enum_start + enum pikapic_nop_command +pikapic_nop: macro + db pikapic_nop_command + endm + + enum pikapic_writebyte_command +pikapic_writebyte: macro + db pikapic_writebyte_command, \1 + endm + + enum pikapic_loadgfx_command +pikapic_loadgfx: macro + db pikapic_loadgfx_command, (\1_id - PikaPicAnimGFXHeaders) / 4 + endm + + enum pikapic_object_command +pikapic_object: macro + db pikapic_object_command + dw \1 + db \2, \3, \4 + endm + + enum pikapic_nop4_command +pikapic_nop4: macro + db pikapic_nop4_command + endm + + enum pikapic_nop5_command +pikapic_nop5: macro + db pikapic_nop5_command + endm + + enum pikapic_waitbgmapeleteobject_command +pikapic_waitbgmapeleteobject: macro + db pikapic_waitbgmapeleteobject_command, \1 + endm + + enum pikapic_nop7_command +pikapic_nop7: macro + db pikapic_nop7_command + endm + + enum pikapic_nop8_command +pikapic_nop8: macro + db pikapic_nop8_command + endm + + enum pikapic_jump_command +pikapic_jump: macro ; 9 + dbw pikapic_jump_command, \1 + endm + + enum pikapic_setduration_command +pikapic_setduration: macro ; a + dbw pikapic_setduration_command, \1 + endm + + enum pikapic_cry_command +pikapic_cry: macro ; b + db pikapic_cry_command +IF _NARG == 0 + db $ff +else + dpikacry \1 + endc + endm + + enum pikapic_thunderbolt_command +pikapic_thunderbolt: macro ; c + db pikapic_thunderbolt_command + endm + + enum pikapic_waitbgmap_command +pikapic_waitbgmap: macro ; d + db pikapic_waitbgmap_command + endm + + enum pikapic_ret_command +pikapic_ret: macro ; e + db pikapic_ret_command + endm + +pikapic_looptofinish: macro +.loop\@ + pikapic_waitbgmap + pikapic_jump .loop\@ + endm diff --git a/data/pikachu_emotions.asm b/data/pikachu_emotions.asm index a1d902c3..0fe51be8 100755 --- a/data/pikachu_emotions.asm +++ b/data/pikachu_emotions.asm @@ -1,255 +1,255 @@ -PikachuEmotion0_fd115: ; fd115 (3f:5115) +PikachuEmotion0: ; fd115 (3f:5115) db $ff -PikachuEmotion2_fd116: ; fd116 (3f:5116) +PikachuEmotion2: ; fd116 (3f:5116) pikaemotion_dummy2 pikaemotion_emotebubble SMILE_BUBBLE pikaemotion_pcm PikachuCry35 - pikaemotion_pikapic $2 + pikaemotion_pikapic PikaPicAnimScript2 db $ff -PikachuEmotion10_fd11e: ; fd11e (3f:511e) +PikachuEmotion10: ; fd11e (3f:511e) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES pikaemotion_emotebubble HEART_BUBBLE pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $a + pikaemotion_pikapic PikaPicAnimScript10 db $ff -PikachuEmotion7_fd128: ; fd128 (3f:5128) +PikachuEmotion7: ; fd128 (3f:5128) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd224 + pikaemotion_movement PikachuMovementData_fd224 pikaemotion_pcm PikachuCry1 - pikaemotion_movement Pointer_fd224 - pikaemotion_pikapic $7 + pikaemotion_movement PikachuMovementData_fd224 + pikaemotion_pikapic PikaPicAnimScript7 db $ff -PikachuEmotion4_fd136: ; fd136 (3f:5136) +PikachuEmotion4: ; fd136 (3f:5136) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd230 + pikaemotion_movement PikachuMovementData_fd230 pikaemotion_pcm PikachuCry29 - pikaemotion_pikapic $4 + pikaemotion_pikapic PikaPicAnimScript4 db $ff -PikachuEmotion1_fd141: ; fd141 (3f:5141) +PikachuEmotion1: ; fd141 (3f:5141) pikaemotion_dummy2 pikaemotion_pcm - pikaemotion_pikapic $1 + pikaemotion_pikapic PikaPicAnimScript1 db $ff -PikachuEmotion8_fd147: ; fd147 (3f:5147) +PikachuEmotion8: ; fd147 (3f:5147) pikaemotion_dummy2 pikaemotion_pcm PikachuCry39 - pikaemotion_pikapic $8 + pikaemotion_pikapic PikaPicAnimScript8 db $ff -PikachuEmotion5_fd14d: ; fd14d (3f:514d) +PikachuEmotion5: ; fd14d (3f:514d) pikaemotion_dummy2 pikaemotion_pcm PikachuCry31 - pikaemotion_pikapic $5 + pikaemotion_pikapic PikaPicAnimScript5 db $ff -PikachuEmotion6_fd153: ; fd153 (3f:5153) +PikachuEmotion6: ; fd153 (3f:5153) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES pikaemotion_pcm - pikaemotion_movement Pointer_fd21e + pikaemotion_movement PikachuMovementData_fd21e pikaemotion_emotebubble SKULL_BUBBLE - pikaemotion_pikapic $6 + pikaemotion_pikapic PikaPicAnimScript6 db $ff -PikachuEmotion3_fd160: ; fd160 (3f:5160) +PikachuEmotion3: ; fd160 (3f:5160) pikaemotion_dummy2 pikaemotion_pcm PikachuCry40 - pikaemotion_pikapic $3 + pikaemotion_pikapic PikaPicAnimScript3 db $ff -PikachuEmotion9_fd166: ; fd166 (3f:5166) +PikachuEmotion9: ; fd166 (3f:5166) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES pikaemotion_pcm PikachuCry6 - pikaemotion_movement Pointer_fd218 + pikaemotion_movement PikachuMovementData_fd218 pikaemotion_emotebubble SKULL_BUBBLE - pikaemotion_pikapic $9 + pikaemotion_pikapic PikaPicAnimScript9 db $ff -PikachuEmotion11_fd173: ; fd173 (3f:5173) +PikachuEmotion11: ; fd173 (3f:5173) pikaemotion_emotebubble ZZZ_BUBBLE pikaemotion_pcm PikachuCry37 - pikaemotion_pikapic $b + pikaemotion_pikapic PikaPicAnimScript11 db $ff -PikachuEmotion12_fd17a: ; fd17a (3f:517a) +PikachuEmotion12: ; fd17a (3f:517a) pikaemotion_dummy2 pikaemotion_pcm - pikaemotion_pikapic $c + pikaemotion_pikapic PikaPicAnimScript12 db $ff -PikachuEmotion13_fd180: ; fd180 (3f:5180) +PikachuEmotion13: ; fd180 (3f:5180) pikaemotion_dummy2 pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES - pikaemotion_movement Pointer_fd21e - pikaemotion_pikapic $d + pikaemotion_movement PikachuMovementData_fd21e + pikaemotion_pikapic PikaPicAnimScript13 db $ff -PikachuEmotion14_fd189: ; fd189 (3f:5189) +PikachuEmotion14: ; fd189 (3f:5189) pikaemotion_dummy2 pikaemotion_emotebubble BOLT_BUBBLE pikaemotion_pcm PikachuCry10 - pikaemotion_pikapic $e + pikaemotion_pikapic PikaPicAnimScript14 db $ff -PikachuEmotion15_fd191: ; fd191 (3f:5191) +PikachuEmotion15: ; fd191 (3f:5191) pikaemotion_dummy2 pikaemotion_pcm PikachuCry34 - pikaemotion_pikapic $f + pikaemotion_pikapic PikaPicAnimScript15 db $ff -PikachuEmotion16_fd197: ; fd197 (3f:5197) +PikachuEmotion16: ; fd197 (3f:5197) pikaemotion_dummy2 pikaemotion_pcm PikachuCry33 - pikaemotion_pikapic $10 + pikaemotion_pikapic PikaPicAnimScript16 db $ff -PikachuEmotion17_fd19d: ; fd19d (3f:519d) +PikachuEmotion17: ; fd19d (3f:519d) pikaemotion_dummy2 pikaemotion_pcm PikachuCry13 - pikaemotion_pikapic $11 + pikaemotion_pikapic PikaPicAnimScript17 db $ff -PikachuEmotion18_fd1a3: ; fd1a3 (3f:51a3) +PikachuEmotion18: ; fd1a3 (3f:51a3) pikaemotion_dummy2 pikaemotion_pcm - pikaemotion_pikapic $12 + pikaemotion_pikapic PikaPicAnimScript18 db $ff -PikachuEmotion19_fd1a9: ; fd1a9 (3f:51a9) +PikachuEmotion19: ; fd1a9 (3f:51a9) pikaemotion_dummy2 pikaemotion_emotebubble HEART_BUBBLE pikaemotion_pcm PikachuCry33 - pikaemotion_pikapic $13 + pikaemotion_pikapic PikaPicAnimScript19 db $ff -PikachuEmotion20_fd1b1: ; fd1b1 (3f:51b1) +PikachuEmotion20: ; fd1b1 (3f:51b1) pikaemotion_dummy2 pikaemotion_emotebubble HEART_BUBBLE pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $14 + pikaemotion_pikapic PikaPicAnimScript20 db $ff -PikachuEmotion21_fd1b9: ; fd1b9 (3f:51b9) +PikachuEmotion21: ; fd1b9 (3f:51b9) pikaemotion_dummy2 pikaemotion_emotebubble FISH_BUBBLE pikaemotion_pcm - pikaemotion_pikapic $15 + pikaemotion_pikapic PikaPicAnimScript21 db $ff -PikachuEmotion22_fd1c1: ; fd1c1 (3f:51c1) +PikachuEmotion22: ; fd1c1 (3f:51c1) pikaemotion_dummy2 pikaemotion_pcm PikachuCry4 - pikaemotion_pikapic $16 + pikaemotion_pikapic PikaPicAnimScript22 db $ff -PikachuEmotion23_fd1c7: ; fd1c7 (3f:51c7) +PikachuEmotion23: ; fd1c7 (3f:51c7) pikaemotion_dummy2 pikaemotion_pcm PikachuCry19 - pikaemotion_pikapic $17 + pikaemotion_pikapic PikaPicAnimScript23 pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW db $ff -PikachuEmotion24_fd1cf: ; fd1cf (3f:51cf) +PikachuEmotion24: ; fd1cf (3f:51cf) pikaemotion_dummy2 pikaemotion_emotebubble EXCLAMATION_BUBBLE pikaemotion_pcm - pikaemotion_pikapic $18 + pikaemotion_pikapic PikaPicAnimScript24 db $ff -PikachuEmotion25_fd1d7: ; fd1d7 (3f:51d7) +PikachuEmotion25: ; fd1d7 (3f:51d7) pikaemotion_dummy2 pikaemotion_emotebubble BOLT_BUBBLE pikaemotion_pcm PikachuCry35 - pikaemotion_pikapic $19 + pikaemotion_pikapic PikaPicAnimScript25 db $ff -PikachuEmotion26_fd1df: ; fd1df (3f:51df) +PikachuEmotion26: ; fd1df (3f:51df) pikaemotion_dummy2 pikaemotion_emotebubble ZZZ_BUBBLE pikaemotion_pcm PikachuCry37 - pikaemotion_pikapic $1a + pikaemotion_pikapic PikaPicAnimScript26 pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER db $ff -PikachuEmotion27_fd1eb: ; fd1eb (3f:51eb) +PikachuEmotion27: ; fd1eb (3f:51eb) pikaemotion_dummy2 pikaemotion_pcm PikachuCry9 - pikaemotion_pikapic $1b + pikaemotion_pikapic PikaPicAnimScript27 db $ff -PikachuEmotion28_fd1f1: ; fd1f1 (3f:51f1) +PikachuEmotion28: ; fd1f1 (3f:51f1) pikaemotion_dummy2 pikaemotion_pcm PikachuCry15 - pikaemotion_pikapic $1c + pikaemotion_pikapic PikaPicAnimScript28 db $ff -PikachuEmotion29_fd1f7: ; fd1f7 (3f:51f7) +PikachuEmotion29: ; fd1f7 (3f:51f7) pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $a + pikaemotion_pikapic PikaPicAnimScript10 db $ff -PikachuEmotion30_fd1fc: ; fd1fc (3f:51fc) +PikachuEmotion30: ; fd1fc (3f:51fc) pikaemotion_9 pikaemotion_emotebubble HEART_BUBBLE pikaemotion_pcm PikachuCry5 - pikaemotion_pikapic $14 + pikaemotion_pikapic PikaPicAnimScript20 pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADFONT pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER db $ff -PikachuEmotion31_fd20a: ; fd20a (3f:520a) +PikachuEmotion31: ; fd20a (3f:520a) pikaemotion_pcm PikachuCry19 - pikaemotion_pikapic $17 + pikaemotion_pikapic PikaPicAnimScript23 pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE db $ff -PikachuEmotion32_fd213: ; fd213 (3f:5213) +PikachuEmotion32: ; fd213 (3f:5213) pikaemotion_pcm PikachuCry26 - pikaemotion_pikapic $17 + pikaemotion_pikapic PikaPicAnimScript23 db $ff -Pointer_fd218: ; fd218 (3f:5218) +PikachuMovementData_fd218: ; fd218 (3f:5218) db $00 db $39, $01 db $3e, $1e db $3f -Pointer_fd21e: ; fd21e (3f:521e) +PikachuMovementData_fd21e: ; fd21e (3f:521e) db $00 db $39, $00 db $3e, $1e db $3f -Pointer_fd224: ; fd224 (3f:5224) +PikachuMovementData_fd224: ; fd224 (3f:5224) db $00 db $3c, $07, $2f db $3c, $07, $2f db $3f -Pointer_fd22c: ; fd22c (3f:522c) +PikachuMovementData_fd22c: ; fd22c (3f:522c) db $3b, $1f, $03 db $3f -Pointer_fd230: ; fd230 (3f:5230) +PikachuMovementData_fd230: ; fd230 (3f:5230) db $00 db $3c, $0f, $1f db $3c, $0f, $1f db $3f -Pointer_fd238: ; fd238 (3f:5238) +PikachuMovementData_fd238: ; fd238 (3f:5238) db $00 db $05, $07 db $39, $00 diff --git a/engine/bank3c.asm b/engine/bank3c.asm index 99226f51..3683f2b1 100644 --- a/engine/bank3c.asm +++ b/engine/bank3c.asm @@ -50,7 +50,7 @@ ResetStatusAndHalveMoneyOnBlackout: ; f0274 (3c:4274) ld [wJoyIgnore], a predef_jump HealParty -Func_f02da: ; f02da (3c:42da) +SetMapSpecificScriptFlagsOnMapReload: ; f02da (3c:42da) ld a, [wCurMap] cp VERMILION_GYM ; ??? new thing about verm gym? jr z, .verm_gym @@ -111,9 +111,9 @@ BeachHouse_Block: ; f0914 (3c:4914) Func_f0a54: ; f0a54 (3c:4a54) ret -Func_f0a55: ; f0a55 (3c:4a55) +LoadUnusedBluesHouseMissableObjectData: ; f0a55 (3c:4a55) ; referenced in an unused function - ld hl, Pointer_f0a76 ; 3c:4a76 + ld hl, .MissableObjectsMaps .loop ld a, [hli] cp a, $ff @@ -121,13 +121,13 @@ Func_f0a55: ; f0a55 (3c:4a55) ld b, a ld a, [wCurMap] cp b - jr z, .asm_f0a68 + jr z, .found inc hl inc hl inc hl jr .loop -.asm_f0a68 +.found ld a, [hli] ld c, a ld b, 0 @@ -138,16 +138,16 @@ Func_f0a55: ; f0a55 (3c:4a55) call CopyData ret -Pointer_f0a76: ; f0a76 (3c:4a76) - dbbw BLUES_HOUSE, Pointer_f0a7bEnd - Pointer_f0a7b, Pointer_f0a7b +.MissableObjectsMaps: + dbbw BLUES_HOUSE, .End - .Start, .Start db $ff -Pointer_f0a7b: +.Start: db 1, HS_DAISY_SITTING_COPY db 2, HS_DAISY_WALKING_COPY db 3, HS_TOWN_MAP_COPY db $ff -Pointer_f0a7bEnd: +.End: TryApplyPikachuMovementData: ; f0a82 ld a, [wd472] @@ -209,41 +209,14 @@ INCLUDE "scripts/oakslab2.asm" INCLUDE "scripts/school2.asm" INCLUDE "scripts/museum1f2.asm" INCLUDE "scripts/pewterpokecenter2.asm" - -Func_f1e22: - ld hl, PikachuMovementData_f1e2b - ld b, SPRITE_FACING_RIGHT - call TryApplyPikachuMovementData - ret - -PikachuMovementData_f1e2b: - db $00 - db $1d - db $1f - db $38 - db $3f - +INCLUDE "scripts/pokemontower2_2.asm" INCLUDE "scripts/celadonmart3_2.asm" INCLUDE "scripts/celadonmansion1_2.asm" INCLUDE "scripts/celadonmansion3_2.asm" - -Func_f1f23: - ld hl, PikachuMovementData_f1f2c - ld b, SPRITE_FACING_DOWN - call TryApplyPikachuMovementData - ret - -PikachuMovementData_f1f2c: - db $00 - db $20 - db $1e - db $35 - db $3f - +INCLUDE "scripts/celadongamecorner2.asm" INCLUDE "scripts/celadondiner2.asm" INCLUDE "scripts/safarizoneentrance2.asm" INCLUDE "scripts/cinnabargym3.asm" - INCLUDE "scripts/mtmoonpokecenter2.asm" INCLUDE "data/mapHeaders/beach_house.asm" @@ -259,111 +232,4 @@ INCLUDE "scripts/ssanne9_2.asm" INCLUDE "scripts/silphco11_2.asm" INCLUDE "engine/overworld/hidden_objects.asm" - -Func_f2cd0: - ld d, 0 - ld hl, Jumptable_f2ce1 - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - call JumpToAddress - ld e, a - ld d, 0 - ret - -Jumptable_f2ce1: - dw Func_f2ceb - dw Func_f2ceb - dw Func_f2cee - dw Func_f2cf4 - dw Func_f2d06 - -Func_f2ceb: - ld a, 0 - ret - -Func_f2cee: - call Random - and $1 - ret - -Func_f2cf4: ; should return to a, instead returns to b - call Random - swap a - cp 1 * $ff / 3 - ld b, 0 - ret c - cp 2 * $ff / 3 - ld b, 1 - ret c - ld b, 2 - ret - -Func_f2d06: - call Random - and $3 - ret - -Func_f2d0c: - ld hl, GymTrashCans3c - ld a, [wGymTrashCanIndex] - ld c, a - ld b, 0 - ld a, 9 - call AddNTimes - call AddNTimes ; ???? - ld a, [hli] - ld [hGymTrashCanRandNumMask], a - ld e, a - push hl - call Func_f2cd0 - pop hl - add hl, de - add hl, de - ld a, [hli] - ld [wSecondLockTrashCanIndex], a - ld a, [hl] - ld [wSecondLockTrashCanIndex + 1], a - ret - -GymTrashCans3c: ; f2d31 (3c:6d31) -; First byte: number of trashcan entries -; Following four byte pairs: indices for the second trash can. -; BUG: Rows that have 3 trashcan entries are sampled incorrectly. -; The sampling occurs by taking a random number and seeing which -; third of the range 0-255 the number falls in. However, it returns -; that value to the wrong register, so the result is never used. -; Instead of using an offset in [0,1,2], the offset is instead -; in the full range 0-255. This results in truly random behavior. - db 4 - db 1,3, 3,1, 1,-1, 3,-1 - db 3 - db 0,2, 2,4, 4,0, -1,-1 - db 4 - db 1,5, 5,1, 1,-1, 5,-1 - db 3 - db 0,4, 4,6, 6,0, -1,-1 - db 4 - db 1,3, 3,1, 5,5, 7,7 - db 3 - db 2,4, 4,8, 8,2, -1,-1 - db 3 - db 3,7, 7,9, 9,3, -1,-1 - db 4 - db 4,8, 6,10, 8,4, 10,6 - db 3 - db 5,7, 7,11, 11,5, -1,-1 - db 3 - db 6,10, 10,12, 12,6, -1,-1 - db 4 - db 7,9, 9,7, 11,13, 13,11 - db 3 - db 8,10, 10,14, 14,8, -1,-1 - db 4 - db 9,13, 13,9, 9,-1, 13,-1 - db 3 - db 10,12, 12,14, 14,10, -1,-1 - db 4 - db 11,13, 13,11, 11,-1, 13,-1 +INCLUDE "engine/vermilion_gym_trash_cans.asm" diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 31f9befc..58838434 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -365,7 +365,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) .openFirstLock ; Next can is trying for the second switch. SetEvent EVENT_1ST_LOCK_OPENED - callab Func_f2d0c + callab Yellow_SampleSecondTrashCan tx_pre_id VermilionGymTrashSuccesText1 jr .done diff --git a/engine/items/items.asm b/engine/items/items.asm index 197e5e5d..96dd0a00 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1803,8 +1803,8 @@ ItemUsePokeflute: ; dfbd (3:5fbd) ld hl, PlayedFluteHadEffectText call PrintText call ItemUseReloadOverworldData - ld e, $1a - callab Func_fd001 + ldpikaemotion e, PikachuEmotion26 + callab PlaySpecificPikachuEmotion ret .noSnorlaxOrPikachuToWakeUp diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index 51afc383..0f355889 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -32,7 +32,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97) call LoadCurrentMapView call Delay3 call UpdateSprites - callab Func_fd252 ; todo + callab PikachuWalksToNurseJoy ; todo .notHealingPlayerPikachu ld hl, NeedYourPokemonText call PrintText diff --git a/engine/pikachu_emotions.asm b/engine/pikachu_emotions.asm index 9040e612..fdb17e69 100755 --- a/engine/pikachu_emotions.asm +++ b/engine/pikachu_emotions.asm @@ -1,4 +1,4 @@ -IsPlayerTalkingToPikachu:: ; fcf0c (3f:4f0c) +IsPlayerTalkingToPikachu: ; fcf0c (3f:4f0c) ld a, [wd436] and a ret z @@ -185,11 +185,11 @@ DeletedFunction_fcffb: ; fcffb (3f:4ffb) endr ret -Func_fd001:: ; fd001 (3f:5001) +PlaySpecificPikachuEmotion: ; fd001 (3f:5001) ld a, e jr load_expression -Func_fd004:: ; fd004 (3f:5004) +TalkToPikachu: ; fd004 (3f:5004) call MapSpecificPikachuExpression jr c, load_expression call GetPikaPicAnimationScriptIndex @@ -201,42 +201,46 @@ load_expression: ; fd00f (3f:500f) 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 +pikaemotion_def: MACRO +\1_id: dw \1 + endm + + pikaemotion_def PikachuEmotion0 + pikaemotion_def PikachuEmotion1 + pikaemotion_def PikachuEmotion2 + pikaemotion_def PikachuEmotion3 + pikaemotion_def PikachuEmotion4 + pikaemotion_def PikachuEmotion5 + pikaemotion_def PikachuEmotion6 + pikaemotion_def PikachuEmotion7 + pikaemotion_def PikachuEmotion8 + pikaemotion_def PikachuEmotion9 + pikaemotion_def PikachuEmotion10 + pikaemotion_def PikachuEmotion11 + pikaemotion_def PikachuEmotion12 + pikaemotion_def PikachuEmotion13 + pikaemotion_def PikachuEmotion14 + pikaemotion_def PikachuEmotion15 + pikaemotion_def PikachuEmotion16 + pikaemotion_def PikachuEmotion17 + pikaemotion_def PikachuEmotion18 + pikaemotion_def PikachuEmotion19 + pikaemotion_def PikachuEmotion20 + pikaemotion_def PikachuEmotion21 ; used a fishing rod + pikaemotion_def PikachuEmotion22 + pikaemotion_def PikachuEmotion23 + pikaemotion_def PikachuEmotion24 + pikaemotion_def PikachuEmotion25 + pikaemotion_def PikachuEmotion26 ; wake up pikachu in pewter pokemon center + pikaemotion_def PikachuEmotion27 + pikaemotion_def PikachuEmotion28 + pikaemotion_def PikachuEmotion29 + pikaemotion_def PikachuEmotion30 + pikaemotion_def PikachuEmotion31 + pikaemotion_def PikachuEmotion32 + pikaemotion_def PikachuEmotion33 -PikachuEmotion33_fd05d: ; fd05d (3f:505d) +PikachuEmotion33: ; fd05d (3f:505d) db $ff MapSpecificPikachuExpression: ; fd05e (3f:505e) @@ -245,10 +249,10 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) jr nz, .notFanClub ld hl, wd492 bit 7, [hl] - ld a, $1d + ldpikaemotion a, PikachuEmotion29 jr z, .set_carry call CheckPikachuFollowingPlayer - ld a, $1e + ldpikaemotion a, PikachuEmotion30 jr nz, .set_carry jr .check_pikachu_status @@ -257,7 +261,7 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) cp PEWTER_POKECENTER jr nz, .notPewterPokecenter call CheckPikachuFollowingPlayer - ld a, $1a + ldpikaemotion a, PikachuEmotion26 jr nz, .set_carry jr .check_pikachu_status @@ -270,16 +274,16 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) .check_pikachu_status call IsPlayerPikachuAsleepInParty - ld a, $b + ldpikaemotion a, PikachuEmotion11 jr c, .set_carry callab CheckPikachuFaintedOrStatused ; same bank - ld a, $1c + ldpikaemotion a, PikachuEmotion28 jr c, .set_carry ld a, [wCurMap] cp POKEMONTOWER_1 jr c, .notInLavenderTower cp POKEMONTOWER_7 + 1 - ld a, $16 + ldpikaemotion a, PikachuEmotion22 jr c, .set_carry .notInLavenderTower ld a, [wd49c] @@ -288,7 +292,7 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) dec a ld c, a ld b, $0 - ld hl, Pointer_fd0cb + ld hl, .Emotions add hl, bc ld a, [hl] jr .set_carry @@ -301,10 +305,14 @@ MapSpecificPikachuExpression: ; fd05e (3f:505e) scf ret -Pointer_fd0cb: - db $12, $15, $17, $18, $19 +.Emotions: + dpikaemotion PikachuEmotion18 + dpikaemotion PikachuEmotion21 + dpikaemotion PikachuEmotion23 + dpikaemotion PikachuEmotion24 + dpikaemotion PikachuEmotion25 -IsPlayerPikachuAsleepInParty:: ; fd0d0 (3f:50d0) +IsPlayerPikachuAsleepInParty: ; fd0d0 (3f:50d0) xor a ld [wWhichPokemon], a .loop @@ -328,6 +336,7 @@ IsPlayerPikachuAsleepInParty:: ; fd0d0 (3f:50d0) and SLP jr z, .done jr .curMonSleepingPikachu + .curMonNotStarterPikachu ld a, [wWhichPokemon] cp PARTY_LENGTH - 1 @@ -335,75 +344,77 @@ IsPlayerPikachuAsleepInParty:: ; fd0d0 (3f:50d0) inc a ld [wWhichPokemon], a jr .loop + .curMonSleepingPikachu scf ret + .done and a ret INCLUDE "data/pikachu_emotions.asm" -Func_fd252: ; fd252 (3f:5252) +PikachuWalksToNurseJoy: ; fd252 (3f:5252) ld a, $40 ld [h_0xFFFC], a call LoadPikachuSpriteIntoVRAM - call Func_fd266 + call .GetMovementData and a - jr z, .asm_fd262 + jr z, .skip call ApplyPikachuMovementData -.asm_fd262 +.skip xor a ld [h_0xFFFC], a ret -Func_fd266: - ld a, [wSpriteStateData2 + 15 * 16 + 4] +.GetMovementData: + ld a, [wPikachuMapY] ld e, a - ld a, [wSpriteStateData2 + 15 * 16 + 5] + ld a, [wPikachuMapX] ld d, a ld a, [wYCoord] add 4 cp e - jr z, .asm_fd280 - jr nc, .asm_fd27e - ld hl, Data_fd294 + jr z, .pikachu_at_same_y_as_player + jr nc, .pikachu_above_player + ld hl, .PikaMovementData1 ld a, 1 ret -.asm_fd27e +.pikachu_above_player xor a ret -.asm_fd280 +.pikachu_at_same_y_as_player ld a, [wXCoord] add 4 cp d - jr c, .asm_fd28e - ld hl, Data_fd299 + jr c, .pikachu_to_right_of_player + ld hl, .PikaMovementData2 ld a, 2 ret -.asm_fd28e - ld hl, Data_fd29d +.pikachu_to_right_of_player + ld hl, .PikaMovementData3 ld a, 3 ret -Data_fd294: - db $00 - db $36 - db $2b - db $34 - db $3f +.PikaMovementData1: + db $00 ; init + db $36 ; look up + db $2b ; walk up left + db $34 ; hop up right + db $3f ; ret -Data_fd299: - db $00 - db $36 - db $34 - db $3f +.PikaMovementData2: + db $00 ; init + db $36 ; look up + db $34 ; hop up right + db $3f ; ret -Data_fd29d: - db $00 - db $36 - db $33 - db $3f +.PikaMovementData3: + db $00 ; init + db $36 ; look up + db $33 ; hop up left + db $3f ; ret diff --git a/engine/pikachu_pic_animation.asm b/engine/pikachu_pic_animation.asm index 0295775c..b935da19 100755 --- a/engine/pikachu_pic_animation.asm +++ b/engine/pikachu_pic_animation.asm @@ -164,6 +164,10 @@ LoadCurrentPikaPicAnimScriptPointer: ret PikaPicAnimPointers: +pikapic_def: macro +\1_id: dw \1 +endm + pikapic_def PikaPicAnimScript0 ; 00 pikapic_def PikaPicAnimScript1 ; 01 pikapic_def PikaPicAnimScript2 ; 02 diff --git a/engine/vermilion_gym_trash_cans.asm b/engine/vermilion_gym_trash_cans.asm new file mode 100755 index 00000000..63ac04eb --- /dev/null +++ b/engine/vermilion_gym_trash_cans.asm @@ -0,0 +1,108 @@ +TrashCanRandom: + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + ld e, a + ld d, 0 + ret + +.Jumptable: + dw .zero + dw .one + dw .two + dw .three + dw .four + +.zero +.one + ld a, 0 + ret + +.two + call Random + and $1 + ret + +.three ; should return to a, instead returns to b + call Random + swap a + cp 1 * $ff / 3 + ld b, 0 + ret c + cp 2 * $ff / 3 + ld b, 1 + ret c + ld b, 2 + ret + +.four + call Random + and $3 + ret + +Yellow_SampleSecondTrashCan: + ld hl, GymTrashCans3c + ld a, [wGymTrashCanIndex] + ld c, a + ld b, 0 + ld a, 9 + call AddNTimes + call AddNTimes ; ???? + ld a, [hli] + ld [hGymTrashCanRandNumMask], a + ld e, a + push hl + call TrashCanRandom + pop hl + add hl, de + add hl, de + ld a, [hli] + ld [wSecondLockTrashCanIndex], a + ld a, [hl] + ld [wSecondLockTrashCanIndex + 1], a + ret + +GymTrashCans3c: ; f2d31 (3c:6d31) +; First byte: number of trashcan entries +; Following four byte pairs: indices for the second trash can. +; BUG: Rows that have 3 trashcan entries are sampled incorrectly. +; The sampling occurs by taking a random number and seeing which +; third of the range 0-255 the number falls in. However, it returns +; that value to the wrong register, so the result is never used. +; Instead of using an offset in [0,1,2], the offset is instead +; in the full range 0-255. This results in truly random behavior. + db 4 + db 1,3, 3,1, 1,-1, 3,-1 + db 3 + db 0,2, 2,4, 4,0, -1,-1 + db 4 + db 1,5, 5,1, 1,-1, 5,-1 + db 3 + db 0,4, 4,6, 6,0, -1,-1 + db 4 + db 1,3, 3,1, 5,5, 7,7 + db 3 + db 2,4, 4,8, 8,2, -1,-1 + db 3 + db 3,7, 7,9, 9,3, -1,-1 + db 4 + db 4,8, 6,10, 8,4, 10,6 + db 3 + db 5,7, 7,11, 11,5, -1,-1 + db 3 + db 6,10, 10,12, 12,6, -1,-1 + db 4 + db 7,9, 9,7, 11,13, 13,11 + db 3 + db 8,10, 10,14, 14,8, -1,-1 + db 4 + db 9,13, 13,9, 9,-1, 13,-1 + db 3 + db 10,12, 12,14, 14,10, -1,-1 + db 4 + db 11,13, 13,11, 11,-1, 13,-1 @@ -1144,7 +1144,7 @@ DisplayTextID:: ; 2817 (0:2817) and a jp z, DisplayStartMenu cp TEXT_PIKACHU_ANIM ; new yellow asm - jp z, DisplayUnknownText_29c6 + jp z, DisplayPikachuEmotion cp TEXT_SAFARI_GAME_OVER jp z, DisplaySafariGameOverText cp TEXT_MON_FAINTED @@ -1348,8 +1348,8 @@ RepelWoreOffText:: ; 29c1 (0:29c1) TX_FAR _RepelWoreOffText db "@" -DisplayUnknownText_29c6:: ; 29c6 (0:29c6) - callab Func_fd004 ; 3f:5004 +DisplayPikachuEmotion:: ; 29c6 (0:29c6) + callab TalkToPikachu ; 3f:5004 jp CloseTextDisplay INCLUDE "engine/menu/start_menu.asm" diff --git a/home/overworld.asm b/home/overworld.asm index 03058505..d8f91e79 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1848,7 +1848,7 @@ LoadMapHeader:: ; 0dab (0:0dab) jr asm_0dbd Func_0db5:: ; XXX - callba Func_f0a55 ; 3c:4a55 + callba LoadUnusedBluesHouseMissableObjectData ; 3c:4a55 asm_0dbd ld a, [wCurMapTileset] ld [wUnusedD119], a @@ -2067,7 +2067,7 @@ ReloadMapAfterPrinter:: ; 0f3d (0:0f3d) pop af call BankswitchCommon asm_0f4d: ; 0f4d (0:0f4d) - jpab Func_f02da + jpab SetMapSpecificScriptFlagsOnMapReload ret ; useless? ResetMapVariables:: ; 0f56 (0:0f56) @@ -838,121 +838,3 @@ endm enum_set: macro __enum__ = \1 endm - -pikacry_def: MACRO -\1_id:: dba \1 -endm - -dpikacry: MACRO - db (\1_id - PikachuCriesPointerTable) / 3 - endm - -ldpikacry: MACRO - ld \1, (\2_id - PikachuCriesPointerTable) / 3 - ENDM - -pikacry: MACRO - ldpikacry a, \1 - endm - - - enum_start - enum pikapic_nop_command -pikapic_nop: macro - db pikapic_nop_command - endm - - enum pikapic_writebyte_command -pikapic_writebyte: macro - db pikapic_writebyte_command, \1 - endm - - enum pikapic_loadgfx_command -pikapic_loadgfx: macro - db pikapic_loadgfx_command, (\1_id - PikaPicAnimGFXHeaders) / 4 - endm - - enum pikapic_object_command -pikapic_object: macro - db pikapic_object_command - dw \1 - db \2, \3, \4 - endm - - enum pikapic_nop4_command -pikapic_nop4: macro - db pikapic_nop4_command - endm - - enum pikapic_nop5_command -pikapic_nop5: macro - db pikapic_nop5_command - endm - - enum pikapic_waitbgmapeleteobject_command -pikapic_waitbgmapeleteobject: macro - db pikapic_waitbgmapeleteobject_command, \1 - endm - - enum pikapic_nop7_command -pikapic_nop7: macro - db pikapic_nop7_command - endm - - enum pikapic_nop8_command -pikapic_nop8: macro - db pikapic_nop8_command - endm - - enum pikapic_jump_command -pikapic_jump: macro ; 9 - dbw pikapic_jump_command, \1 - endm - - enum pikapic_setduration_command -pikapic_setduration: macro ; a - dbw pikapic_setduration_command, \1 - endm - - enum pikapic_cry_command -pikapic_cry: macro ; b - db pikapic_cry_command -IF _NARG == 0 - db $ff -else - dpikacry \1 - endc - endm - - enum pikapic_thunderbolt_command -pikapic_thunderbolt: macro ; c - db pikapic_thunderbolt_command - endm - - enum pikapic_waitbgmap_command -pikapic_waitbgmap: macro ; d - db pikapic_waitbgmap_command - endm - - enum pikapic_ret_command -pikapic_ret: macro ; e - db pikapic_ret_command - endm - -pikapic_looptofinish: macro -.loop\@ - pikapic_waitbgmap - pikapic_jump .loop\@ - endm - -pikapic_def: macro -\1_id: dw \1 -endm - -dpikapic: macro - db (\1_id - PikaPicAnimPointers) / 2 - endm - -ldpikapic: macro - ld \1, (\2_id - PikaPicAnimPointers) / 2 - endm diff --git a/scripts/celadongamecorner2.asm b/scripts/celadongamecorner2.asm new file mode 100755 index 00000000..f8d25905 --- /dev/null +++ b/scripts/celadongamecorner2.asm @@ -0,0 +1,12 @@ +Func_f1f23: + ld hl, PikachuMovementData_f1f2c + ld b, SPRITE_FACING_DOWN + call TryApplyPikachuMovementData + ret + +PikachuMovementData_f1f2c: + db $00 + db $20 + db $1e + db $35 + db $3f diff --git a/scripts/pokemontower2_2.asm b/scripts/pokemontower2_2.asm new file mode 100755 index 00000000..42659da3 --- /dev/null +++ b/scripts/pokemontower2_2.asm @@ -0,0 +1,12 @@ +Func_f1e22: + ld hl, PikachuMovementData_f1e2b + ld b, SPRITE_FACING_RIGHT + call TryApplyPikachuMovementData + ret + +PikachuMovementData_f1e2b: + db $00 + db $1d + db $1f + db $38 + db $3f |