;============================================================================ ; Faxanadu (U).nes ; ; PRG14 ($8000 - $bfff) ;============================================================================
.segment "PRG14" .reloc
;============================================================================ ; TODO: Document Sprites_UpdateAll ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; EndGame_MainLoop ; Game_MainLoop ; GetRandom ;============================================================================
[8000]Sprites_UpdateAll: [8000]ad 26 04LDA a:Sprites_UpdatesPaused [8003]d0 0aBNE @_spritesLoop [8005]ad 2a 04LDA a:DurationHourGlass [8008]c9 ffCMP #$ff [800a]d0 03BNE @_spritesLoop
; ; The Hour Glass isn't being used and sprites aren't paused, ; so sprites can be updated. ;
[800c]ee 83 03INC a:SpriteUpdateCounter
; ; Begin the loop. ;
[800f]@_spritesLoop: [800f]a2 07LDX #$07
; ; Process this sprite slot if it's populated with a ; valid sprite. ;
[8011]@_updateSpriteLoop: [8011]8e 78 03STX a:CurrentSpriteIndex [8014]bd cc 02LDA a:CurrentSprites_Entities,X [8017]30 2aBMI @LAB_PRG14__8043
; ; The sprite at this index has a valid value, so proceed. ; ; We'll start by making sure that the elixir isn't set (again). ;
[8019]ad 26 04LDA a:Sprites_UpdatesPaused [801c]d0 22BNE @_updateSpriteState
; ; The elixir is not active. Check if the sprite was hit. ;
[801e]bd 4c 03LDA a:CurrentSprites_HitCounter,X [8021]d0 2bBNE @_handleHit [8023]bd 34 03LDA a:CurrentSprites_HitByMagicBehavior,X [8026]30 06BMI @LAB_PRG14__802e [8028]20 51 81JSR Sprites_Maybe_UpdateHitByMagic [802b]4c 40 80JMP @_updateSpriteState [802e]@LAB_PRG14__802e: [802e]20 6b a6JSR Sprites_UpdateBehavior [8031]20 04 88JSR Player_HitSpriteWithWeapon [8034]20 dc 8aJSR Sprite_CheckHitByCastMagic [8037]20 08 8aJSR Sprite_GetBounds [803a]20 7c 87JSR Player_CheckShieldHitByMagic [803d]20 0a 89JSR CurrentSprite_CheckHitPlayer [8040]@_updateSpriteState: [8040]20 d2 8bJSR CurrentSprite_UpdateState [8043]@LAB_PRG14__8043: [8043]ae 78 03LDX a:CurrentSpriteIndex [8046]caDEX [8047]10 c8BPL @_updateSpriteLoop [8049]a9 00LDA #$00 [804b]85 33STA Sprites_PPUOffset [804d]60RTS
; ; The sprite has been hit. Reduce the hit counter. It'll ; eventually get to 0 if it's not hit again recently. ;
[804e]@_handleHit: [804e]de 4c 03DEC a:CurrentSprites_HitCounter,X [8051]bd cc 02LDA a:CurrentSprites_Entities,X
; ; Check if this sprite is Tamazutsu, Pakukame, or Zorugeriru. ;
[8054]c9 2cCMP #$2c [8056]f0 e8BEQ @_updateSpriteState [8058]c9 30CMP #$30 [805a]f0 e4BEQ @_updateSpriteState [805c]c9 31CMP #$31 [805e]f0 e0BEQ @_updateSpriteState
; ; It's not any of those. ;
[8060]a9 02LDA #$02 [8062]8d 75 03STA a:Arg_DeltaX_Full [8065]a9 00LDA #$00 [8067]8d 74 03STA a:Arg_DeltaX_Frac [806a]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [806d]4c 40 80JMP @_updateSpriteState
;============================================================================ ; TODO: Document Sprites_UpdateAllStates ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Game_DrawScreenInFrozenState ;============================================================================
[8070]Sprites_UpdateAllStates: [8070]ad 78 03LDA a:CurrentSpriteIndex [8073]48PHA [8074]a2 07LDX #$07 [8076]@_loop: [8076]8e 78 03STX a:CurrentSpriteIndex [8079]20 d2 8bJSR CurrentSprite_UpdateState [807c]ae 78 03LDX a:CurrentSpriteIndex [807f]caDEX [8080]10 f4BPL @_loop [8082]68PLA [8083]8d 78 03STA a:CurrentSpriteIndex [8086]60RTS
; ; XREFS: ; CurrentSprite_UpdateState ;
[8087]SPRITE_UPDATE_HANDLERS: [8087]97 8cpointer SpriteUpdateHandler_Invisible-1; [0]: [8089]12 a3pointer SpriteUpdateHandler_Bread-1; [1]: Dropped: Bread [808b]6d 8dpointer SpriteUpdateHandler_Coin-1; [2]: Dropped: Coin [808d]e3 9epointer SpriteUpdateHandler_Garbled03-1; [3]: Enemy: ? [808f]7f 8dpointer SpriteUpdateHandler_Enemy_Raiden-1; [4]: Enemy: Raiden [8091]43 8epointer SpriteUpdateHandler_Enemy_NecronAides-1; [5]: Enemy: Necron Aides [8093]56 8epointer SpriteUpdateHandler_Enemy_Zombie-1; [6]: Enemy: Zombie [8095]c1 8epointer SpriteUpdateHandler_Enemy_Hornet-1; [7]: Enemy: Hornet [8097]17 8fpointer SpriteUpdateHandler_Enemy_Bihoruda-1; [8]: Enemy: Bihoruda [8099]d8 8fpointer SpriteUpdateHandler_Enemy_Lilith-1; [9]: Enemy: Lilith [809b]1f a1pointer SpriteUpdateHandler_TODO_Garbled10-1; [10]: Magic: ? [809d]32 90pointer SpriteUpdateHandler_Enemy_Yuinaru-1; [11]: Enemy: Yuinaru [809f]43 90pointer SpriteUpdateHandler_Enemy_Snowman-1; [12]: Enemy: Snowman [80a1]de 90pointer SpriteUpdateHandler_Enemy_Nash-1; [13]: Enemy: Nash [80a3]0e 91pointer SpriteUpdateHandler_Enemy_FireGiant-1; [14]: Enemy: Fire Giant [80a5]8d 91pointer SpriteUpdateHandler_Enemy_Ishiisu-1; [15]: Enemy: Ishiisu [80a7]1e 92pointer SpriteUpdateHandler_Enemy_ExecutionHood-1; [16]: Enemy: Execution Hood [80a9]0a 99pointer SpriteUpdateHandler_Boss_Rokusutahn-1; [17]: Boss: Rokusutahn [80ab]db 9apointer SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart-1; [18]: Boss: unused (round body of snake boss) [80ad]2d 82pointer SpriteUpdateHandler_Effect_EnemyDeath-1; [19]: Effect: Enemy death [80af]8a 82pointer SpriteUpdateHandler_Effect_LightningBall20-1; [20]: Effect: Lightning ball [80b1]60 92pointer SpriteUpdateHandler_Enemy_Charron-1; [21]: Enemy: Charron [80b3]97 8cpointer SpriteUpdateHandler_Invisible-1; [22]: Enemy: ? (Unused) [80b5]86 92pointer SpriteUpdateHandler_Enemy_Geributa-1; [23]: Enemy: Geributa [80b7]9e 92pointer SpriteUpdateHandler_Enemy_Sugata-1; [24]: Enemy: Sugata [80b9]af 92pointer SpriteUpdateHandler_Enemy_Grimlock-1; [25]: Enemy: Grimlock [80bb]ab 93pointer SpriteUpdateHandler_Enemy_GiantBees-1; [26]: Enemy: Giant Bees [80bd]bc 93pointer SpriteUpdateHandler_Enemy_Myconid-1; [27]: Enemy: Myconid [80bf]41 94pointer SpriteUpdateHandler_Enemy_Naga-1; [28]: Enemy: Naga [80c1]52 94pointer SpriteUpdateHandler_Enemy_Unused29-1; [29]: Enemy: Skeleton Knight (unused) [80c3]7c 94pointer SpriteUpdateHandler_Enemy_GiantStrider-1; [30]: Enemy: Giant Strider [80c5]12 95pointer SpriteUpdateHandler_Enemy_SirGawaine_Wolfman-1; [31]: Enemy: Sir Gawaine [80c7]1b 95pointer SpriteUpdateHandler_Enemy_Maskman-1; [32]: Enemy: Maskman [80c9]34 95pointer thunk_SpriteUpdateHandler_Enemy_SirGawaine_Wolfman-1; [33]: Enemy: Wolfman [80cb]ad 95pointer SpriteUpdateHandler_Enemy_Yareeka-1; [34]: Enemy: Yareeka [80cd]1a 96pointer SpriteUpdateHandler_Enemy_Magman-1; [35]: Enemy: Magman [80cf]e9 96pointer SpriteUpdateHandler_Enemy_Unused_CurlyTail-1; [36]: Enemy: Curly-tailed guy with spear (unused) [80d1]97 8cpointer SpriteUpdateHandler_Invisible-1; [37]: Enemy: ? (unused) [80d3]03 97pointer SpriteUpdateHandler_Enemy_Ikeda-1; [38]: Enemy: Ikeda [80d5]5d 97pointer SpriteUpdateHandler_Enemy_MuppetGuy-1; [39]: Enemy: Muppet guy (unused) [80d7]6f 97pointer SpriteUpdateHandler_Enemy_Lamprey-1; [40]: Enemy: Lamprey [80d9]97 8cpointer SpriteUpdateHandler_Invisible-1; [41]: Enemy: ? (unused) [80db]9a 97pointer SpriteUpdateHandler_Enemy_Monodron-1; [42]: Enemy: Monodron [80dd]52 98pointer SpriteUpdateHandler_Enemy_Unused_WingedSkeleton-1; [43]: Enemy: Winged skeleton (unused) [80df]b2 98pointer SpriteUpdateHandler_Enemy_Tamazutsu-1; [44]: Enemy: Tamazutsu [80e1]50 9cpointer SpriteUpdateHandler_Boss_Ripasheiku-1; [45]: Boss: Ripasheiku [80e3]7a 9cpointer SpriteUpdateHandler_Boss_Zoradohna-1; [46]: Boss: Zoradohna [80e5]cf 9cpointer SpriteUpdateHandler_Boss_Borabohra-1; [47]: Boss: Borabohra [80e7]93 9dpointer SpriteUpdateHandler_Boss_Pakukame-1; [48]: Boss: Pakukame [80e9]4e 9epointer SpriteUpdateHandler_Boss_Zorugeriru-1; [49]: Boss: Zorugeriru [80eb]c3 9fpointer SpriteUpdateHandler_Boss_KingGrieve-1; [50]: Boss: King Grieve [80ed]6d a0pointer SpriteUpdateHandler_Boss_ShadowEura-1; [51]: Boss: Shadow Eura [80ef]6a a2pointer SpriteUpdateHandler_NPC_Walking-1; [52]: NPC: Walking Man 1 [80f1]89 a2pointer thunk1_SpriteUpdateHandler_NPC_Walking-1; [53]: NPC: Blue lady (unused) [80f3]8c a2pointer thunk2_SpriteUpdateHandler_NPC_Walking-1; [54]: NPC: Child (unused) [80f5]8f a2pointer SpriteUpdateHandler_NPC_ArmorSalesman-1; [55]: NPC: Armor Salesman [80f7]9f a2pointer SpriteUpdateHandler_NPC_MartialArts-1; [56]: NPC: Martial Artist [80f9]ae a2pointer SpriteUpdateHandler_NPC_Priest-1; [57]: NPC: Priest [80fb]bd a2pointer SpriteUpdateHandler_NPC_King-1; [58]: NPC: King [80fd]d7 a2pointer SpriteUpdateHandler_NPC_MagicTeacher-1; [59]: NPC: Magic Teacher [80ff]e6 a2pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [60]: NPC: Key Salesman [8101]e6 a2pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [61]: NPC: Smoking Man [8103]e6 a2pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [62]: NPC: Man in Chair [8105]e6 a2pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [63]: NPC: Sitting Man [8107]fd a2pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [64]: NPC: Meat Salesman [8109]fd a2pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [65]: NPC: Lady in Blue Dress with Cup [810b]fd a2pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [66]: NPC: Guard [810d]f6 a2pointer SpriteUpdateHandler_NPC_Doctor-1; [67]: NPC: Doctor [810f]fd a2pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [68]: NPC: Walking Woman 1 [8111]fd a2pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [69]: NPC: Walking Woman 2 [8113]03 a3pointer SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura-1; [70]: Enemy: Eyeball (unused) [8115]03 a3pointer SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura-1; [71]: Enemy: Zozura [8117]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [72]: Item: Glove [8119]4a a3pointer SpriteUpdateHandler_Item_Special-1; [73]: Item: Black Onyx [811b]4a a3pointer SpriteUpdateHandler_Item_Special-1; [74]: Item: Pendant [811d]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [75]: Item: Red Potion [811f]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [76]: Item: Poison [8121]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [77]: Item: Elixir [8123]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [78]: Item: Ointment [8125]97 8cpointer SpriteUpdateHandler_Invisible-1; [79]: Trigger: Intro [8127]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [80]: Item: Mattock [8129]e7 a0pointer SpriteUpdateHandler_Magic_81-1; [81]: Magic: ? [812b]34 a3pointer SpriteUpdateHandler_Effect_Fountain-1; [82]: Effect: Fountain [812d]c1 a1pointer SpriteUpdateHandler_Magic_83-1; [83]: Magic: ? [812f]f4 a1pointer SpriteUpdateHandler_EnemyMagic-1; [84]: Magic: Enemy Fireball [8131]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [85]: Item: Wing Boots [8133]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [86]: Item: Hour Glass [8135]4a a3pointer SpriteUpdateHandler_Item_Special-1; [87]: Item: Magical Rod [8137]4a a3pointer SpriteUpdateHandler_Item_Special-1; [88]: Item: Battle Suit [8139]4a a3pointer SpriteUpdateHandler_Item_Special-1; [89]: Item: Battle Helmet [813b]4a a3pointer SpriteUpdateHandler_Item_Special-1; [90]: Item: Dragon Slayer [813d]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [91]: Item: Mattock [813f]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [92]: Item: Wing Boots (from quest) [8141]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [93]: Item: Red Potion [8143]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [94]: Item: Poison [8145]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [95]: Item: Glove [8147]09 a3pointer SpriteUpdateHandler_Item_Standard-1; [96]: Item: Ointment [8149]d1 a5pointer SpriteUpdateHandler_Effect_Spring-1; [97]: Effect: Spring of Trunk [814b]d1 a5pointer SpriteUpdateHandler_Effect_Spring-1; [98]: Effect: Spring of Sky [814d]d1 a5pointer SpriteUpdateHandler_Effect_Spring-1; [99]: Effect: Spring of Tower [814f]78 82pointer SpriteUpdateHandler_Effect_BossDeath-1; [100]: Effect: Boss Death
;============================================================================ ; TODO: Document Sprites_Maybe_UpdateHitByMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8151]Sprites_Maybe_UpdateHitByMagic: [8151]bc 34 03LDY a:CurrentSprites_HitByMagicBehavior,X [8154]f0 0cBEQ @LAB_PRG14__8162 [8156]88DEY [8157]f0 21BEQ @LAB_PRG14__817a [8159]88DEY [815a]f0 36BEQ @LAB_PRG14__8192 [815c]a9 ffLDA #$ff [815e]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X [8161]60RTS [8162]@LAB_PRG14__8162: [8162]a9 03LDA #$03 [8164]8d 75 03STA a:Arg_DeltaX_Full [8167]a9 00LDA #$00 [8169]8d 74 03STA a:Arg_DeltaX_Frac [816c]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [816f]de 3c 03DEC a:CurrentSprites_HitByMagicIFrames,X [8172]d0 05BNE @LAB_PRG14__8179 [8174]a9 ffLDA #$ff [8176]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X [8179]@LAB_PRG14__8179: [8179]60RTS [817a]@LAB_PRG14__817a: [817a]a9 02LDA #$02 [817c]8d 75 03STA a:Arg_DeltaX_Full [817f]a9 00LDA #$00 [8181]8d 74 03STA a:Arg_DeltaX_Frac [8184]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [8187]de 3c 03DEC a:CurrentSprites_HitByMagicIFrames,X [818a]d0 05BNE @_return1 [818c]a9 ffLDA #$ff [818e]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X [8191]@_return1: [8191]60RTS [8192]@LAB_PRG14__8192: [8192]a9 04LDA #$04 [8194]8d 75 03STA a:Arg_DeltaX_Full [8197]a9 00LDA #$00 [8199]8d 74 03STA a:Arg_DeltaX_Frac [819c]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [819f]90 05BCC @_return2 [81a1]a9 ffLDA #$ff [81a3]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X [81a6]@_return2: [81a6]60RTS
;============================================================================ ; TODO: Document Player_HitEnemyWithMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
[81a7]Player_HitEnemyWithMagic: [81a7]bd cc 02LDA a:CurrentSprites_Entities,X; Load the sprite entity at the given index. [81aa]c9 05CMP #$05; Is this Necron Aides? [81ac]d0 08BNE @_handleHitWithMagic; If not, jump.
; ; This is Necron Aides. Set bit 7 on its phase. ;
[81ae]bd e4 02LDA a:CurrentSprites_Phases,X; Load the phase for Necron Aides. [81b1]09 80ORA #$80; Set bit 7. [81b3]9d e4 02STA a:CurrentSprites_Phases,X; Save it.
; ; Handle hitting the enemy with magic. ; ; This will first play the sound effect, and then begin ; calculating damage to the enemy, factoring in the spell ; and the enemy's magic defense. ;
[81b6]@_handleHitWithMagic: [81b6]a9 02LDA #$02; 2 == Enemy Hit With Magic sound effect [81b8]20 e4 d0JSR Sound_PlayEffect; Play it.
; ; Load the standard damage amount for the current spell. ;
[81bb]b9 a0 b7LDA a:MAGIC_DAMAGE,Y; Load the magic damage for the current spell. [81be]85 00STA Temp_00; Store it temporarily.
; ; Check if the player has the Magical Rod. ;
[81c0]ad 2c 04LDA a:SpecialItems; Load the player's special items. [81c3]29 04AND #$04; Is the Magical Rod equipped? [81c5]f0 08BEQ @_prepareCalcDefense
; ; The player has the Magical Rod. ; ; If they do, increase damage by 50%. ;
[81c7]a5 00LDA Temp_00; Load the magic damage for the spell. [81c9]4aLSR A; Reduce that amount by half (we'll add it back). [81ca]18CLC [81cb]65 00ADC Temp_00; Now add it back to the magic damage (yielding a 50% increase). [81cd]85 00STA Temp_00; Store it. [81cf]@_prepareCalcDefense: [81cf]a9 00LDA #$00 [81d1]85 02STA Temp_Addr_L; Set the default magic defense flags to 0 (0%). [81d3]84 01STY Temp_01; Store the current magic spell ID as a loop counter.
; ; Check if we're hitting the enemy with Deluge or another ; spell. ;
[81d5]c0 00CPY #$00; Is the spell Deluge? [81d7]f0 24BEQ @_reduceEnemyHP
; ; This is not the Deluge spell. ;
[81d9]bc cc 02LDY a:CurrentSprites_Entities,X; Load the entity that's been hit. [81dc]b9 3b b7LDA a:SPRITE_ENTITY_MAGIC_DEFENSE,Y; Load the enemy's magic defenses.
; ; Begin calculating the magic defense. ; ; This is only called for Thunder, Fire, Death, and Tilte. ; ; Starting with the current magic spell ID, we'll rotate the ; most-significant bits into bits 0 and 1 until the current ; spell's magic defense stats are placed there. ; ; Effectively, this makes sure we can operate on the right ; defense flags for the given magic spell as bits 0-1. ;
[81df]@_calcDefenseLoop: [81df]0aASL A; Shift left, placing the most-significant bit into carry. [81e0]26 02ROL Temp_Addr_L; Rotate left, placing that into bit 0. [81e2]0aASL A; Shift left, placing the most-significant bit into carry. [81e3]26 02ROL Temp_Addr_L; Rotate left, placing that into bit 0. [81e5]c6 01DEC Temp_01; Decrement the magic spell counter. [81e7]d0 f6BNE @_calcDefenseLoop; If the current spell's defense flags aren't in bits 0 and 1, loop.
; ; Process those defense stats. ; ; This applies the following logic: ; ; If flags are not empty: ; Reduce damage by 50%. ; ; Flags--; // 11 => 10, 10 => 01, 01 => 0 ; ; If flags are not empty: ; Reduce damage by another 50% (75% total). ; ; If damage hasn't been reduced to 0: ; Change that to 100%. ; ; NOTE: This is kind of weird. It seems to specially handle 75% ; reduction, and then just throws that out and turns it ; into 100%. Maybe they just patched that in to simplify ; later. ;
[81e9]a5 02LDA Temp_Addr_L; Load the magic defense flags. [81eb]29 03AND #$03; Keep only bits 0 and 1. [81ed]a8TAY; Transfer to Y. [81ee]f0 0dBEQ @_reduceEnemyHP; If flags are 0, there's no defense. Jump. [81f0]46 00LSR Temp_00; There's magic defense. Half the damage. [81f2]88DEY; Y-- (defense flags). [81f3]f0 08BEQ @_reduceEnemyHP; If flags are 0, we're done. Jump. [81f5]46 00LSR Temp_00; Half the damage again (75% now). [81f7]f0 04BEQ @_reduceEnemyHP; If 0 magic damage remains, we're done. Jump. [81f9]a9 00LDA #$00; Ignore that 75%. Make it 100%. Why not. [81fb]85 00STA Temp_00; Save it.
; ; Subtract the magic damage from entity's HP. ;
[81fd]@_reduceEnemyHP: [81fd]bd 44 03LDA a:CurrentSprites_HP,X; Load the current HP for the entity being hit. [8200]38SEC [8201]e5 00SBC Temp_00; Subtract the normalized magic damage. [8203]9d 44 03STA a:CurrentSprites_HP,X; Store it back. [8206]b0 25BCS RETURN_822D; If HP > 0, return.
; ; The entity is dead. ;
[8208]bd cc 02LDA a:CurrentSprites_Entities,X; Load the ID of this entity. [820b]c9 18CMP #$18; Is this Sugata? [820d]d0 06BNE @_addExperience; If not, jump.
; ; The enemy is Sugata. Clear the greyscale set when it ; attacked so we don't get stuck in greyscale forever. ;
[820f]a5 0bLDA PPU_Mask; Load the screen color mode. [8211]29 feAND #$fe; Clear the greyscale bit. [8213]85 0bSTA PPU_Mask; Store it.
; ; Add experience from the sprite. ;
[8215]@_addExperience: [8215]20 87 8bJSR Player_AddExperienceFromSprite; Add experience to the player.
; ; Play the killed enemy sound effect. ;
[8218]a9 03LDA #$03; 3 == Enemy Death sound effect [821a]20 e4 d0JSR Sound_PlayEffect; Play it.
; ; Check if this is a normal and big enemy. They need to be ; handled differently. ;
[821d]bc cc 02LDY a:CurrentSprites_Entities,X; Load the ID of this entity. [8220]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y; Load the entity's category. [8223]c9 07CMP #$07; Is it a boss? [8225]d0 03BNE @_isSmallEnemy; If not, jump. It should be a small enemy.
; ; This is a big enemy. Handle cleanup specially. ;
[8227]4c ec abJMP Sprite_ShowBigEnemyDeathByMagicOrWeapon; Show the boss death effect. [822a]@_isSmallEnemy: [822a]4c f6 abJMP Sprite_ShowNormalEnemyDeathByMagic; Show the standard enemy death effect.
; ; XREFS: ; Player_HitEnemyWithMagic ; SpriteUpdateHandler_Effect_EnemyDeath ; SpriteUpdateHandler_Effect_LightningBall20 ;
[822d]RETURN_822D: [822d]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_EnemyDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ad] ; SpriteUpdateHandler_Effect_BossDeath ;============================================================================
[822e]SpriteUpdateHandler_Effect_EnemyDeath: [822e]a9 00LDA #$00 [8230]85 33STA Sprites_PPUOffset [8232]ad 83 03LDA a:SpriteUpdateCounter [8235]4aLSR A [8236]b0 f5BCS RETURN_822D [8238]a9 00LDA #$00 [823a]85 29STA CurrentSprite_FlipMask [823c]85 33STA Sprites_PPUOffset [823e]20 8e 8cJSR Sprite_EnterNextAppearancePhase [8241]ae 78 03LDX a:CurrentSpriteIndex [8244]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8247]0aASL A [8248]0aASL A [8249]49 ffEOR #$ff [824b]85 00STA Temp_00 [824d]e6 00INC Temp_00 [824f]b5 c2LDA CurrentSprites_YPos,X [8251]18CLC [8252]65 00ADC Temp_00 [8254]85 28STA Arg_DrawSprite_PosY [8256]a9 00LDA #$00 [8258]85 33STA Sprites_PPUOffset [825a]a9 01LDA #$01 [825c]20 8e 8cJSR Sprite_EnterNextAppearancePhase [825f]ae 78 03LDX a:CurrentSpriteIndex [8262]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8265]0aASL A [8266]0aASL A [8267]85 00STA Temp_00 [8269]b5 c2LDA CurrentSprites_YPos,X [826b]18CLC [826c]65 00ADC Temp_00 [826e]85 28STA Arg_DrawSprite_PosY [8270]a9 00LDA #$00 [8272]85 33STA Sprites_PPUOffset [8274]a9 02LDA #$02 [8276]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_BossDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::814f] ;============================================================================
[8279]SpriteUpdateHandler_Effect_BossDeath: [8279]a9 00LDA #$00 [827b]85 33STA Sprites_PPUOffset [827d]bd e4 02LDA a:CurrentSprites_Phases,X [8280]c9 02CMP #$02 [8282]f0 07BEQ SpriteUpdateHandler_Effect_LightningBall20 [8284]c9 07CMP #$07 [8286]f0 03BEQ SpriteUpdateHandler_Effect_LightningBall20 [8288]4c 2e 82JMP SpriteUpdateHandler_Effect_EnemyDeath
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_LightningBall20 ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80af] ; SpriteUpdateHandler_Effect_BossDeath ;============================================================================
[828b]SpriteUpdateHandler_Effect_LightningBall20: [828b]a9 00LDA #$00 [828d]85 33STA Sprites_PPUOffset [828f]ad 83 03LDA a:SpriteUpdateCounter [8292]4aLSR A [8293]b0 98BCS RETURN_822D [8295]a9 00LDA #$00 [8297]85 29STA CurrentSprite_FlipMask [8299]a9 00LDA #$00 [829b]85 33STA Sprites_PPUOffset [829d]20 8e 8cJSR Sprite_EnterNextAppearancePhase [82a0]a0 03LDY #$03 [82a2]@LAB_PRG14__82a2: [82a2]ae 78 03LDX a:CurrentSpriteIndex [82a5]b5 baLDA CurrentSprites_XPos_Full,X [82a7]85 27STA Arg_DrawSprite_PosX [82a9]b5 c2LDA CurrentSprites_YPos,X [82ab]85 28STA Arg_DrawSprite_PosY [82ad]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [82b0]0aASL A [82b1]0aASL A [82b2]59 f0 82EOR a:BYTE_ARRAY_PRG14__82f0,Y [82b5]85 00STA Temp_00 [82b7]10 02BPL @LAB_PRG14__82bb [82b9]e6 00INC Temp_00 [82bb]@LAB_PRG14__82bb: [82bb]98TYA [82bc]29 02AND #$02 [82be]d0 0aBNE @LAB_PRG14__82ca [82c0]b5 c2LDA CurrentSprites_YPos,X [82c2]18CLC [82c3]65 00ADC Temp_00 [82c5]85 28STA Arg_DrawSprite_PosY [82c7]4c d1 82JMP @LAB_PRG14__82d1 [82ca]@LAB_PRG14__82ca: [82ca]b5 baLDA CurrentSprites_XPos_Full,X [82cc]18CLC [82cd]65 00ADC Temp_00 [82cf]85 27STA Arg_DrawSprite_PosX [82d1]@LAB_PRG14__82d1: [82d1]b9 f4 82LDA a:BYTE_ARRAY_PRG14__82f4,Y [82d4]85 29STA CurrentSprite_FlipMask [82d6]b9 ec 82LDA a:BYTE_ARRAY_PRG14__82ec,Y [82d9]85 00STA Temp_00 [82db]98TYA [82dc]48PHA [82dd]a9 00LDA #$00 [82df]85 33STA Sprites_PPUOffset [82e1]a5 00LDA Temp_00 [82e3]20 8e 8cJSR Sprite_EnterNextAppearancePhase [82e6]68PLA [82e7]a8TAY [82e8]88DEY [82e9]10 b7BPL @LAB_PRG14__82a2 [82eb]60RTS
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82ec]BYTE_ARRAY_PRG14__82ec: [82ec]01.byte $01; [0]: [82ed]02.byte $02; [1]: [82ee]03.byte $03; [2]: [82ef]03.byte $03; [3]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82f0]BYTE_ARRAY_PRG14__82f0: [82f0]ff.byte $ff; [0]: [82f1]00.byte $00; [1]: [82f2]ff.byte $ff; [2]: [82f3]00.byte $00; [3]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82f4]BYTE_ARRAY_PRG14__82f4: [82f4]00.byte $00; [0]: [82f5]00.byte $00; [1]: [82f6]00.byte $00; [2]: [82f7]40.byte $40; [3]:
;============================================================================ ; TODO: Document Sprite_CalcDistanceXToPlayer ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_Unknown_29_SomeSetup ; SpriteOp_CheckDistanceToPlayer_X ;============================================================================
[82f8]Sprite_CalcDistanceXToPlayer: [82f8]b5 baLDA CurrentSprites_XPos_Full,X [82fa]38SEC [82fb]e5 9eSBC Player_PosX_Block [82fd]b0 13BCS @LAB_PRG14__8312 [82ff]49 ffEOR #$ff [8301]18CLC [8302]69 01ADC #$01 [8304]18CLC [8305]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X [8308]38SEC [8309]f9 d1 b4SBC a:SPRITE_HITBOX_WIDTHS,Y [830c]b0 02BCS @_returnTrue [830e]a9 00LDA #$00 [8310]@_returnTrue: [8310]18CLC [8311]60RTS [8312]@LAB_PRG14__8312: [8312]38SEC [8313]e9 10SBC #$10 [8315]b0 03BCS @_return [8317]a9 00LDA #$00 [8319]38SEC [831a]@_return: [831a]60RTS
;============================================================================ ; TODO: Document Sprite_CalcDistanceYToPlayer ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9699 ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_GiantBees ; SpriteBehavior_Naga ; SpriteBehavior_Unknown_29_SomeSetup ; SpriteOp_CheckDistanceToPlayer_Y ;============================================================================
[831b]Sprite_CalcDistanceYToPlayer: [831b]b5 c2LDA CurrentSprites_YPos,X [831d]38SEC [831e]e5 a1SBC Player_PosY [8320]b0 06BCS @_return [8322]49 ffEOR #$ff [8324]18CLC [8325]69 01ADC #$01 [8327]18CLC [8328]@_return: [8328]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_Unknown_29_SomeSetup ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Unknown_29 ;============================================================================
[8329]SpriteBehavior_Unknown_29_SomeSetup: [8329]20 7b 86JSR BScript_Action_FacePlayerX [832c]20 91 86JSR BScript_Action_FacePlayerY [832f]20 f8 82JSR Sprite_CalcDistanceXToPlayer [8332]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [8335]20 1b 83JSR Sprite_CalcDistanceYToPlayer [8338]9d 14 03STA a:CurrentSprites_BehaviorState_YFull,X [833b]dd 0c 03CMP a:CurrentSprites_BehaviorState_XFull,X [833e]b0 2cBCS @LAB_PRG14__836c [8340]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [8343]8d bd 04STA a:Arg_PlayerHealthDelta_U [8346]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [8349]8d be 04STA a:SpriteBehaviorUnknown20_SomethingXOrY [834c]a9 00LDA #$00 [834e]8d bc 04STA a:Arg_PlayerHealthDelta_L [8351]8d bf 04STA a:BYTE_04bf [8354]9d 1c 03STA a:CurrentSprites_BehaviorState_XFrac,X [8357]20 ec c0JSR Player_Something_ChangeHP [835a]ad bd 04LDA a:Arg_PlayerHealthDelta_U [835d]9d 14 03STA a:CurrentSprites_BehaviorState_YFull,X [8360]ad bc 04LDA a:Arg_PlayerHealthDelta_L [8363]9d 24 03STA a:CurrentSprites_BehaviorState_YFrac,X [8366]a9 01LDA #$01 [8368]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [836b]60RTS [836c]@LAB_PRG14__836c: [836c]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [836f]8d bd 04STA a:Arg_PlayerHealthDelta_U [8372]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [8375]8d be 04STA a:SpriteBehaviorUnknown20_SomethingXOrY [8378]a9 00LDA #$00 [837a]8d bc 04STA a:Arg_PlayerHealthDelta_L [837d]8d bf 04STA a:BYTE_04bf [8380]9d 24 03STA a:CurrentSprites_BehaviorState_YFrac,X [8383]20 ec c0JSR Player_Something_ChangeHP [8386]ad bd 04LDA a:Arg_PlayerHealthDelta_U [8389]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [838c]ad bc 04LDA a:Arg_PlayerHealthDelta_L [838f]9d 1c 03STA a:CurrentSprites_BehaviorState_XFrac,X [8392]a9 01LDA #$01 [8394]9d 14 03STA a:CurrentSprites_BehaviorState_YFull,X [8397]60RTS
;============================================================================ ; MAYBE DEADCODE ; ; XREFS: ; FUN_PRG14__8398 ;============================================================================
[8398]FUN_PRG14__8398: [8398]1e 0c 03ASL a:CurrentSprites_BehaviorState_XFull,X [839b]3e 1c 03ROL a:CurrentSprites_BehaviorState_XFrac,X [839e]1e 14 03ASL a:CurrentSprites_BehaviorState_YFull,X [83a1]3e 24 03ROL a:CurrentSprites_BehaviorState_YFrac,X [83a4]88DEY [83a5]d0 f1BNE FUN_PRG14__8398 [83a7]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[83a8]FUN_PRG14__83a8: [83a8]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [83ab]8d 74 03STA a:Arg_DeltaX_Frac [83ae]bd 1c 03LDA a:CurrentSprites_BehaviorState_XFrac,X [83b1]8d 75 03STA a:Arg_DeltaX_Full [83b4]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [83b7]8d 76 03STA a:Arg_DeltaY_Frac [83ba]bd 24 03LDA a:CurrentSprites_BehaviorState_YFrac,X [83bd]8d 77 03STA a:Arg_DeltaY_Full [83c0]60RTS
;============================================================================ ; TODO: Document Sprites_CalcHorizSpriteMovement ; ; INPUTS: ; A ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9593 ; SpriteBehavior_Bihoruda ; SpriteBehavior_Borabohra ; SpriteBehavior_Yuinaru ;============================================================================
[83c1]Sprites_CalcHorizSpriteMovement: [83c1]8d 74 03STA a:Arg_DeltaX_Frac; Set pixels delta from A. [83c4]a9 00LDA #$00; A = 0 [83c6]@_loop: [83c6]0e 74 03ASL a:Arg_DeltaX_Frac; Shift the pixels delta amount left. [83c9]2aROL A [83ca]88DEY [83cb]d0 f9BNE @_loop [83cd]8d 75 03STA a:Arg_DeltaX_Full [83d0]60RTS
;============================================================================ ; TODO: Document Sprites_CalcVerticalSpriteMovement ; ; INPUTS: ; A ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; CastMagic_UpdateTilte ; SpriteBehavior_Bihoruda ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_Garbled3 ; SpriteBehavior_GiantBees ; SpriteBehavior_Hop ; SpriteBehavior_KingGrieve ; SpriteBehavior_Lilith ; SpriteBehavior_Naga ; SpriteBehavior_Ripasheiku ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_Yuinaru ;============================================================================
[83d1]Sprites_CalcVerticalSpriteMovement: [83d1]8d 76 03STA a:Arg_DeltaY_Frac [83d4]a9 00LDA #$00 [83d6]@LAB_PRG14__83d6: [83d6]0e 76 03ASL a:Arg_DeltaY_Frac [83d9]2aROL A [83da]88DEY [83db]d0 f9BNE @LAB_PRG14__83d6 [83dd]8d 77 03STA a:Arg_DeltaY_Full [83e0]60RTS
;============================================================================ ; TODO: Document Sprites_CalcYFromGravity ; ; INPUTS: ; A ; Y ; ; OUTPUTS: ; A ; ; XREFS: ; CastMagic_UpdateTilte ; FUN_PRG14__9593 ; SpriteBehavior_Bihoruda ; SpriteBehavior_Borabohra ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_GiantBees ; SpriteBehavior_Hop ; SpriteBehavior_Lilith ; SpriteBehavior_Naga ; SpriteBehavior_Ripasheiku ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_Yuinaru ;============================================================================
[83e1]Sprites_CalcYFromGravity: [83e1]48PHA [83e2]39 f7 83AND a:SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [83e5]85 00STA Temp_00 [83e7]68PLA [83e8]39 ff 83AND a:SPRITES_MAYBE_GRAVITY,Y [83eb]f0 07BEQ @LAB_PRG14__83f4 [83ed]b9 f7 83LDA a:SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [83f0]38SEC [83f1]e5 00SBC Temp_00 [83f3]60RTS [83f4]@LAB_PRG14__83f4: [83f4]a5 00LDA Temp_00 [83f6]60RTS
; ; XREFS: ; SpriteBehavior_Hop ; SpriteBehavior_SomethingZoradohna_18 ; Sprites_CalcYFromGravity ;
[83f7]SPRITE_BEHAVIOR_HOP_PEAK_TICKS: [83f7]ff.byte $ff; [0]: [83f8]7f.byte $7f; [1]: [83f9]3f.byte $3f; [2]: [83fa]1f.byte $1f; [3]: [83fb]0f.byte $0f; [4]: [83fc]07.byte $07; [5]: [83fd]03.byte $03; [6]: [83fe]01.byte $01; [7]:
; ; XREFS: ; Sprites_CalcYFromGravity ;
[83ff]SPRITES_MAYBE_GRAVITY: [83ff]00.byte $00; [0]: [8400]80.byte $80; [1]: [8401]40.byte $40; [2]: [8402]20.byte $20; [3]: [8403]10.byte $10; [4]: [8404]08.byte $08; [5]: [8405]04.byte $04; [6]: [8406]02.byte $02; [7]:
;============================================================================ ; TODO: Document BScript_Action_FlipXDirection ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a796] ; SpriteBehavior_WalkForward ;============================================================================
[8407]BScript_Action_FlipXDirection: [8407]bd dc 02LDA a:CurrentSprites_Flags,X [840a]49 01EOR #$01 [840c]9d dc 02STA a:CurrentSprites_Flags,X [840f]60RTS
;============================================================================ ; TODO: Document BScript_Action_FlipYDirection ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a79a] ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_Hop ; SpriteBehavior_Lilith ; SpriteBehavior_SomethingZoradohna_18 ;============================================================================
[8410]BScript_Action_FlipYDirection: [8410]bd dc 02LDA a:CurrentSprites_Flags,X [8413]49 80EOR #$80 [8415]9d dc 02STA a:CurrentSprites_Flags,X [8418]60RTS
;============================================================================ ; TODO: Document Sprite_MoveHorizAndTurnAroundIfNeeded ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9593 ; SpriteBehavior_Bihoruda ; SpriteBehavior_BuzzAround ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_Ishiisu ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_WalkForward ; SpriteBehavior_Yareeka ; Sprite_MoveHorizOneBlockOrTurnAround ;============================================================================
[8419]Sprite_MoveHorizAndTurnAroundIfNeeded: [8419]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [841c]90 08BCC @_return [841e]bd dc 02LDA a:CurrentSprites_Flags,X [8421]49 01EOR #$01 [8423]9d dc 02STA a:CurrentSprites_Flags,X [8426]@_return: [8426]60RTS
;============================================================================ ; TODO: Document Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_EnemyMagic ; SpriteBehavior_GiantBees ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_Yuinaru ;============================================================================
[8427]Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz: [8427]20 9a 84JSR Sprite_MoveForwardX [842a]b5 baLDA CurrentSprites_XPos_Full,X [842c]c9 f0CMP #$f0 [842e]90 19BCC @_returnFalse [8430]bd dc 02LDA a:CurrentSprites_Flags,X [8433]4aLSR A [8434]b5 baLDA CurrentSprites_XPos_Full,X [8436]29 f0AND #$f0 [8438]b0 03BCS @LAB_PRG14__843d [843a]18CLC [843b]69 10ADC #$10 [843d]@LAB_PRG14__843d: [843d]95 baSTA CurrentSprites_XPos_Full,X [843f]bd dc 02LDA a:CurrentSprites_Flags,X [8442]49 01EOR #$01 [8444]9d dc 02STA a:CurrentSprites_Flags,X [8447]38SEC [8448]60RTS [8449]@_returnFalse: [8449]18CLC [844a]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[844b]FUN_PRG14__844b: [844b]20 6c 84JSR Sprite_Maybe_AddFacingPosX [844e]b5 baLDA CurrentSprites_XPos_Full,X [8450]c9 f0CMP #$f0 [8452]90 17BCC RETURN_846B [8454]bd dc 02LDA a:CurrentSprites_Flags,X [8457]4aLSR A [8458]b5 baLDA CurrentSprites_XPos_Full,X [845a]29 f0AND #$f0 [845c]b0 03BCS @LAB_PRG14__8461 [845e]18CLC [845f]69 10ADC #$10 [8461]@LAB_PRG14__8461: [8461]95 baSTA CurrentSprites_XPos_Full,X [8463]bd dc 02LDA a:CurrentSprites_Flags,X [8466]49 01EOR #$01 [8468]9d dc 02STA a:CurrentSprites_Flags,X
; ; XREFS: ; FUN_PRG14__844b ; Sprite_Maybe_AddFacingPosX ;
[846b]RETURN_846B: [846b]60RTS
;============================================================================ ; TODO: Document Sprite_Maybe_AddFacingPosX ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__844b ;============================================================================
[846c]Sprite_Maybe_AddFacingPosX: [846c]b5 baLDA CurrentSprites_XPos_Full,X [846e]c5 9eCMP Player_PosX_Block [8470]f0 f9BEQ RETURN_846B [8472]90 0aBCC @LAB_PRG14__847e [8474]bd dc 02LDA a:CurrentSprites_Flags,X [8477]29 01AND #$01 [8479]d0 0dBNE @LAB_PRG14__8488 [847b]4c a0 84JMP Sprite_SubtractPosX [847e]@LAB_PRG14__847e: [847e]bd dc 02LDA a:CurrentSprites_Flags,X [8481]29 01AND #$01 [8483]f0 03BEQ @LAB_PRG14__8488 [8485]4c b2 84JMP Sprite_AddPosX [8488]@LAB_PRG14__8488: [8488]18CLC [8489]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[848a]FUN_PRG14__848a: [848a]a9 00LDA #$00 [848c]8d 74 03STA a:Arg_DeltaX_Frac [848f]a9 01LDA #$01 [8491]8d 75 03STA a:Arg_DeltaX_Full
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprites_Something_SomethingAndMoveHoriz ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_Borabohra ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_Hop ; SpriteBehavior_KingGrieve ; SpriteBehavior_Lilith ; SpriteBehavior_NecronAides ; SpriteBehavior_ShadowEura ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_Unknown_29 ; SpriteBehavior__a91e ; Sprite_MoveHorizAndTurnAroundIfNeeded ; Sprites_Maybe_UpdateHitByMagic ;============================================================================
[8494]Sprites_Something_SomethingAndMoveHoriz: [8494]20 9a 84JSR Sprite_MoveForwardX [8497]4c c4 84JMP MoveSpriteHorizIfPossible
;============================================================================ ; Move the entity in the facing direction a given amount. ; ; If the entity is facing right, its X position will ; increment by a given value. ; ; If facing left, its X position will decrement instead. ; ; INPUTS: ; X: ; The index of the sprite entity. ; ; Arg_DeltaX_Full: ; Arg_DeltaX_Frac: ; The value to add to or subtract from the X ; position. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The current X position of the entity. ; ; OUTPUTS: ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The updated X position. ; ; CALLS: ; Sprite_AddPosX ; Sprite_SubtractPosX ; ; XREFS: ; Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz ; Sprites_Something_SomethingAndMoveHoriz ;============================================================================
[849a]Sprite_MoveForwardX: [849a]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [849d]4aLSR A; Shift the "Facing Right" bit into Carry. [849e]b0 12BCS Sprite_AddPosX; If Carry is set, add to X. Else, fall through to subtract.
; ; v-- Fall through --v ;
;============================================================================ ; Move the entity to the left by a given amount. ; ; INPUTS: ; X: ; The index of the sprite entity. ; ; Arg_DeltaX_Full: ; Arg_DeltaX_Frac: ; The value to subtract from the X position. ; ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The current X position of the entity. ; ; OUTPUTS: ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The updated X position. ; ; XREFS: ; Sprite_Maybe_AddFacingPosX ;============================================================================
[84a0]Sprite_SubtractPosX: [84a0]bd bc 02LDA a:CurrentSprites_XPos_Frac,X; Load the fractional X position for the sprite entity. [84a3]38SEC [84a4]ed 74 03SBC a:Arg_DeltaX_Frac; Subtract the provided value. [84a7]9d bc 02STA a:CurrentSprites_XPos_Frac,X; Store it. [84aa]b5 baLDA CurrentSprites_XPos_Full,X; Load the block X position for the sprite entity. [84ac]ed 75 03SBC a:Arg_DeltaX_Full; Subtract the provided value. [84af]95 baSTA CurrentSprites_XPos_Full,X; Store it. [84b1]60RTS
;============================================================================ ; Move the entity to the right by a given amount. ; ; INPUTS: ; X: ; The index of the sprite entity. ; ; Arg_DeltaX_Full: ; Arg_DeltaX_Frac: ; The value to add to the X position. ; ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The current X position of the entity. ; ; OUTPUTS: ; CurrentSprites_XPos_Full: ; CurrentSprites_XPos_Frac: ; The updated X position. ; ; XREFS: ; Sprite_Maybe_AddFacingPosX ; Sprite_MoveForwardX ;============================================================================
[84b2]Sprite_AddPosX: [84b2]bd bc 02LDA a:CurrentSprites_XPos_Frac,X; Load the fractional X position for the sprite entity. [84b5]18CLC [84b6]6d 74 03ADC a:Arg_DeltaX_Frac; Add the provided value. [84b9]9d bc 02STA a:CurrentSprites_XPos_Frac,X; Store it. [84bc]b5 baLDA CurrentSprites_XPos_Full,X; Load the block X position for the sprite entity. [84be]6d 75 03ADC a:Arg_DeltaX_Full; Add the provided value. [84c1]95 baSTA CurrentSprites_XPos_Full,X; Store it. [84c3]60RTS
;============================================================================ ; Move the sprite horizontally if possible. ; ; If the sprite cannot move, then this will do nothing. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSpriteIndex: ; The index of the current sprite. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; CurrentSprites_XPos_Full: ; The full block X position of the sprites. ; ; OUTPUTS: ; C: ; 1 if the sprite could move. ; 0 if the sprite could not move. ; ; Blocks_Result: ; Clobbered. ; ; CALLS: ; CurrentSprite_CanMoveInDirection ; ; XREFS: ; Sprites_Something_SomethingAndMoveHoriz ;============================================================================
[84c4]MoveSpriteHorizIfPossible: [84c4]98TYA [84c5]48PHA [84c6]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite flags. [84c9]29 01AND #$01 [84cb]aaTAX [84cc]20 10 87JSR CurrentSprite_CanMoveInDirection; Check if this sprite can move at all [84cf]a5 b7LDA Blocks_Result; Load the current block properties [84d1]f0 1aBEQ @_cannotMove; If 0, it cannot move [84d3]ae 78 03LDX a:CurrentSpriteIndex; Load the current sprite [84d6]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [84d9]29 01AND #$01 [84db]a8TAY [84dc]b5 baLDA CurrentSprites_XPos_Full,X; Load the X coordinate of the sprite [84de]29 f0AND #$f0; Grab the X pos (top nibble) [84e0]c0 01CPY #$01 [84e2]b0 03BCS @_updateHorizPos [84e4]18CLC [84e5]69 10ADC #$10; Add 1 to the block X position [84e7]@_updateHorizPos: [84e7]95 baSTA CurrentSprites_XPos_Full,X; Store the block position for the sprite. [84e9]68PLA; Restore the original Y register. [84ea]a8TAY [84eb]38SEC; C = 1 (moved, true result) [84ec]60RTS [84ed]@_cannotMove: [84ed]68PLA; Restore the registers [84ee]a8TAY [84ef]ae 78 03LDX a:CurrentSpriteIndex [84f2]18CLC; C = 0 (could not move, false result) [84f3]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[84f4]DEADCODE_FUN_PRG14__84f4: [84f4]20 43 85JSR Sprites_CanMoveDownByHitbox [84f7]aaTAX [84f8]d0 34BNE SpriteBehavior_RestoreXRegister [84fa]ae 78 03LDX a:CurrentSpriteIndex [84fd]20 34 85JSR DEADCODE_Sprites_CanMoveDownBelowHitbox [8500]aaTAX [8501]f0 0aBEQ SpriteBehavior_Something_850d [8503]ae 78 03LDX a:CurrentSpriteIndex [8506]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_Ishiisu_Something_915b ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ishiisu ;============================================================================
[8507]SpriteBehavior_Ishiisu_Something_915b: [8507]20 43 85JSR Sprites_CanMoveDownByHitbox [850a]aaTAX [850b]d0 21BNE SpriteBehavior_RestoreXRegister
; ; v-- Fall through --v ;
;============================================================================ ; MAYBE DEADCODE ; ; XREFS: ; DEADCODE_FUN_PRG14__84f4 ;============================================================================
[850d]SpriteBehavior_Something_850d: [850d]ae 78 03LDX a:CurrentSpriteIndex [8510]bd dc 02LDA a:CurrentSprites_Flags,X [8513]4aLSR A [8514]08PHP [8515]b5 baLDA CurrentSprites_XPos_Full,X [8517]29 f0AND #$f0 [8519]28PLP [851a]b0 02BCS @LAB_PRG14__851e [851c]69 10ADC #$10 [851e]@LAB_PRG14__851e: [851e]95 baSTA CurrentSprites_XPos_Full,X [8520]a5 1aLDA InterruptCounter [8522]29 3fAND #$3f; On interrupts 64 and 128... [8524]d0 08BNE SpriteBehavior_RestoreXRegister [8526]bd dc 02LDA a:CurrentSprites_Flags,X [8529]49 01EOR #$01 [852b]9d dc 02STA a:CurrentSprites_Flags,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_RestoreXRegister ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; DEADCODE_FUN_PRG14__84f4 ; SpriteBehavior_Ishiisu_Something_915b ; SpriteBehavior_Something_850d ;============================================================================
[852e]SpriteBehavior_RestoreXRegister: [852e]ae 78 03LDX a:CurrentSpriteIndex [8531]60RTS
; ; XREFS: ; Sprites_CheckPlacementInvalidAtY ;
[8532]SPRITE_CHECK_PLACEMENT_X_OFFSETS_BY_FACING: [8532]00.byte $00; [0]: 0 pixel movement [8533]0f.byte $0f; [1]: 15 pixel movement
;============================================================================ ; TODO: Document DEADCODE_Sprites_CanMoveDownBelowHitbox ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; DEADCODE_FUN_PRG14__84f4 ;============================================================================
[8534]DEADCODE_Sprites_CanMoveDownBelowHitbox: [8534]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X; Load the hitbox type for the current sprite. [8537]b5 c2LDA CurrentSprites_YPos,X; Load the sprite's Y position. [8539]18CLC [853a]79 d8 b4ADC a:SPRITE_HITBOX_HEIGHTS,Y; Add the hitbox height. [853d]18CLC [853e]69 10ADC #$10; Add 16 (block height). [8540]4c 4c 85JMP Sprites_CheckPlacementInvalidAtY; Check if the sprite can move to that position.
;============================================================================ ; TODO: Document Sprites_CanMoveDownByHitbox ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; DEADCODE_FUN_PRG14__84f4 ; SpriteBehavior_Ishiisu_Something_915b ; Sprites_SetCurrentSpriteCanMove ;============================================================================
[8543]Sprites_CanMoveDownByHitbox: [8543]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X; Load the hitbox type for the current sprite. [8546]b5 c2LDA CurrentSprites_YPos,X; Load the sprite's Y position. [8548]18CLC [8549]79 d8 b4ADC a:SPRITE_HITBOX_HEIGHTS,Y; Add the hitbox height.
; ; v-- Fall through --v ;
;============================================================================ ; Check whether the sprite can be placed at a given Y position. ; ; This will take the given Y position, round the X and Y to ; the nearest block position, and check whether the entity is ; capable of being placed there (avoiding impassable blocks and ; ladders). ; ; INPUTS: ; A: ; The provided Y position to check. ; ; X: ; The index of the sprite to check. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; CurrentSprites_XPos_Full ; The block X position of the sprite. ; ; SPRITE_CHECK_PLACEMENT_X_OFFSETS_BY_FACING: ; Offset table to help round X positions of sprites. ; ; OUTPUTS: ; A: ; 0 if the sprite can be moved there. ; 1 if it cannot. ; ; Arg_PixelPosX: ; Arg_PixelPosY: ; Clobbered. ; ; CALLS: ; Area_ConvertPixelsToBlockPos ; Area_IsBlockImpassableOrLadder ; ; XREFS: ; DEADCODE_Sprites_CanMoveDownBelowHitbox ;============================================================================
[854c]Sprites_CheckPlacementInvalidAtY:
; ; Take the provided Y value (as the A register) and ; increment it by 1 for the block position check. It's ; dropped by 1 in order to check the next block down if ; it's anywhere but at the very top of its current block. ;
[854c]85 b6STA Arg_PixelPosY; Store A as the Y argument for placement checks. [854e]e6 b6INC Arg_PixelPosY; Increment by 1.
; ; Calculate the X position to check. ; ; If the sprite is facing right, we'll add 15, which is 1 ; less than the block width. This keeps it on the same block ; if at the left-most edge, but checks the next block if ; overlapping. ; ; If the sprite is facing left, nothing will be added. We ; can safely assume it's on the right block for checking ; purposes. ;
[8550]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [8553]29 01AND #$01; Keep the Facing bit. [8555]a8TAY; Transfer to Y. [8556]b5 baLDA CurrentSprites_XPos_Full,X; Load the sprite's X position. [8558]18CLC [8559]79 32 85ADC a:SPRITE_CHECK_PLACEMENT_X_OFFSETS_BY_FACING,Y; Add an offset based on the facing bit. [855c]85 b5STA Arg_PixelPosX; Store as the X argument for checks.
; ; Convert the pixel positions to a block position, and ; then set a result based on whether the resulting block is ; impassable/a ladder (in other words, the entity can't move ; there). ;
[855e]20 6c e8JSR Area_ConvertPixelsToBlockPos; Convert the pixels to a block position. [8561]4c 87 e8JMP Area_IsBlockImpassableOrLadder; Check if the result is either impassable or a ladder.
;============================================================================ ; TODO: Document Sprite_MoveVertAndFlipIfNeeded ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Bihoruda ; SpriteBehavior_BuzzAround ; SpriteBehavior_MoveVertically ;============================================================================
[8564]Sprite_MoveVertAndFlipIfNeeded: [8564]20 ca 85JSR Sprite_CalculateNewVertPos [8567]20 75 85JSR MoveSpriteVerticalIfPossible [856a]90 08BCC @_return [856c]bd dc 02LDA a:CurrentSprites_Flags,X [856f]49 80EOR #$80 [8571]9d dc 02STA a:CurrentSprites_Flags,X [8574]@_return: [8574]60RTS
;============================================================================ ; TODO: Document MoveSpriteVerticalIfPossible ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; Sprite_MoveVertAndFlipIfNeeded ; Sprite_MoveVertical ;============================================================================
[8575]MoveSpriteVerticalIfPossible: [8575]bd dc 02LDA a:CurrentSprites_Flags,X [8578]2aROL A [8579]2aROL A [857a]29 01AND #$01 [857c]09 02ORA #$02 [857e]aaTAX [857f]20 10 87JSR CurrentSprite_CanMoveInDirection [8582]ae 78 03LDX a:CurrentSpriteIndex [8585]a5 b7LDA Blocks_Result [8587]f0 11BEQ @_returnFalse [8589]bd dc 02LDA a:CurrentSprites_Flags,X [858c]0aASL A [858d]b5 c2LDA CurrentSprites_YPos,X [858f]29 f0AND #$f0 [8591]b0 03BCS @_returnTrue [8593]18CLC [8594]69 10ADC #$10 [8596]@_returnTrue: [8596]95 c2STA CurrentSprites_YPos,X [8598]38SEC [8599]60RTS [859a]@_returnFalse: [859a]18CLC [859b]60RTS
;============================================================================ ; TODO: Document Sprite_Maybe_TurnAroundIfAtScreenEdgeVert ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ExecutionHood ; SpriteBehavior_GiantBees ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_Yuinaru ;============================================================================
[859c]Sprite_Maybe_TurnAroundIfAtScreenEdgeVert: [859c]20 ca 85JSR Sprite_CalculateNewVertPos [859f]20 ad 85JSR Sprite_CapToBlockOppositeFalling [85a2]90 08BCC @_return [85a4]bd dc 02LDA a:CurrentSprites_Flags,X [85a7]49 80EOR #$80 [85a9]9d dc 02STA a:CurrentSprites_Flags,X [85ac]@_return: [85ac]60RTS
;============================================================================ ; Move a sprite up or down based on the opposite of the falling flag. ; ; If the sprite is falling, the sprite's Y position will be ; kept on the same block, moving up if needed to the start ; of the block. ; ; If the sprite is rising, the sprite's Y position is moved ; to the top of the next block down. ; ; This is used in behavior code. ; ; INPUTS: ; X: ; The sprite index. ; ; CurrentSprites_Flags: ; The sprite flags. ; ; CurrentSprites_YPos: ; The sprite Y positions. ; ; OUTPUTS: ; C: ; 0 = Sitting at bottom of the screen. ; 1 = Capped to a block position. ; ; CurrentSprites_YPos: ; The updated Y positions. ; ; XREFS: ; Sprite_Maybe_TurnAroundIfAtScreenEdgeVert ;============================================================================
[85ad]Sprite_CapToBlockOppositeFalling:
; ; Check if the Y position is at the bottom of the screen. ;
[85ad]b5 c2LDA CurrentSprites_YPos,X; Load the sprite's Y position. [85af]c9 e0CMP #$e0; Is Y < 224? [85b1]90 10BCC @_return; If so, return.
; ; There's room to fall. Check if the sprite is falling. ;
[85b3]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [85b6]0aASL A; Shift the Falling flag into C. [85b7]b5 c2LDA CurrentSprites_YPos,X; A = Y position. [85b9]29 f0AND #$f0; Round (floor) to a block position. [85bb]b0 03BCS @_setY; If falling, jump to set the position as Y.
; ; The sprite is not falling. It's moving up. ;
[85bd]18CLC; Else, clear carry. [85be]69 10ADC #$10; A += 16 (Y position)
; ; Set the resulting Y position for the sprite, and ; set C = 1 for the result. ;
[85c0]@_setY: [85c0]95 c2STA CurrentSprites_YPos,X; Set as the new Y position. [85c2]38SEC; Set C = 1. [85c3]@_return: [85c3]60RTS
;============================================================================ ; TODO: Document Sprite_MoveVertical ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_Garbled3 ; SpriteBehavior_Hop ; SpriteBehavior_KingGrieve ; SpriteBehavior_KingGrieve_MoveDown ; SpriteBehavior_Naga ; SpriteBehavior_Ripasheiku ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_Unknown_29 ;============================================================================
[85c4]Sprite_MoveVertical: [85c4]20 ca 85JSR Sprite_CalculateNewVertPos [85c7]4c 75 85JMP MoveSpriteVerticalIfPossible
;============================================================================ ; TODO: Document Sprite_CalculateNewVertPos ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Lilith ; SpriteBehavior_NecronAides ; Sprite_Maybe_TurnAroundIfAtScreenEdgeVert ; Sprite_MoveVertAndFlipIfNeeded ; Sprite_MoveVertical ;============================================================================
[85ca]Sprite_CalculateNewVertPos: [85ca]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [85cd]30 12BMI @LAB_PRG14__85e1 [85cf]bd c4 02LDA a:CurrentSprites_YPos_Frac,X [85d2]38SEC [85d3]ed 76 03SBC a:Arg_DeltaY_Frac [85d6]9d c4 02STA a:CurrentSprites_YPos_Frac,X [85d9]b5 c2LDA CurrentSprites_YPos,X [85db]ed 77 03SBC a:Arg_DeltaY_Full [85de]95 c2STA CurrentSprites_YPos,X [85e0]60RTS [85e1]@LAB_PRG14__85e1: [85e1]bd c4 02LDA a:CurrentSprites_YPos_Frac,X [85e4]18CLC [85e5]6d 76 03ADC a:Arg_DeltaY_Frac [85e8]9d c4 02STA a:CurrentSprites_YPos_Frac,X [85eb]b5 c2LDA CurrentSprites_YPos,X [85ed]6d 77 03ADC a:Arg_DeltaY_Full [85f0]95 c2STA CurrentSprites_YPos,X [85f2]60RTS [85f3]ae 78 03LDX a:CurrentSpriteIndex [85f6]bd dc 02LDA a:CurrentSprites_Flags,X [85f9]29 01AND #$01 [85fb]a8TAY [85fc]b5 baLDA CurrentSprites_XPos_Full,X [85fe]18CLC [85ff]79 1d 86ADC a:BYTE_ARRAY_PRG14__861d,Y [8602]85 b5STA Arg_PixelPosX [8604]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X [8607]b5 c2LDA CurrentSprites_YPos,X [8609]18CLC [860a]79 d8 b4ADC a:SPRITE_HITBOX_HEIGHTS,Y [860d]85 b6STA Arg_PixelPosY [860f]e6 b6INC Arg_PixelPosY [8611]20 6c e8JSR Area_ConvertPixelsToBlockPos [8614]20 7c e8JSR ScreenBuffer_IsBlockImpassable [8617]85 b7STA Blocks_Result [8619]ae 78 03LDX a:CurrentSpriteIndex [861c]60RTS [861d]BYTE_ARRAY_PRG14__861d: [861d]00.byte $00; [0]: [861e]0f.byte $0f; [1]:
;============================================================================ ; TODO: Document Sprites_SetCurrentSpriteCanMove ; ; INPUTS: ; None. ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_EnemyUnused39 ; SpriteBehavior_Fall ; SpriteBehavior_NecronAides ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_WalkForward ; SpriteBehavior__a91e ; Sprite_FallIfNeeded ;============================================================================
[861f]Sprites_SetCurrentSpriteCanMove: [861f]ae 78 03LDX a:CurrentSpriteIndex; X = Currently active sprite. [8622]bd dc 02LDA a:CurrentSprites_Flags,X; A = Current sprite's flags. [8625]29 02AND #$02 [8627]d0 14BNE @LAB_PRG14__863d [8629]20 43 85JSR Sprites_CanMoveDownByHitbox [862c]85 b7STA Blocks_Result [862e]d0 0dBNE @LAB_PRG14__863d [8630]ae 78 03LDX a:CurrentSpriteIndex [8633]bd dc 02LDA a:CurrentSprites_Flags,X [8636]09 04ORA #$04 [8638]9d dc 02STA a:CurrentSprites_Flags,X [863b]38SEC [863c]60RTS [863d]@LAB_PRG14__863d: [863d]ae 78 03LDX a:CurrentSpriteIndex [8640]bd dc 02LDA a:CurrentSprites_Flags,X [8643]29 fbAND #$fb [8645]9d dc 02STA a:CurrentSprites_Flags,X [8648]18CLC [8649]60RTS
;============================================================================ ; Handle the current sprite falling. ; ; If the sprite can move move it down a block. It will ; always be anchored to the top of the block. ; ; If it falls off the screen, it will be unset. ; ; INPUTS: ; CurrentSpriteIndex: ; The current sprite index. ; ; CurrentSprites_Flags: ; The sprite flags. ; ; CurrentSprites_YPos: ; The sprite Y positions. ; ; OUTPUTS: ; CurrentSprites_YPos: ; The sprite Y positions. ; ; Blocks_Result: ; Clobbered. ; ; CALLS: ; CurrentSprite_CanMoveInDirection ; ; XREFS: ; SpriteBehavior_EnemyUnused39 ; SpriteBehavior_Fall ; SpriteBehavior_NecronAides ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_WalkForward ; SpriteBehavior__a91e ; Sprite_FallIfNeeded ;============================================================================
[864a]CurrentSprite_HandleFall: [864a]ae 78 03LDX a:CurrentSpriteIndex; X = Currently active sprite. [864d]bd dc 02LDA a:CurrentSprites_Flags,X; A = Current sprite's flags. [8650]29 04AND #$04; Can the sprite move? [8652]f0 1dBEQ @_done; If not, prepare to return.
; ; This sprite can move. ;
[8654]b5 c2LDA CurrentSprites_YPos,X; A = Sprite's Y position. [8656]18CLC [8657]69 08ADC #$08; A += 8 [8659]95 c2STA CurrentSprites_YPos,X; Store as the new position. [865b]c9 c0CMP #$c0; Is this at the bottom of the screen? [865d]b0 16BCS @_clearSprite; If so, jump to clear the sprite.
; ; Make the sprite fall, if it can. ;
[865f]a2 03LDX #$03; X = 3 (down direction) [8661]20 10 87JSR CurrentSprite_CanMoveInDirection; Can the sprite move down? [8664]a5 b7LDA Blocks_Result; A = result of that check. [8666]f0 09BEQ @_done; If not, prepare to return.
; ; Move the sprite down. ;
[8668]ae 78 03LDX a:CurrentSpriteIndex; X = Currently active sprite. [866b]b5 c2LDA CurrentSprites_YPos,X; A = Sprite's Y position. [866d]29 f0AND #$f0; Round to a block position (after the above += 8). [866f]95 c2STA CurrentSprites_YPos,X; Store as the new position. [8671]@_done: [8671]ae 78 03LDX a:CurrentSpriteIndex; Restore the current sprite index. [8674]60RTS [8675]@_clearSprite: [8675]a9 ffLDA #$ff [8677]9d cc 02STA a:CurrentSprites_Entities,X [867a]60RTS
;============================================================================ ; TODO: Document BScript_Action_FacePlayerX ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a794] ; LAB_PRG14__974e [$PRG14::974e] ; SpriteBehavior_Borabohra ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_GiantBees ; SpriteBehavior_Ishiisu ; SpriteBehavior_KingGrieve_9f86 ; SpriteBehavior_Lilith ; SpriteBehavior_Magman ; SpriteBehavior_Naga ; SpriteBehavior_Nash ; SpriteBehavior_Ripasheiku ; SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ; SpriteBehavior_ShadowEura ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_Tamazutsu ; SpriteBehavior_Unknown_29_SomeSetup ;============================================================================
[867b]BScript_Action_FacePlayerX: [867b]a5 9eLDA Player_PosX_Block; Load the player's X position.
; ; Check if the player and sprite are in the same X position. ;
[867d]d5 baCMP CurrentSprites_XPos_Full,X; Compare to the sprite's X position. [867f]f0 0fBEQ @_return; If it's the same, return.
; ; Rotate the X position left one and take the right-most bit. ; ; This will effectively generate a flipping bit facing the ; left or right side of the screen, based on player position. ;
[8681]2aROL A; Rotate the X position left. [8682]29 01AND #$01; And take the right-most bit for the facing bit. [8684]85 00STA Temp_00; Store it.
; ; Set the facing bit for the sprite. ;
[8686]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [8689]29 feAND #$fe; Clear the Facing Right bit. [868b]05 00ORA Temp_00; Set Facing Right depending on our rotate above. [868d]9d dc 02STA a:CurrentSprites_Flags,X; Save it back out. [8690]@_return: [8690]60RTS
;============================================================================ ; TODO: Document BScript_Action_FacePlayerY ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a798] ; SpriteBehavior_GiantBees ; SpriteBehavior_Lilith ; SpriteBehavior_Naga ; SpriteBehavior_Unknown_29_SomeSetup ;============================================================================
[8691]BScript_Action_FacePlayerY: [8691]a5 a1LDA Player_PosY
; ; Check if the player and sprite are in the same Y position. ;
[8693]d5 c2CMP CurrentSprites_YPos,X [8695]f0 0fBEQ @_return
; ; Rotate the Y position right one and take the left-most bit. ; ; This will effectively generate a flipping bit moving the Y ; direction up or down, based on player position. ;
[8697]6aROR A [8698]29 80AND #$80 [869a]85 00STA Temp_00
; ; Set the Y directinoal bit for the sprite. ;
[869c]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [869f]29 7fAND #$7f; Clear the Falling bit. [86a1]05 00ORA Temp_00; Set the Falling bit based on the rotate above. [86a3]9d dc 02STA a:CurrentSprites_Flags,X; Save it back out. [86a6]@_return: [86a6]60RTS
;============================================================================ ; TODO: Document Sprites_MoveRight ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_CanMoveInDirection ;============================================================================
[86a7]Sprites_MoveRight: [86a7]be 04 03LDX a:CurrentSprites_HitBoxTypes,Y [86aa]b9 ba 00LDA a:CurrentSprites_XPos_Full,Y [86ad]18CLC [86ae]7d d1 b4ADC a:SPRITE_HITBOX_WIDTHS,X [86b1]85 b5STA Arg_PixelPosX [86b3]90 11BCC Sprites_MoveRight__86c6
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprites_SetBlockIsMovingResult ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__86bd ;============================================================================
[86b5]Sprites_SetBlockIsMovingResult:
; ; Set the block as moving. ;
[86b5]a9 01LDA #$01 [86b7]85 b7STA Blocks_Result [86b9]ae 78 03LDX a:CurrentSpriteIndex [86bc]60RTS
;============================================================================ ; TODO: Document FUN_PRG14__86bd ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_CanMoveInDirection ;============================================================================
[86bd]FUN_PRG14__86bd: [86bd]b9 ba 00LDA a:CurrentSprites_XPos_Full,Y [86c0]c9 f1CMP #$f1 [86c2]b0 f1BCS Sprites_SetBlockIsMovingResult [86c4]85 b5STA Arg_PixelPosX
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprites_MoveRight__86c6 ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprites_MoveRight ;============================================================================
[86c6]Sprites_MoveRight__86c6: [86c6]b9 c2 00LDA a:CurrentSprites_YPos,Y; Load the Y position of the sprite. [86c9]85 b6STA Arg_PixelPosY; Store as the pixel Y position argument. [86cb]20 6c e8JSR Area_ConvertPixelsToBlockPos; Convert to a block position. [86ce]20 7c e8JSR ScreenBuffer_IsBlockImpassable; Check if that block is impassable. [86d1]85 b7STA Blocks_Result; Store the result. [86d3]d0 37BNE @LAB_PRG14__870c [86d5]ac 78 03LDY a:CurrentSpriteIndex [86d8]b9 04 03LDA a:CurrentSprites_HitBoxTypes,Y [86db]a8TAY [86dc]b9 d8 b4LDA a:SPRITE_HITBOX_HEIGHTS,Y [86df]85 b9STA Temp_HitBoxValue [86e1]@_loop: [86e1]a5 b9LDA Temp_HitBoxValue [86e3]38SEC [86e4]e9 10SBC #$10 [86e6]85 b9STA Temp_HitBoxValue [86e8]90 0eBCC @LAB_PRG14__86f8 [86ea]8aTXA [86eb]18CLC [86ec]69 10ADC #$10 [86ee]aaTAX [86ef]20 7c e8JSR ScreenBuffer_IsBlockImpassable [86f2]85 b7STA Blocks_Result [86f4]d0 16BNE @LAB_PRG14__870c [86f6]f0 e9BEQ @_loop [86f8]@LAB_PRG14__86f8: [86f8]ac 78 03LDY a:CurrentSpriteIndex [86fb]b9 c2 00LDA a:CurrentSprites_YPos,Y [86fe]29 0fAND #$0f [8700]f0 0aBEQ @LAB_PRG14__870c [8702]8aTXA [8703]18CLC [8704]69 10ADC #$10 [8706]aaTAX [8707]20 7c e8JSR ScreenBuffer_IsBlockImpassable [870a]85 b7STA Blocks_Result [870c]@LAB_PRG14__870c: [870c]ae 78 03LDX a:CurrentSpriteIndex [870f]60RTS
;============================================================================ ; TODO: Document CurrentSprite_CanMoveInDirection ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_HandleFall ; MoveSpriteHorizIfPossible ; MoveSpriteVerticalIfPossible ;============================================================================
[8710]CurrentSprite_CanMoveInDirection: [8710]ac 78 03LDY a:CurrentSpriteIndex [8713]8aTXA [8714]f0 a7BEQ FUN_PRG14__86bd [8716]caDEX [8717]f0 8eBEQ Sprites_MoveRight [8719]caDEX [871a]f0 15BEQ @LAB_PRG14__8731 [871c]be 04 03LDX a:CurrentSprites_HitBoxTypes,Y [871f]b9 c2 00LDA a:CurrentSprites_YPos,Y [8722]18CLC [8723]7d d8 b4ADC a:SPRITE_HITBOX_HEIGHTS,X [8726]85 b6STA Arg_PixelPosY [8728]c9 f0CMP #$f0 [872a]90 0eBCC @LAB_PRG14__873a [872c]@LAB_PRG14__872c: [872c]a9 01LDA #$01 [872e]85 b7STA Blocks_Result [8730]60RTS [8731]@LAB_PRG14__8731: [8731]b9 c2 00LDA a:CurrentSprites_YPos,Y [8734]c9 f0CMP #$f0 [8736]b0 f4BCS @LAB_PRG14__872c [8738]85 b6STA Arg_PixelPosY [873a]@LAB_PRG14__873a: [873a]b9 ba 00LDA a:CurrentSprites_XPos_Full,Y [873d]85 b5STA Arg_PixelPosX [873f]20 6c e8JSR Area_ConvertPixelsToBlockPos [8742]20 7c e8JSR ScreenBuffer_IsBlockImpassable [8745]85 b7STA Blocks_Result [8747]d0 2fBNE @LAB_PRG14__8778 [8749]ac 78 03LDY a:CurrentSpriteIndex [874c]b9 04 03LDA a:CurrentSprites_HitBoxTypes,Y [874f]a8TAY [8750]b9 d1 b4LDA a:SPRITE_HITBOX_WIDTHS,Y [8753]85 b9STA Temp_HitBoxValue [8755]@LAB_PRG14__8755: [8755]a5 b9LDA Temp_HitBoxValue [8757]38SEC [8758]e9 10SBC #$10 [875a]85 b9STA Temp_HitBoxValue [875c]90 0aBCC @LAB_PRG14__8768 [875e]e8INX [875f]20 7c e8JSR ScreenBuffer_IsBlockImpassable [8762]85 b7STA Blocks_Result [8764]d0 12BNE @LAB_PRG14__8778 [8766]f0 edBEQ @LAB_PRG14__8755 [8768]@LAB_PRG14__8768: [8768]ac 78 03LDY a:CurrentSpriteIndex [876b]b9 ba 00LDA a:CurrentSprites_XPos_Full,Y [876e]29 0fAND #$0f [8770]f0 06BEQ @LAB_PRG14__8778 [8772]e8INX [8773]20 7c e8JSR ScreenBuffer_IsBlockImpassable [8776]85 b7STA Blocks_Result [8778]@LAB_PRG14__8778: [8778]ae 78 03LDX a:CurrentSpriteIndex [877b]60RTS
;============================================================================ ; TODO: Document Player_CheckShieldHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ;============================================================================
[877c]Player_CheckShieldHitByMagic: [877c]ad bf 03LDA a:SelectedShield [877f]c9 03CMP #$03 [8781]b0 47BCS RETURN_87CA [8783]20 27 b9JSR Maybe_Player_CalcAnimFrame [8786]38SEC [8787]e9 04SBC #$04 [8789]c9 03CMP #$03 [878b]90 3dBCC RETURN_87CA [878d]ae 78 03LDX a:CurrentSpriteIndex [8790]bc cc 02LDY a:CurrentSprites_Entities,X [8793]c0 ffCPY #$ff [8795]f0 33BEQ RETURN_87CA [8797]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y [879a]c9 06CMP #$06 [879c]d0 2cBNE RETURN_87CA [879e]ad e4 03LDA a:SpriteBox_Width [87a1]18CLC [87a2]69 07ADC #$07 [87a4]85 00STA Temp_00 [87a6]ad 9b 03LDA a:Player_ShieldPositionX [87a9]18CLC [87aa]69 07ADC #$07 [87ac]38SEC [87ad]ed e2 03SBC a:SpriteBox_Left [87b0]c5 00CMP Temp_00 [87b2]b0 16BCS RETURN_87CA [87b4]ad e5 03LDA a:SpriteBox_Height [87b7]18CLC [87b8]69 0fADC #$0f [87ba]85 00STA Temp_00 [87bc]ad 9c 03LDA a:Player_ShieldPositionY [87bf]18CLC [87c0]69 0fADC #$0f [87c2]38SEC [87c3]ed e3 03SBC a:SpriteBox_Top [87c6]c5 00CMP Temp_00 [87c8]90 01BCC Player_HandleShieldHitByMagic
; ; XREFS: ; Player_CheckShieldHitByMagic ; Player_HitSpriteWithWeapon ;
[87ca]RETURN_87CA: [87ca]60RTS
;============================================================================ ; TODO: Document Player_HandleShieldHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_CheckShieldHitByMagic ;============================================================================
[87cb]Player_HandleShieldHitByMagic: [87cb]20 dc 87JSR Player_HandleHitByMagic [87ce]ae 78 03LDX a:CurrentSpriteIndex [87d1]a9 ffLDA #$ff [87d3]9d cc 02STA a:CurrentSprites_Entities,X [87d6]a9 0cLDA #$0c [87d8]20 e4 d0JSR Sound_PlayEffect [87db]60RTS
;============================================================================ ; TODO: Document Player_HandleHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_HandleShieldHitByMagic ;============================================================================
[87dc]Player_HandleHitByMagic: [87dc]ae 78 03LDX a:CurrentSpriteIndex [87df]bc cc 02LDY a:CurrentSprites_Entities,X [87e2]b9 d7 b6LDA a:SPRITE_ENTITY_DAMAGES,Y [87e5]ac bf 03LDY a:SelectedShield [87e8]@LAB_PRG14__87e8: [87e8]4aLSR A [87e9]88DEY [87ea]10 fcBPL @LAB_PRG14__87e8 [87ec]8d bd 04STA a:Arg_PlayerHealthDelta_U [87ef]a9 00LDA #$00 [87f1]8d bc 04STA a:Arg_PlayerHealthDelta_L [87f4]ad bd 04LDA a:Arg_PlayerHealthDelta_U [87f7]d0 01BNE @LAB_PRG14__87fa [87f9]60RTS [87fa]@LAB_PRG14__87fa: [87fa]20 d5 89JSR Player_SetDamagedBySprite [87fd]4c 8e c0JMP Player_ReduceHP [8800]de 4c 03DEC a:CurrentSprites_HitCounter,X [8803]60RTS
;============================================================================ ; TODO: Document Player_HitSpriteWithWeapon ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8804]Player_HitSpriteWithWeapon: [8804]20 c8 a8JSR Sprites_IsSpriteHidden
; ; Check if the sprite is visible. If so, return. ;
[8807]d0 c1BNE RETURN_87CA [8809]a5 a4LDA Player_Flags [880b]10 bdBPL RETURN_87CA [880d]a4 aeLDY Player_AttackPhaseAnimFrame [880f]88DEY [8810]c0 02CPY #$02 [8812]b0 b6BCS RETURN_87CA
; ; Check if the player has a weapon. If not, return. ;
[8814]ad c8 03LDA a:Player_CurWeapon [8817]30 b1BMI RETURN_87CA [8819]ae 78 03LDX a:CurrentSpriteIndex [881c]bc cc 02LDY a:CurrentSprites_Entities,X
; ; Check if the sprite being hit is an enemy. If not, return. ;
[881f]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y [8822]f0 04BEQ @LAB_PRG14__8828 [8824]c9 07CMP #$07 [8826]d0 a2BNE RETURN_87CA [8828]@LAB_PRG14__8828: [8828]b5 baLDA CurrentSprites_XPos_Full,X [882a]8d 7f 03STA a:Something_Maybe_WeaponDistanceX [882d]b5 c2LDA CurrentSprites_YPos,X [882f]8d 80 03STA a:Something_Maybe_WeaponDistanceY [8832]20 cb 88JSR Sprites_IsSpriteOutOfWeaponRange [8835]90 03BCC @LAB_PRG14__883a
; ; The sprite isn't within range. Return. ;
[8837]4c c6 88JMP @_return [883a]@LAB_PRG14__883a: [883a]bd cc 02LDA a:CurrentSprites_Entities,X [883d]c9 05CMP #$05 [883f]d0 08BNE @LAB_PRG14__8849
; ; TODO: Figure out why Necron Aides get bit 7 set. ;
[8841]bd e4 02LDA a:CurrentSprites_Phases,X [8844]09 80ORA #$80 [8846]9d e4 02STA a:CurrentSprites_Phases,X [8849]@LAB_PRG14__8849: [8849]a9 02LDA #$02
; ; Play the Hit Enemy sound. ;
[884b]20 e4 d0JSR Sound_PlayEffect
; ; Stop the player from walking. ;
[884e]a5 a4LDA Player_Flags [8850]29 dfAND #$df [8852]85 a4STA Player_Flags
; ; Set the flags and hit counter for the sprite. ;
[8854]a0 00LDY #$00 [8856]29 40AND #$40 [8858]f0 01BEQ @LAB_PRG14__885b [885a]c8INY [885b]@LAB_PRG14__885b: [885b]84 00STY Temp_00 [885d]bd dc 02LDA a:CurrentSprites_Flags,X [8860]29 feAND #$fe [8862]05 00ORA Temp_00 [8864]9d dc 02STA a:CurrentSprites_Flags,X [8867]a9 08LDA #$08 [8869]9d 4c 03STA a:CurrentSprites_HitCounter,X [886c]ac c8 03LDY a:Player_CurWeapon
; ; Set the base strength of the equipped weapon. ;
[886f]b9 a5 b7LDA a:WEAPON_STRENGTHS,Y [8872]85 00STA Temp_00 [8874]ad 2c 04LDA a:SpecialItems
; ; If there's no pendant equipped, increase weapon strength by 25%. ; ; This is the famous Pendant Bug. This should have been inversed. Oops. ;
[8877]29 02AND #$02 [8879]d0 09BNE @_checkGlove [887b]a5 00LDA Temp_00 [887d]4aLSR A [887e]4aLSR A [887f]18CLC [8880]65 00ADC Temp_00 [8882]85 00STA Temp_00
; ; If the player has the glove, add the strength of the ; glove based on the weapon strength. ; ; This is: ; ; Hand Dagger: 2HP ; Long Sword: 4HP ; Giant Blade: 8HP ; Dragon Slayer: 10HP ;
[8884]@_checkGlove: [8884]ad 28 04LDA a:DurationGlove; Load the glove duration. [8887]30 08BMI @_updateSpriteHP; If it's no longer active, jump. [8889]a5 00LDA Temp_00; Load the calculated weapon strength. [888b]18CLC [888c]79 c7 88ADC a:WEAPON_TO_GLOVE_STRENGTH,Y; Add the glove strength for the current weapon. [888f]85 00STA Temp_00; Store as the new damage counter.
; ; Calculate the number of HP remaining for the enemy. ; ; We'll take the current HP, remove what we've calculated ; for the weapon strength. ;
[8891]@_updateSpriteHP: [8891]bd 44 03LDA a:CurrentSprites_HP,X; Load the current HP for this enemy. [8894]38SEC [8895]e5 00SBC Temp_00; Subtract the current damage. [8897]9d 44 03STA a:CurrentSprites_HP,X; Store back as the enemy HP.
; ; Check if the sprite is still alive. If so, we're done. ;
[889a]b0 2aBCS @_return; If the enemy is dead, we're done here.
; ; The sprite is dead, so begin handling post-death logic. ; ; Start by checking if this is Sugata. This is handled specially. ; When dead, the screen flashes. ;
[889c]bd cc 02LDA a:CurrentSprites_Entities,X [889f]c9 18CMP #$18; Compare to Sugata. [88a1]d0 06BNE @_handleEnemyGeneric; If not, jump.
; ; When Sugata dies, make sure we restore color. ; ; Sugata will flash the screen, and this prevents the screen ; from getting stuck in greyscale. ;
[88a3]a5 0bLDA PPU_Mask; Load the current screen mode. [88a5]29 feAND #$fe; Clear bit 0, setting to greyscale. [88a7]85 0bSTA PPU_Mask; Store back as the screen mode. [88a9]@_handleEnemyGeneric: [88a9]a9 03LDA #$03; Play sound #3.
; ; Play a sound for the enemy kill, reset state, and add ; experience. ;
[88ab]20 e4 d0JSR Sound_PlayEffect [88ae]a9 00LDA #$00 [88b0]9d 4c 03STA a:CurrentSprites_HitCounter,X; Clear the hit counter for the dead enemy. [88b3]20 87 8bJSR Player_AddExperienceFromSprite; Add experience for the current sprite.
; ; Check if we killed a standard enemy or a boss. ;
[88b6]bc cc 02LDY a:CurrentSprites_Entities,X; Load the type of this enemy. [88b9]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y [88bc]c9 07CMP #$07; Is this a big enemy? [88be]d0 03BNE @LAB_PRG14__88c3; If not, jump.
; ; This was a big enemy (a boss). ;
[88c0]4c ec abJMP Sprite_ShowBigEnemyDeathByMagicOrWeapon; Handle big enemy death cleanup.
; ; This was a standard enemy. ;
[88c3]@LAB_PRG14__88c3: [88c3]4c f1 abJMP Sprite_ShowNormalEnemyDeathByWeapon; Handle standard enemy death cleanup. [88c6]@_return: [88c6]60RTS
;============================================================================ ; A mapping of weapon types to additional hit power. ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
; ; XREFS: ; Player_HitSpriteWithWeapon ;
[88c7]WEAPON_TO_GLOVE_STRENGTH: [88c7]02.byte $02; [0]: Hand Dagger -- 2HP [88c8]04.byte $04; [1]: Long Sword -- 4HP [88c9]08.byte $08; [2]: Giant Blade -- 8HP [88ca]0a.byte $0a; [3]: Dragon Slayer -- 10HP
;============================================================================ ; Check if a sprite is out of the player's weapon range. ; ; Range will be checked in both an X and Y direction. ; ; INPUTS: ; X: ; The index of the sprite to check. ; ; OUTPUTS: ; Temp_00: ; This will be clobbered with the last distance ; calculation. ; ; C: ; 1 if out of range. ; 0 if within range. ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
[88cb]Sprites_IsSpriteOutOfWeaponRange:
; ; First check the distance in the X position between the ; weapon and the sprite. ;
[88cb]bd cc 02LDA a:CurrentSprites_Entities,X [88ce]0aASL A [88cf]a8TAY [88d0]b9 07 b4LDA a:MAYBE_SPRITE_EXTENTS,Y [88d3]18CLC [88d4]65 d2ADC Maybe_WeaponRange_X [88d6]85 00STA Temp_00 [88d8]a5 ceLDA PlayerPosXPlus10 [88da]18CLC
; ; If that wasn't in range... ;
[88db]65 d2ADC Maybe_WeaponRange_X [88dd]38SEC [88de]ed 7f 03SBC a:Something_Maybe_WeaponDistanceX [88e1]c5 00CMP Temp_00 [88e3]b0 15BCS @_return
; ; Check the distance in the Y direction between the ; weapon and the sprite. ;
[88e5]b9 08 b4LDA a:MAYBE_SPRITE_EXTENTS_1_,Y [88e8]18CLC [88e9]65 d3ADC Maybe_WeaponRange_Y [88eb]85 00STA Temp_00 [88ed]a5 d0LDA Maybe_Something_WeaponPosY [88ef]18CLC [88f0]65 d3ADC Maybe_WeaponRange_Y [88f2]38SEC [88f3]ed 80 03SBC a:Something_Maybe_WeaponDistanceY [88f6]c5 00CMP Temp_00 [88f8]b0 00BCS @_return [88fa]@_return: [88fa]60RTS
;============================================================================ ; Handle touching an item. ; ; This will cause the player to pick up the sprite. ; ; INPUTS: ; A: ; The current sprite index. ; ; CurrentSprites_Entities: ; The entities of the sprites on the scren. ; ; OUTPUTS: ; CurrentSprites_Entities: ; The new entities of the sprites, with this ; sprite cleared. ; ; CALLS: ; Player_PickUp ; ; XREFS: ; SPRITE_COLLISION_HANDLERS [$PRG14::8962] ;============================================================================
[88fb]Player_HandleTouchItem: [88fb]bd cc 02LDA a:CurrentSprites_Entities,X; Load the entity at the given index. [88fe]20 64 c7JSR Player_PickUp; Pick up the item. [8901]ae 78 03LDX a:CurrentSpriteIndex; X = current sprite index.
; ; Remove the item from the screen. ;
[8904]a9 ffLDA #$ff; A = 0xFF (unset) [8906]9d cc 02STA a:CurrentSprites_Entities,X; Set the entity at this sprite index as 0xFF.
; ; XREFS: ; CurrentSprite_CheckHitPlayer ;
[8909]RETURN_8909: [8909]60RTS
;============================================================================ ; TODO: Document CurrentSprite_CheckHitPlayer ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ;============================================================================
[890a]CurrentSprite_CheckHitPlayer: [890a]ae 78 03LDX a:CurrentSpriteIndex [890d]bd cc 02LDA a:CurrentSprites_Entities,X [8910]c9 ffCMP #$ff [8912]f0 f5BEQ RETURN_8909 [8914]20 c8 a8JSR Sprites_IsSpriteHidden [8917]d0 7fBNE RETURN_8998 [8919]ad e4 03LDA a:SpriteBox_Width [891c]18CLC [891d]69 0bADC #$0b [891f]85 00STA Temp_00 [8921]a5 9eLDA Player_PosX_Block [8923]18CLC [8924]69 0bADC #$0b [8926]38SEC [8927]ed e2 03SBC a:SpriteBox_Left [892a]c5 00CMP Temp_00 [892c]b0 6aBCS RETURN_8998 [892e]ad e5 03LDA a:SpriteBox_Height [8931]18CLC [8932]69 1bADC #$1b [8934]85 00STA Temp_00 [8936]a5 a1LDA Player_PosY [8938]18CLC [8939]69 1bADC #$1b [893b]38SEC [893c]ed e3 03SBC a:SpriteBox_Top [893f]c5 00CMP Temp_00 [8941]b0 55BCS RETURN_8998 [8943]bc cc 02LDY a:CurrentSprites_Entities,X [8946]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y [8949]0aASL A [894a]a8TAY [894b]c0 10CPY #$10 [894d]b0 08BCS Player_HandleCollision_NoOp [894f]b9 59 89LDA a:SPRITE_COLLISION_HANDLERS+1,Y [8952]48PHA [8953]b9 58 89LDA a:SPRITE_COLLISION_HANDLERS,Y [8956]48PHA
; ; XREFS: ; CurrentSprite_CheckHitPlayer ; SPRITE_COLLISION_HANDLERS [$PRG14::895e] ;
[8957]Player_HandleCollision_NoOp: [8957]60RTS
;============================================================================ ; Handlers for touching entities in the game. ; ; XREFS: ; CurrentSprite_CheckHitPlayer ;============================================================================
; ; XREFS: ; CurrentSprite_CheckHitPlayer ;
[8958]SPRITE_COLLISION_HANDLERS: [8958]ad 89pointer Player_HandleTouchEnemy-1; [0]: [895a]67 89pointer Player_HandleTouchBreadOrCoin-1; [1]: Coin/meat touched [895c]7e 89pointer Player_CheckHandlePressUpOnNPC-1; [2]: Press Up on NPC [895e]56 89pointer Player_HandleCollision_NoOp-1; [3]: Large animation. Just return. [8960]ee 89pointer Player_HandleTouchNPC-1; [4]: Collide with NPC [8962]fa 88pointer Player_HandleTouchItem-1; [5]: Item touched [8964]98 89pointer Player_HandleTouchEnemyMagic-1; [6]: Enemy magic touched [8966]ad 89pointer Player_HandleTouchEnemy-1; [7]: Enemy touched
;============================================================================ ; Handle touching bread or money. ; ; If touching either of these, the sprite will be removed ; and the handler will be invoked to add HP or gold. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Entities: ; The current sprite entities on the screen. ; ; OUTPUTS: ; None ; ; CALLS: ; Player_HandleTouchCoin ; Player_HandleTouchBread ; ; XREFS: ; SPRITE_COLLISION_HANDLERS [$PRG14::895a] ;============================================================================
[8968]Player_HandleTouchBreadOrCoin:
; ; Check if this is a gold coin or bread. ;
[8968]bd cc 02LDA a:CurrentSprites_Entities,X; Load the entity for this sprite. [896b]c9 01CMP #$01; Is it bread? [896d]f0 08BEQ @_isBread; If so, jump.
; ; This is a gold coin. ;
[896f]a9 ffLDA #$ff [8971]9d cc 02STA a:CurrentSprites_Entities,X; Clear the sprite. [8974]4c 9a 8bJMP Player_HandleTouchCoin; Handle touching the gold coin.
; ; This is bread. ;
[8977]@_isBread: [8977]a9 ffLDA #$ff [8979]9d cc 02STA a:CurrentSprites_Entities,X; Clear the sprite. [897c]4c c0 8bJMP Player_HandleTouchBread; Handle touching the bread.
;============================================================================ ; Handle pressing Up next to an NPC. ; ; This will invoke an IScript for the NPC if the player ; pressed Up. ; ; INPUTS: ; X: ; The index of the sprite. ; ; Joy1_ChangedButtonMask: ; The newly-changed button mask. ; ; CurrentSprites_Values: ; The values of the current sprites on screen. ; ; OUTPUTS: ; CurrentSprite_Value: ; The value of the sprite. ; ; CALLS: ; MMC1_LoadBankAndJump ; ; XREFS: ; SPRITE_COLLISION_HANDLERS [$PRG14::895c] ;============================================================================
[897f]Player_CheckHandlePressUpOnNPC:
; ; Check if Up is pressed. ;
[897f]a5 19LDA Joy1_ChangedButtonMask; Load the changed button mask. [8981]c9 08CMP #$08; Is Up pressed? [8983]d0 13BNE RETURN_8998; If not, return.
; ; Up was pressed. Get the value for this sprite. This will ; be used to invoke the sprite's associated IScript. ;
[8985]bd 6c 03LDA a:CurrentSprites_Values,X; Load the value for the sprite. [8988]8d 8c 03STA a:CurrentSprite_Value; Store it as the current value. [898b]c9 ffCMP #$ff; Is it 0xFF? [898d]f0 09BEQ RETURN_8998; If so, return. [898f]20 59 f8JSR MMC1_LoadBankAndJump; Execute the handler. [8992]0c.byte BANK_12_LOGIC; Bank = 12 [8993]41 82pointer IScripts_Begin-1; Address = IScripts_Begin [8995]@_afterFarJump: [8995]ae 78 03LDX a:CurrentSpriteIndex; X = current sprite index
; ; XREFS: ; CurrentSprite_CheckHitPlayer ; Player_CheckHandlePressUpOnNPC ; Player_HandleTouchNPC ;
[8998]RETURN_8998: [8998]60RTS
;============================================================================ ; Handle touching an enemy's magic. ; ; If the player is not invincible via iframes or Ointment, ; this will trigger the same damage process as if the ; player touched the enemy directly. ; ; INPUTS: ; X: ; The index of the sprite. ; ; Player_InvincibilityPhase: ; The current invincibility phase of the player. ; ; DurationOintment: ; The remaining duration of any ointment. ; ; OUTPUTS: ; CurrentSprites_Entities: ; The new entities map with this sprite unset. ; ; CALLS: ; Player_HandleTouchEnemy ; ; XREFS: ; SPRITE_COLLISION_HANDLERS [$PRG14::8964] ;============================================================================
[8999]Player_HandleTouchEnemyMagic: [8999]a5 adLDA Player_InvincibilityPhase [899b]d0 10BNE RETURN_89AD [899d]ad 27 04LDA a:DurationOintment [89a0]10 0bBPL RETURN_89AD [89a2]20 ae 89JSR Player_HandleTouchEnemy [89a5]ae 78 03LDX a:CurrentSpriteIndex [89a8]a9 ffLDA #$ff [89aa]9d cc 02STA a:CurrentSprites_Entities,X
; ; XREFS: ; Player_HandleTouchEnemy ; Player_HandleTouchEnemyMagic ;
[89ad]RETURN_89AD: [89ad]60RTS
;============================================================================ ; Handle touching an enemy. ; ; If the player is not currently invincible (via iframes or ; Ointment), this will cause the player to take damage. ; ; INPUTS: ; X: ; The index of the sprite. ; ; Player_InvincibilityPhase: ; The current invincibility phase of the player. ; ; DurationOintment: ; The remaining duration of any ointment. ; ; CurrentSprites_Entities: ; The entities of sprites on the screen. ; ; CurrentSprites_Phases: ; The state phases of the sprites on the screen. ; ; OUTPUTS: ; CurrentSprites_Phases: ; Resulting phase of sprites on the screen. ; ; CALLS: ; Sound_PlayEffect ; Player_SetDamagedBySprite ; Player_ApplyDamage ; ; XREFS: ; Player_HandleTouchEnemyMagic ; SPRITE_COLLISION_HANDLERS [$PRG14::8958] ; SPRITE_COLLISION_HANDLERS [$PRG14::8966] ;============================================================================
[89ae]Player_HandleTouchEnemy:
; ; Check if the player currently has iframes. ;
[89ae]a5 adLDA Player_InvincibilityPhase; Load the invincibility phase. [89b0]f0 01BEQ @_canTakeDamage; If no iframes are available, begin processing the hit. [89b2]60RTS; Else, return.
; ; Check if the player has Ointment active. ;
[89b3]@_canTakeDamage: [89b3]ad 27 04LDA a:DurationOintment; Check the ointment duration. [89b6]10 f5BPL RETURN_89AD; If there's time left, no damage will be taken. Return.
; ; Process special enemy handling. ;
[89b8]bd cc 02LDA a:CurrentSprites_Entities,X; Load the sprite entity that hit the player. [89bb]c9 05CMP #$05; Is it the Necron Aides? [89bd]d0 08BNE @_handleDamage; If not, perform standard damage handling.
; ; This is the Necron Aides enemy. ;
[89bf]bd e4 02LDA a:CurrentSprites_Phases,X; Load the phase of the enemy. [89c2]09 80ORA #$80; Set the 7th bit. [89c4]9d e4 02STA a:CurrentSprites_Phases,X; Store it.
; ; Play the sound effect and process damage. ;
[89c7]@_handleDamage: [89c7]a9 04LDA #$04 [89c9]20 e4 d0JSR Sound_PlayEffect; Play the Player Hit sound. [89cc]20 d5 89JSR Player_SetDamagedBySprite; Mark the player as damaged and set state. [89cf]4c 79 8aJMP Player_ApplyDamage; Apply damage. [89d2]60.byte $60; byte
; ; XREFS: ; Player_SetDamagedBySprite ;
[89d3]SPRITES_FACING_VALUE_TO_OPPOSITE_PLAYER_FACING_BITMASK: [89d3]40.byte $40; [0]: [89d4]00.byte $00; [1]:
;============================================================================ ; Set the player as damaged by another sprite. ; ; This will set the invincibility phase, giving the ; player iframes. ; ; It will also change the player direction to face ; the enemy, and apply knockback. ; ; INPUTS: ; Player_Flags: ; The player's current flags. ; ; Player_StatusFlag: ; The player's status flag. ; ; OUTPUTS: ; Player_InvincibilityPhase: ; The player's new invincibility phase (60). ; ; Player_Flags: ; The new player flags, with the facing direction ; changed. ; ; Player_StatusFlag: ; The new status flag, with knockback applied. ; ; XREFS: ; Player_HandleHitByMagic ; Player_HandleTouchEnemy ;============================================================================
[89d5]Player_SetDamagedBySprite:
; ; Set the invincibility phase to 60. ;
[89d5]a9 3cLDA #$3c [89d7]85 adSTA Player_InvincibilityPhase; Set iframes to 60.
; ; Set the player's facing direction to face the enemy. ;
[89d9]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's current flags. [89dc]29 01AND #$01; Grab the direction bit. [89de]a8TAY; Set to Y. [89df]a5 a4LDA Player_Flags; Load the player's flags. [89e1]29 bfAND #$bf; Unset the Facing Right bit. [89e3]19 d3 89ORA a:SPRITES_FACING_VALUE_TO_OPPOSITE_PLAYER_FACING_BITMASK,Y; Set facing to the opposite of the sprite's. [89e6]85 a4STA Player_Flags; Store it.
; ; Set knockback on the player. ;
[89e8]a5 a5LDA Player_StatusFlag; Load the player's status flag. [89ea]09 02ORA #$02; Set knockback. [89ec]85 a5STA Player_StatusFlag; Store it. [89ee]60RTS
;============================================================================ ; Handle the player touching an NPC. ; ; This will invoke an IScript action when colliding ; with the NPC. It's used for the initial screen when ; approaching the walls of Eolis. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Values: ; The values of the current sprites on screen. ; ; OUTPUTS: ; CurrentSprite_Value: ; The value of this sprite. ; ; CurrentSprites_Entities: ; The entities of the current sprites on screen. ; ; CALLS: ; MMC1_LoadBankAndJump ; ; XREFS: ; SPRITE_COLLISION_HANDLERS [$PRG14::8960] ;============================================================================
[89ef]Player_HandleTouchNPC: [89ef]bd 6c 03LDA a:CurrentSprites_Values,X; Load the value for this sprite. [89f2]8d 8c 03STA a:CurrentSprite_Value; Store as the current sprite's value. [89f5]c9 ffCMP #$ff; Is it 0xFF (unset)? [89f7]f0 9fBEQ RETURN_8998; If so, return. [89f9]20 59 f8JSR MMC1_LoadBankAndJump; Else, execute the IScript at that value. [89fc]0c.byte BANK_12_LOGIC; Bank = 12 [89fd]41 82pointer IScripts_Begin-1; Address = IScripts_Begin
; ; Clear this sprite. ;
[89ff]@_afterFarJump: [89ff]ae 78 03LDX a:CurrentSpriteIndex; X = current sprite index. [8a02]a9 ffLDA #$ff; A = 0xFF [8a04]9d cc 02STA a:CurrentSprites_Entities,X; Set the entity at that index to 0xFF. [8a07]60RTS
;============================================================================ ; TODO: Document Sprite_GetBounds ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8a08]Sprite_GetBounds: [8a08]a9 00LDA #$00 [8a0a]85 03STA Temp_Addr_U [8a0c]bd cc 02LDA a:CurrentSprites_Entities,X [8a0f]0aASL A [8a10]26 03ROL Temp_Addr_U [8a12]0aASL A [8a13]26 03ROL Temp_Addr_U [8a15]69 73ADC #$73 [8a17]85 02STA Temp_Addr_L [8a19]a5 03LDA Temp_Addr_U [8a1b]69 b2ADC #$b2 [8a1d]85 03STA Temp_Addr_U [8a1f]bd cc 02LDA a:CurrentSprites_Entities,X [8a22]c9 1fCMP #$1f [8a24]f0 08BEQ @LAB_PRG14__8a2e [8a26]c9 20CMP #$20 [8a28]f0 16BEQ @LAB_PRG14__8a40 [8a2a]c9 21CMP #$21 [8a2c]d0 23BNE Sprite_SetBoundsFromTemp [8a2e]@LAB_PRG14__8a2e: [8a2e]bd e4 02LDA a:CurrentSprites_Phases,X [8a31]c9 02CMP #$02 [8a33]d0 1cBNE Sprite_SetBoundsFromTemp [8a35]a9 71LDA #<SPRITE_GETBOUNDS_COMMON [8a37]85 02STA Temp_Addr_L [8a39]a9 8aLDA #>SPRITE_GETBOUNDS_COMMON [8a3b]85 03STA Temp_Addr_U [8a3d]4c 51 8aJMP Sprite_SetBoundsFromTemp [8a40]@LAB_PRG14__8a40: [8a40]bd e4 02LDA a:CurrentSprites_Phases,X [8a43]f0 04BEQ @LAB_PRG14__8a49 [8a45]c9 04CMP #$04 [8a47]d0 08BNE Sprite_SetBoundsFromTemp [8a49]@LAB_PRG14__8a49: [8a49]a9 75LDA #<SPRITE_GETBOUNDS_MASKMAN [8a4b]85 02STA Temp_Addr_L [8a4d]a9 8aLDA #>SPRITE_GETBOUNDS_MASKMAN [8a4f]85 03STA Temp_Addr_U
; ; XREFS: ; Sprite_GetBounds ;
[8a51]Sprite_SetBoundsFromTemp: [8a51]a0 00LDY #$00 [8a53]b5 baLDA CurrentSprites_XPos_Full,X [8a55]18CLC [8a56]71 02ADC (Temp_Addr_L),Y [8a58]8d e2 03STA a:SpriteBox_Left [8a5b]b5 c2LDA CurrentSprites_YPos,X [8a5d]18CLC [8a5e]c8INY [8a5f]71 02ADC (Temp_Addr_L),Y [8a61]8d e3 03STA a:SpriteBox_Top [8a64]c8INY [8a65]b1 02LDA (Temp_Addr_L),Y [8a67]8d e4 03STA a:SpriteBox_Width [8a6a]c8INY [8a6b]b1 02LDA (Temp_Addr_L),Y [8a6d]8d e5 03STA a:SpriteBox_Height [8a70]60RTS [8a71]SPRITE_GETBOUNDS_COMMON: [8a71]30.byte $30; [0]: [8a72]08.byte $08; [1]: [8a73]f0.byte $f0; [2]: [8a74]00.byte $00; [3]: [8a75]SPRITE_GETBOUNDS_MASKMAN: [8a75]20.byte $20; [0]: [8a76]10.byte $10; [1]: [8a77]f8.byte $f8; [2]: [8a78]00.byte $00; [3]:
;============================================================================ ; TODO: Document Player_ApplyDamage ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_HandleTouchEnemy ;============================================================================
[8a79]Player_ApplyDamage: [8a79]bc cc 02LDY a:CurrentSprites_Entities,X [8a7c]b9 d7 b6LDA a:SPRITE_ENTITY_DAMAGES,Y [8a7f]85 03STA Temp_Addr_U [8a81]85 05STA Temp_05 [8a83]a9 00LDA #$00 [8a85]85 02STA Temp_Addr_L [8a87]85 04STA Temp_04 [8a89]46 05LSR Temp_05 [8a8b]66 04ROR Temp_04 [8a8d]46 05LSR Temp_05 [8a8f]66 04ROR Temp_04 [8a91]46 05LSR Temp_05 [8a93]66 04ROR Temp_04
; ; If the player is wearing any armor, apply damage reduction. ;
[8a95]ac be 03LDY a:SelectedArmor; Load the current armor. [8a98]f0 18BEQ @_applyDamage; If it's 0 (leather), then jump. [8a9a]c0 04CPY #$04; Is it > 4 (Battle Suit)? [8a9c]b0 14BCS @_applyDamage; Then jump.
; ; Apply the armor's defense multiplier. ;
[8a9e]b9 d8 8aLDA a:ARMOR_DEFENSE_MULTIPLIERS,Y; Load the multiplier for this armor. [8aa1]a8TAY; Y = A [8aa2]@LAB_PRG14__8aa2: [8aa2]a5 02LDA Temp_Addr_L [8aa4]38SEC [8aa5]e5 04SBC Temp_04 [8aa7]85 02STA Temp_Addr_L [8aa9]a5 03LDA Temp_Addr_U [8aab]e5 05SBC Temp_05 [8aad]85 03STA Temp_Addr_U [8aaf]88DEY [8ab0]d0 f0BNE @LAB_PRG14__8aa2 [8ab2]@_applyDamage: [8ab2]a5 02LDA Temp_Addr_L [8ab4]8d bc 04STA a:Arg_PlayerHealthDelta_L [8ab7]a5 03LDA Temp_Addr_U [8ab9]8d bd 04STA a:Arg_PlayerHealthDelta_U [8abc]ad 2c 04LDA a:SpecialItems [8abf]29 01AND #$01 [8ac1]f0 11BEQ @LAB_PRG14__8ad4 [8ac3]ad bc 04LDA a:Arg_PlayerHealthDelta_L [8ac6]38SEC [8ac7]e5 04SBC Temp_04 [8ac9]8d bc 04STA a:Arg_PlayerHealthDelta_L [8acc]ad bd 04LDA a:Arg_PlayerHealthDelta_U [8acf]e5 05SBC Temp_05 [8ad1]8d bd 04STA a:Arg_PlayerHealthDelta_U [8ad4]@LAB_PRG14__8ad4: [8ad4]4c 8e c0JMP Player_ReduceHP
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8ad7]RETURN_8AD7: [8ad7]60RTS
;============================================================================ ; Defense multipliers for each armor. ; ; XREFS: ; Player_ApplyDamage ;============================================================================
; ; XREFS: ; Player_ApplyDamage ;
[8ad8]ARMOR_DEFENSE_MULTIPLIERS: [8ad8]00.byte $00; [0]: Leather (0) [8ad9]01.byte $01; [1]: Studded Mail (1) [8ada]02.byte $02; [2]: Full Plate (2) [8adb]04.byte $04; [3]: Battle Suit (4)
;============================================================================ ; Check if the current sprite has been hit by player magic. ; ; If the player has cast magic, its hitbox will be matched ; against the sprite's. ; ; If there's overlap, the player's hit information will be ; updated. ; ; If the sprite dies, the player's state will be updated. ; ; INPUTS: ; CastMagic_Type: ; The currently-cast magic type. ; ; CastMagic_XPos_Full: ; The X position of the cast magic. ; ; CastMagic_YPos_Full: ; The Y position of the cast magic. ; ; CastMagic_Flags: ; The flags for the current magic type. ; ; CurrentSpriteIndex: ; The index of the currently-processed sprite. ; ; CurrentSprites_Entities: ; The entity types for the current sprites. ; ; SPRITE_CATEGORIES_BY_ENTITY: ; The category types for the sprite entity types. ; ; CurrentSprites_Flags: ; The flags for the current sprites. ; ; CAST_MAGIC_HIT_BEHAVIORS: ; The magic behavior functions for the magic types. ; ; CurrentSprites_HitBoxTypes: ; The hitbox types for the current sprites. ; ; CAST_MAGIC_HIT_WIDTHS: ; The hitbox widths for the cast magic types. ; ; CAST_MAGIC_HIT_HEIGHTS: ; The hitbox heights for the cast magic types. ; ; SPRITE_HITBOX_WIDTHS: ; The widths for the hitbox types. ; ; SPRITE_HITBOX_HEIGHTS: ; The heights for the hitbox types. ; ; OUTPUTS: ; CurrentSprites_HitByMagicBehavior: ; The magic hit behavior for the sprite, if hit. ; ; CurrentSprites_Flags: ; The updated flags for the sprite, if hit. ; ; CurrentSprites_HitByMagicIFrames: ; The new hit duration for the sprite, if hit. ; ; Temp_00: ; Temp_01: ; Clobbered. ; ; CALLS: ; Player_HitEnemyWithMagic ;============================================================================
[8adc]Sprite_CheckHitByCastMagic:
; ; Check if there's a valid cast magic type on screen. ;
[8adc]ad b3 02LDA a:CastMagic_Type; Load the cast magic type. [8adf]c9 05CMP #$05; Check against the supported magic types. [8ae1]b0 f4BCS RETURN_8AD7; If not, then return.
; ; Check if the currently-processed sprite is visible on screen. ;
[8ae3]ae 78 03LDX a:CurrentSpriteIndex; Get the current sprite. [8ae6]20 c8 a8JSR Sprites_IsSpriteHidden; Check if the sprite is visible. [8ae9]d0 ecBNE RETURN_8AD7; If not, return.
; ; Check the sprite type. ;
[8aeb]bd cc 02LDA a:CurrentSprites_Entities,X; Get the type of this sprite. [8aee]c9 ffCMP #$ff; Is it unset? [8af0]f0 e5BEQ RETURN_8AD7; If so, return.
; ; Check if this is either a standard or big enemy. ;
[8af2]a8TAY; Y = A (sprite type) [8af3]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y; A = Category type of this sprite [8af6]f0 04BEQ @_isEnemy; If it's a standard enemy, jump. [8af8]c9 07CMP #$07; Check if it's a big enemy. [8afa]d0 76BNE CastMagic_HitHandler_NoOp
; ; Check if the magic overlaps the sprite in the X direction. ;
[8afc]@_isEnemy: [8afc]ac b3 02LDY a:CastMagic_Type; Load the cast magic type. [8aff]b9 73 8bLDA a:CAST_MAGIC_HIT_WIDTHS,Y; Load the htbox width for the magic. [8b02]85 01STA Temp_01; Store that. [8b04]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X; Load the hitbox type for the sprite. [8b07]b9 d1 b4LDA a:SPRITE_HITBOX_WIDTHS,Y; Get the width of the sprite. [8b0a]18CLC [8b0b]65 01ADC Temp_01; Add the hitbox width for this. [8b0d]85 00STA Temp_00; Store that. [8b0f]ad b6 02LDA a:CastMagic_XPos_Full; Load the cast magic X position. [8b12]18CLC [8b13]65 01ADC Temp_01; Add the hitbox width. [8b15]38SEC [8b16]f5 baSBC CurrentSprites_XPos_Full,X; Subtract the sprite X position. [8b18]c5 00CMP Temp_00; Compare to the magic hitbox. [8b1a]b0 56BCS CastMagic_HitHandler_NoOp; If it didn't overlap in the X position, return.
; ; Check if the magic overlaps the sprite in the Y direction. ;
[8b1c]ac b3 02LDY a:CastMagic_Type; Load the cast magic type. [8b1f]b9 78 8bLDA a:CAST_MAGIC_HIT_HEIGHTS,Y; Load the hitbox height of the magic. [8b22]85 01STA Temp_01; Store that. [8b24]bc 04 03LDY a:CurrentSprites_HitBoxTypes,X; Load the hitbox type for the sprite. [8b27]b9 d8 b4LDA a:SPRITE_HITBOX_HEIGHTS,Y; Get the height of the sprite. [8b2a]18CLC [8b2b]65 01ADC Temp_01; Add the hitbox height for this. [8b2d]85 00STA Temp_00; Store that. [8b2f]ad b8 02LDA a:CastMagic_YPos_Full; Load the cast magic Y position. [8b32]18CLC [8b33]65 01ADC Temp_01; Add the hitbox height. [8b35]38SEC [8b36]f5 c2SBC CurrentSprites_YPos,X; Subtract the sprite Y position. [8b38]c5 00CMP Temp_00; Compare to the magic hitbox. [8b3a]b0 36BCS CastMagic_HitHandler_NoOp; If it didn't overlap in the Y position, return.
; ; The magic hit the sprite. Update state on the sprite. ;
[8b3c]ac b3 02LDY a:CastMagic_Type; Load the cast magic type. [8b3f]b9 7d 8bLDA a:CAST_MAGIC_HIT_BEHAVIORS,Y; Load the hit behavior for the magic. [8b42]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X; Store as the hit behavior for the sprite. [8b45]b9 82 8bLDA a:CAST_MAGIC_HIT_IFRAMES,Y; Load the hit behavior timeframe for the magic. [8b48]9d 3c 03STA a:CurrentSprites_HitByMagicIFrames,X; Store for the sprite.
; ; Update the sprite to face the direction the magic is facing. ;
[8b4b]ad b4 02LDA a:CastMagic_Flags; Load the cast magic flags. [8b4e]2aROL A; Get the facing direction of the magic. [8b4f]2aROL A [8b50]2aROL A [8b51]29 01AND #$01 [8b53]85 00STA Temp_00; Store that. [8b55]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [8b58]29 feAND #$fe; Clear the facing direction bit. [8b5a]05 00ORA Temp_00; Set it to match the magic's direction. [8b5c]9d dc 02STA a:CurrentSprites_Flags,X; Store it back out.
; ; Give the player credit for hitting the enemy with magic. ;
[8b5f]ac b3 02LDY a:CastMagic_Type; Y = Cast magic type. [8b62]20 a7 81JSR Player_HitEnemyWithMagic; Update player state.
; ; Load the magic hit sprite handler for this magic type. ;
[8b65]ad b3 02LDA a:CastMagic_Type; A = Cast magic type. [8b68]0aASL A; Update to a word boundary for the lookup table. [8b69]a8TAY; Y = A [8b6a]b9 10 bbLDA a:CAST_MAGIC_HIT_HANDLERS+1,Y; Load the next address from the lookup table. [8b6d]48PHA [8b6e]b9 0f bbLDA a:CAST_MAGIC_HIT_HANDLERS,Y [8b71]48PHA
;============================================================================ ; TODO: Document CastMagic_HitHandler_NoOp ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb19] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb1b] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb1d] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb1f] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb21] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb23] ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb25] ; Sprite_CheckHitByCastMagic ;============================================================================
[8b72]CastMagic_HitHandler_NoOp: [8b72]60RTS
;============================================================================ ; Hitbox widths for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b73]CAST_MAGIC_HIT_WIDTHS: [8b73]0b.byte $0b; [0]: Deluge (11) [8b74]0b.byte $0b; [1]: Thunder (11) [8b75]1b.byte $1b; [2]: Fire (27) [8b76]0b.byte $0b; [3]: Death (11) [8b77]0b.byte $0b; [4]: Tilte (11)
;============================================================================ ; Hitbox widths for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b78]CAST_MAGIC_HIT_HEIGHTS: [8b78]0b.byte $0b; [0]: Deluge (11) [8b79]1b.byte $1b; [1]: Thunder (27) [8b7a]0b.byte $0b; [2]: Fire (11) [8b7b]0b.byte $0b; [3]: Death (11) [8b7c]0b.byte $0b; [4]: Tilte (11)
;============================================================================ ; Magic behaviors for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b7d]CAST_MAGIC_HIT_BEHAVIORS: [8b7d]00.byte $00; [0]: Deluge (0) [8b7e]01.byte $01; [1]: Thunder (1) [8b7f]02.byte $02; [2]: Fire (2) [8b80]ff.byte $ff; [3]: Death (none) [8b81]ff.byte $ff; [4]: Tilte (none)
;============================================================================ ; Hit iframe time for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b82]CAST_MAGIC_HIT_IFRAMES: [8b82]04.byte $04; [0]: Deluge (4) [8b83]08.byte $08; [1]: Thunder (8) [8b84]ff.byte $ff; [2]: Fire (none) [8b85]ff.byte $ff; [3]: Death (none) [8b86]ff.byte $ff; [4]: Tilte (none)
;============================================================================ ; Add player experience based on the current sprite. ; ; This will calculate the 24-bit enemy experience for a ; sprite and add it to the player's experience. ; ; INPUTS: ; X: ; The index of the sprite whose experience will be ; added. ; ; OUTPUTS: ; X: ; The current sprite index. ; ; Temp_Int24: ; Temp_Int24+1: ; Clobbered. ; ; XREFS: ; Player_HitEnemyWithMagic ; Player_HitSpriteWithWeapon ;============================================================================
[8b87]Player_AddExperienceFromSprite: [8b87]bc cc 02LDY a:CurrentSprites_Entities,X; Load the current enemy sprite type. [8b8a]b9 0e b6LDA a:ENEMY_EXPERIENCE,Y; Load the experience for that type. [8b8d]85 ecSTA Temp_Int24; Store as the lower byte of the experience. [8b8f]a9 00LDA #$00 [8b91]85 edSTA Temp_Int24_M; Store 0 as the middle byte. [8b93]20 57 f9JSR Player_UpdateExperience; Update the player's experience. [8b96]ae 78 03LDX a:CurrentSpriteIndex [8b99]60RTS
;============================================================================ ; Handle touching a gold coin. ; ; This will play the sound when picking up a coin, ; update the 24-bit gold amount, and then render to the ; screen. ; ; INPUTS: ; A: ; The index of the coin sprite. ; ; OUTPUTS: ; X: ; The current sprite index. ; ; Gold_M: ; The new middle byte for the gold. ; ; Gold: ; The new lower byte for the gold. ; ; CALLS: ; Sound_PlayEffect ; UI_DrawGoldValue ; ; XREFS: ; Player_HandleTouchBreadOrCoin ;============================================================================
[8b9a]Player_HandleTouchCoin: [8b9a]a9 09LDA #$09 [8b9c]20 e4 d0JSR Sound_PlayEffect; Play sound 9 (coin touched).
; ; Update the lower byte of the gold. ;
[8b9f]ad 92 03LDA a:Gold; Load the lower byte of the gold. [8ba2]18CLC [8ba3]7d 6c 03ADC a:CurrentSprites_Values,X; Add the value of the coin; Set Carry = overflow. [8ba6]8d 92 03STA a:Gold; Store as the lower byte.
; ; Update the middle byte of the gold. ;
[8ba9]ad 93 03LDA a:Gold_M; Load the middle byte for the gold. [8bac]69 00ADC #$00; Add with carry, set the carry bit if overflow. [8bae]8d 93 03STA a:Gold_M; Store as the middle byte.
; ; Update the upper byte of the gold. ;
[8bb1]ad 94 03LDA a:Gold_U; Load the upper byte for the gold. [8bb4]69 00ADC #$00; Add with carry, set carry bit if overflow. [8bb6]8d 94 03STA a:Gold_U; Store as the upper byte.
; ; Render and prepare to return. ;
[8bb9]20 e7 f9JSR UI_DrawGoldValue; Render the new gold amount. [8bbc]ae 78 03LDX a:CurrentSpriteIndex; Set X = current sprite index. [8bbf]60RTS
;============================================================================ ; Handle touching bread. ; ; This will play the sound when picking up bread and ; update the player's health. ; ; INPUTS: ; @{symbol CurrentSpriteValues}: ; The values of the current sprites on the screen. ; ; OUTPUTS: ; None. ; ; CALLS: ; Sound_PlayEffect ; Player_AddHP ; ; XREFS: ; Player_HandleTouchBreadOrCoin ;============================================================================
[8bc0]Player_HandleTouchBread: [8bc0]a9 1bLDA #$1b [8bc2]20 e4 d0JSR Sound_PlayEffect; Play sound 0x1B (pick up meat). [8bc5]ae 78 03LDX a:CurrentSpriteIndex; Load the current sprite index for meat. [8bc8]bd 6c 03LDA a:CurrentSprites_Values,X; Load the HP value for it. [8bcb]20 7b c0JSR Player_AddHP; Add it to the player's HP. [8bce]ae 78 03LDX a:CurrentSpriteIndex [8bd1]60RTS
;============================================================================ ; TODO: Document CurrentSprite_UpdateState ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprites_UpdateAllStates ; _updateSpriteState [$PRG14::8040] ;============================================================================
[8bd2]CurrentSprite_UpdateState: [8bd2]ad c7 03LDA a:IScript_PortraitID [8bd5]10 40BPL @_return
; ; Check if this sprite is set. ;
[8bd7]ae 78 03LDX a:CurrentSpriteIndex; X = Current sprite index [8bda]bc cc 02LDY a:CurrentSprites_Entities,X; Y = Current sprite entity [8bdd]30 38BMI @_return; If unset, return.
; ; Check if this sprite is specifically Tamazutsu. It hides and ; won't be affected when hidden. ;
[8bdf]c0 2cCPY #$2c; Check the sprite against Tamazutsu. [8be1]f0 05BEQ @_notTamazutsu; If not, handle the enemy normally.
; ; This is Tamazutsu. Check if it's visible or hiding. ;
[8be3]20 c8 a8JSR Sprites_IsSpriteHidden [8be6]d0 2fBNE @_return
; ; Check the sprites hit counter. We'll do further updating ; for 2 frames, then stop for 2 frames, and rinse and repeat. ;
[8be8]@_notTamazutsu: [8be8]bd 4c 03LDA a:CurrentSprites_HitCounter,X [8beb]29 02AND #$02 [8bed]d0 28BNE @_return
; ; Update sprite state. ;
[8bef]b5 baLDA CurrentSprites_XPos_Full,X [8bf1]85 27STA Arg_DrawSprite_PosX [8bf3]b5 c2LDA CurrentSprites_YPos,X [8bf5]85 28STA Arg_DrawSprite_PosY [8bf7]a5 9fLDA Screen_Maybe_ScrollXCounter [8bf9]85 2bSTA Unused_Sprite_ScrollPosX [8bfb]a5 a2LDA Player_Something_ScrollPosY [8bfd]85 2aSTA Unused_Sprite_ScrollPosY [8bff]bd 2c 03LDA a:CurrentSprites_PPUOffsets,X [8c02]85 33STA Sprites_PPUOffset [8c04]20 1a 8cJSR CurrentSprite_CalculateVisibility [8c07]ae 78 03LDX a:CurrentSpriteIndex [8c0a]bd cc 02LDA a:CurrentSprites_Entities,X [8c0d]0aASL A [8c0e]a8TAY [8c0f]b9 88 80LDA a:SPRITE_UPDATE_HANDLERS+1,Y [8c12]48PHA [8c13]b9 87 80LDA a:SPRITE_UPDATE_HANDLERS,Y [8c16]48PHA [8c17]@_return: [8c17]60RTS
;============================================================================ ; A mapping between a sprite's facing bit to a flipmask. ; ; Sprites store a facing bit in bit 0. ; ; Flipmasks store a flip bit in bit 7. ; ; XREFS: ; CurrentSprite_UpdateFlipMask ;============================================================================
; ; XREFS: ; CurrentSprite_UpdateFlipMask ;
[8c18]SPRITES_FACING_TO_FLIPMASK: [8c18]00.byte $00; [0]: [8c19]40.byte $40; [1]:
;============================================================================ ; TODO: Document CurrentSprite_CalculateVisibility ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_UpdateState ;============================================================================
[8c1a]CurrentSprite_CalculateVisibility: [8c1a]ae 78 03LDX a:CurrentSpriteIndex [8c1d]a9 00LDA #$00 [8c1f]85 b8STA Temp_MovingSpriteVisibility
; ; Get the Y position of the current sprite and store ; as an argument for the ConvertPixelsToBlockPos() call. ;
[8c21]b5 c2LDA CurrentSprites_YPos,X [8c23]85 b6STA Arg_PixelPosY
; ; Get the X position of the current sprite and store ; as an argument for the ConvertPixelsToBlockPos() call. ;
[8c25]b5 baLDA CurrentSprites_XPos_Full,X [8c27]18CLC [8c28]69 04ADC #$04 [8c2a]85 b5STA Arg_PixelPosX
; ; Convert to a block position. ;
[8c2c]20 6c e8JSR Area_ConvertPixelsToBlockPos [8c2f]20 c3 e8JSR ScreenBuffer_LoadBlockProperty [8c32]c9 04CMP #$04 [8c34]f0 08BEQ @LAB_PRG14__8c3e [8c36]c9 0dCMP #$0d [8c38]f0 04BEQ @LAB_PRG14__8c3e [8c3a]c9 09CMP #$09 [8c3c]d0 06BNE @LAB_PRG14__8c44 [8c3e]@LAB_PRG14__8c3e: [8c3e]a5 b8LDA Temp_MovingSpriteVisibility [8c40]09 01ORA #$01 [8c42]85 b8STA Temp_MovingSpriteVisibility [8c44]@LAB_PRG14__8c44: [8c44]ae 78 03LDX a:CurrentSpriteIndex [8c47]b5 baLDA CurrentSprites_XPos_Full,X [8c49]18CLC [8c4a]69 0cADC #$0c [8c4c]85 b5STA Arg_PixelPosX [8c4e]20 6c e8JSR Area_ConvertPixelsToBlockPos [8c51]20 c3 e8JSR ScreenBuffer_LoadBlockProperty [8c54]c9 04CMP #$04 [8c56]f0 08BEQ @LAB_PRG14__8c60 [8c58]c9 0dCMP #$0d [8c5a]f0 04BEQ @LAB_PRG14__8c60 [8c5c]c9 09CMP #$09 [8c5e]d0 06BNE @LAB_PRG14__8c66 [8c60]@LAB_PRG14__8c60: [8c60]a5 b8LDA Temp_MovingSpriteVisibility [8c62]09 02ORA #$02 [8c64]85 b8STA Temp_MovingSpriteVisibility [8c66]@LAB_PRG14__8c66: [8c66]ae 78 03LDX a:CurrentSpriteIndex [8c69]bd dc 02LDA a:CurrentSprites_Flags,X [8c6c]29 01AND #$01 [8c6e]f0 0dBEQ @LAB_PRG14__8c7d [8c70]a5 b8LDA Temp_MovingSpriteVisibility [8c72]f0 0bBEQ Something_SetDAT26 [8c74]c9 03CMP #$03 [8c76]f0 07BEQ Something_SetDAT26 [8c78]49 03EOR #$03 [8c7a]4c 7f 8cJMP Something_SetDAT26 [8c7d]@LAB_PRG14__8c7d: [8c7d]a5 b8LDA Temp_MovingSpriteVisibility
; ; XREFS: ; CurrentSprite_CalculateVisibility ;
[8c7f]Something_SetDAT26: [8c7f]85 26STA MovingSpriteVisibility [8c81]60RTS
;============================================================================ ; Set a sprite's flip mask based on the direction its facing. ; ; INPUTS: ; CurrentSprites_Flags: ; The flags for the current sprites. ; ; SPRITES_FACING_TO_FLIPMASK: ; The mapping table from a sprite's facing bit to ; flipmask values. ; ; OUTPUTS: ; CurrentSprite_FlipMask: ; The resulting flipmask value. ; ; XREFS: ; SpriteUpdateHandler_Boss_Borabohra ; SpriteUpdateHandler_Boss_KingGrieve ; SpriteUpdateHandler_Boss_Ripasheiku ; SpriteUpdateHandler_Boss_ShadowEura ; SpriteUpdateHandler_Boss_Zoradohna ; SpriteUpdateHandler_Boss_Zorugeriru ; SpriteUpdateHandler_Effect_Spring ; SpriteUpdateHandler_EnemyMagic ; SpriteUpdateHandler_Enemy_Bihoruda ; SpriteUpdateHandler_Enemy_Charron ; SpriteUpdateHandler_Enemy_ExecutionHood ; SpriteUpdateHandler_Enemy_FireGiant ; SpriteUpdateHandler_Enemy_Geributa ; SpriteUpdateHandler_Enemy_GiantBees ; SpriteUpdateHandler_Enemy_GiantStrider ; SpriteUpdateHandler_Enemy_Grimlock ; SpriteUpdateHandler_Enemy_Hornet ; SpriteUpdateHandler_Enemy_Ikeda ; SpriteUpdateHandler_Enemy_Ishiisu ; SpriteUpdateHandler_Enemy_Lamprey ; SpriteUpdateHandler_Enemy_Lilith ; SpriteUpdateHandler_Enemy_Magman ; SpriteUpdateHandler_Enemy_Maskman ; SpriteUpdateHandler_Enemy_Monodron ; SpriteUpdateHandler_Enemy_MuppetGuy ; SpriteUpdateHandler_Enemy_Myconid ; SpriteUpdateHandler_Enemy_Naga ; SpriteUpdateHandler_Enemy_Nash ; SpriteUpdateHandler_Enemy_NecronAides ; SpriteUpdateHandler_Enemy_Raiden ; SpriteUpdateHandler_Enemy_SirGawaine_Wolfman ; SpriteUpdateHandler_Enemy_Snowman ; SpriteUpdateHandler_Enemy_Sugata ; SpriteUpdateHandler_Enemy_Tamazutsu ; SpriteUpdateHandler_Enemy_Unused29 ; SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura ; SpriteUpdateHandler_Enemy_Unused_CurlyTail ; SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart ; SpriteUpdateHandler_Enemy_Unused_WingedSkeleton ; SpriteUpdateHandler_Enemy_Yareeka ; SpriteUpdateHandler_Enemy_Yuinaru ; SpriteUpdateHandler_Enemy_Zombie ; SpriteUpdateHandler_Garbled03 ; SpriteUpdateHandler_NPC_MagicTeacher ; SpriteUpdateHandler_NPC_MartialArts ; SpriteUpdateHandler_NPC_MeatSalesman_Others ; SpriteUpdateHandler_NPC_Priest ; SpriteUpdateHandler_NPC_Walking ; SpriteUpdateHandler_TODO_Garbled10 ;============================================================================
[8c82]CurrentSprite_UpdateFlipMask: [8c82]bd dc 02LDA a:CurrentSprites_Flags,X; Load flags for this sprite. [8c85]29 01AND #$01; AND for the facing bit. [8c87]a8TAY; Y = result [8c88]b9 18 8cLDA a:SPRITES_FACING_TO_FLIPMASK,Y; Load the bitmask from the mapping table. [8c8b]85 29STA CurrentSprite_FlipMask; Store it. [8c8d]60RTS
;============================================================================ ; TODO: Document Sprite_EnterNextAppearancePhase ; ; INPUTS: ; A ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__a2eb ; SpriteUpdateHandler_Boss_Borabohra ; SpriteUpdateHandler_Boss_KingGrieve ; SpriteUpdateHandler_Boss_Pakukame ; SpriteUpdateHandler_Boss_Ripasheiku ; SpriteUpdateHandler_Boss_Rokusutahn ; SpriteUpdateHandler_Boss_ShadowEura ; SpriteUpdateHandler_Boss_Zoradohna ; SpriteUpdateHandler_Boss_Zorugeriru ; SpriteUpdateHandler_Bread ; SpriteUpdateHandler_Coin ; SpriteUpdateHandler_Effect_EnemyDeath ; SpriteUpdateHandler_Effect_Fountain ; SpriteUpdateHandler_Effect_LightningBall20 ; SpriteUpdateHandler_Effect_Spring ; SpriteUpdateHandler_EnemyMagic ; SpriteUpdateHandler_Enemy_Bihoruda ; SpriteUpdateHandler_Enemy_Charron ; SpriteUpdateHandler_Enemy_ExecutionHood ; SpriteUpdateHandler_Enemy_FireGiant ; SpriteUpdateHandler_Enemy_Geributa ; SpriteUpdateHandler_Enemy_GiantBees ; SpriteUpdateHandler_Enemy_GiantStrider ; SpriteUpdateHandler_Enemy_Grimlock ; SpriteUpdateHandler_Enemy_Hornet ; SpriteUpdateHandler_Enemy_Ikeda ; SpriteUpdateHandler_Enemy_Ishiisu ; SpriteUpdateHandler_Enemy_Lamprey ; SpriteUpdateHandler_Enemy_Lilith ; SpriteUpdateHandler_Enemy_Magman ; SpriteUpdateHandler_Enemy_Maskman ; SpriteUpdateHandler_Enemy_Monodron ; SpriteUpdateHandler_Enemy_MuppetGuy ; SpriteUpdateHandler_Enemy_Myconid ; SpriteUpdateHandler_Enemy_Naga ; SpriteUpdateHandler_Enemy_Nash ; SpriteUpdateHandler_Enemy_NecronAides ; SpriteUpdateHandler_Enemy_Raiden ; SpriteUpdateHandler_Enemy_SirGawaine_Wolfman ; SpriteUpdateHandler_Enemy_Snowman ; SpriteUpdateHandler_Enemy_Sugata ; SpriteUpdateHandler_Enemy_Tamazutsu ; SpriteUpdateHandler_Enemy_Unused29 ; SpriteUpdateHandler_Enemy_Unused_CurlyTail ; SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart ; SpriteUpdateHandler_Enemy_Unused_WingedSkeleton ; SpriteUpdateHandler_Enemy_Yareeka ; SpriteUpdateHandler_Enemy_Yuinaru ; SpriteUpdateHandler_Enemy_Zombie ; SpriteUpdateHandler_Garbled03 ; SpriteUpdateHandler_Item_Special ; SpriteUpdateHandler_Item_Standard ; SpriteUpdateHandler_Magic_81 ; SpriteUpdateHandler_Magic_83 ; SpriteUpdateHandler_NPC_ArmorSalesman ; SpriteUpdateHandler_NPC_King ; SpriteUpdateHandler_NPC_MagicTeacher ; SpriteUpdateHandler_NPC_MartialArts ; SpriteUpdateHandler_NPC_Priest ; SpriteUpdateHandler_NPC_Walking ; SpriteUpdateHandler_TODO_Garbled10 ;============================================================================
[8c8e]Sprite_EnterNextAppearancePhase: [8c8e]18CLC [8c8f]bc cc 02LDY a:CurrentSprites_Entities,X [8c92]79 9f 8cADC a:SPRITE_APPEARANCE_PHASE_OFFSETS,Y [8c95]4c 57 f0JMP Sprite_SetAppearanceAddrFromOffset
;============================================================================ ; TODO: Document SpriteUpdateHandler_Invisible ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8087] ; SPRITE_UPDATE_HANDLERS [$PRG14::80b3] ; SPRITE_UPDATE_HANDLERS [$PRG14::80d1] ; SPRITE_UPDATE_HANDLERS [$PRG14::80d9] ; SPRITE_UPDATE_HANDLERS [$PRG14::8125] ;============================================================================
[8c98]SpriteUpdateHandler_Invisible: [8c98]a9 00LDA #$00 [8c9a]85 33STA Sprites_PPUOffset [8c9c]85 26STA MovingSpriteVisibility [8c9e]60RTS
;============================================================================ ; Offsets into TILEINFO_ENTITY_ADDRS for each entity. ; ; XREFS: ; Sprite_EnterNextAppearancePhase ;============================================================================
; ; XREFS: ; Sprite_EnterNextAppearancePhase ;
[8c9f]SPRITE_APPEARANCE_PHASE_OFFSETS: [8c9f]00.byte $00; [0]: [8ca0]db.byte $db; [1]: Dropped: Bread [8ca1]93.byte $93; [2]: Dropped: Coin [8ca2]83.byte $83; [3]: Enemy: ? [8ca3]01.byte $01; [4]: Enemy: Raiden [8ca4]05.byte $05; [5]: Enemy: Necron Aides [8ca5]07.byte $07; [6]: Enemy: Zombie [8ca6]0a.byte $0a; [7]: Enemy: Hornet [8ca7]0c.byte $0c; [8]: Enemy: Bihoruda [8ca8]0e.byte $0e; [9]: Enemy: Lilith [8ca9]ef.byte $ef; [10]: Magic: ? [8caa]13.byte $13; [11]: Enemy: Yuinaru [8cab]15.byte $15; [12]: Enemy: Snowman [8cac]17.byte $17; [13]: Enemy: Nash [8cad]1a.byte $1a; [14]: Enemy: Fire Giant [8cae]1d.byte $1d; [15]: Enemy: Ishiisu [8caf]21.byte $21; [16]: Enemy: Execution Hood [8cb0]71.byte $71; [17]: Boss: Rokusutahn [8cb1]6c.byte $6c; [18]: Boss: unused (round body of snake boss) [8cb2]a9.byte $a9; [19]: Effect: Enemy death [8cb3]a9.byte $a9; [20]: Effect: Lightning ball [8cb4]23.byte $23; [21]: Enemy: Charron [8cb5]00.byte $00; [22]: Enemy: ? (Unused) [8cb6]26.byte $26; [23]: Enemy: Geributa [8cb7]29.byte $29; [24]: Enemy: Sugata [8cb8]2b.byte $2b; [25]: Enemy: Grimlock [8cb9]2f.byte $2f; [26]: Enemy: Giant Bees [8cba]31.byte $31; [27]: Enemy: Myconid [8cbb]33.byte $33; [28]: Enemy: Naga [8cbc]35.byte $35; [29]: Enemy: Skeleton Knight (unused) [8cbd]39.byte $39; [30]: Enemy: Giant Strider [8cbe]3c.byte $3c; [31]: Enemy: Sir Gawaine [8cbf]3f.byte $3f; [32]: Enemy: Maskman [8cc0]44.byte $44; [33]: Enemy: Wolfman [8cc1]47.byte $47; [34]: Enemy: Yareeka [8cc2]49.byte $49; [35]: Enemy: Magman [8cc3]4b.byte $4b; [36]: Enemy: Curly-tailed guy with spear (unused) [8cc4]00.byte $00; [37]: Enemy: ? (unused) [8cc5]4f.byte $4f; [38]: Enemy: Ikeda [8cc6]52.byte $52; [39]: Enemy: Muppet guy (unused) [8cc7]54.byte $54; [40]: Enemy: Lamprey [8cc8]00.byte $00; [41]: Enemy: ? (unused) [8cc9]58.byte $58; [42]: Enemy: Monodron [8cca]5b.byte $5b; [43]: Enemy: Winged skeleton (unused) [8ccb]5d.byte $5d; [44]: Enemy: Tamazutsu [8ccc]79.byte $79; [45]: Boss: Ripasheiku [8ccd]75.byte $75; [46]: Boss: Zoradohna [8cce]64.byte $64; [47]: Boss: Borabohra [8ccf]7d.byte $7d; [48]: Boss: Pakukame [8cd0]83.byte $83; [49]: Boss: Zorugeriru [8cd1]80.byte $80; [50]: Boss: King Grieve [8cd2]89.byte $89; [51]: Boss: Shadow Eura [8cd3]ae.byte $ae; [52]: NPC: Walking Man 1 [8cd4]b1.byte $b1; [53]: NPC: Blue lady (unused) [8cd5]b4.byte $b4; [54]: NPC: Child (unused) [8cd6]b7.byte $b7; [55]: NPC: Armor Salesman [8cd7]b9.byte $b9; [56]: NPC: Martial Artist [8cd8]bb.byte $bb; [57]: NPC: Guru [8cd9]bd.byte $bd; [58]: NPC: King [8cda]c1.byte $c1; [59]: NPC: Magic Teacher [8cdb]c3.byte $c3; [60]: NPC: Key Salesman [8cdc]c5.byte $c5; [61]: NPC: Smoking Man [8cdd]c7.byte $c7; [62]: NPC: Man in Chair [8cde]c9.byte $c9; [63]: NPC: Sitting Man [8cdf]cb.byte $cb; [64]: NPC: Meat Salesman [8ce0]cd.byte $cd; [65]: NPC: Lady in Blue Dress with Cup [8ce1]cf.byte $cf; [66]: NPC: Guard [8ce2]d1.byte $d1; [67]: NPC: Doctor [8ce3]d3.byte $d3; [68]: NPC: Walking Woman 1 [8ce4]d5.byte $d5; [69]: NPC: Walking Woman 2 [8ce5]d7.byte $d7; [70]: Enemy: Eyeball (unused) [8ce6]d9.byte $d9; [71]: Enemy: Zozura [8ce7]dc.byte $dc; [72]: Item: Glove [8ce8]dd.byte $dd; [73]: Item: Black Onyx [8ce9]de.byte $de; [74]: Item: Pendant [8cea]df.byte $df; [75]: Item: Red Potion [8ceb]e0.byte $e0; [76]: Item: Poison [8cec]e1.byte $e1; [77]: Item: Elixir [8ced]e2.byte $e2; [78]: Item: Ointment [8cee]00.byte $00; [79]: Trigger: Intro [8cef]e3.byte $e3; [80]: Item: Mattock [8cf0]f1.byte $f1; [81]: Magic: ? [8cf1]e8.byte $e8; [82]: Effect: Fountain [8cf2]f3.byte $f3; [83]: Magic: ? [8cf3]95.byte $95; [84]: Magic: Enemy Fireball [8cf4]f6.byte $f6; [85]: Item: Wing Boots [8cf5]f7.byte $f7; [86]: Item: Hour Glass [8cf6]f8.byte $f8; [87]: Item: Magical Rod [8cf7]f9.byte $f9; [88]: Item: Battle Suit [8cf8]fa.byte $fa; [89]: Item: Battle Helmet [8cf9]fb.byte $fb; [90]: Item: Dragon Slayer [8cfa]e3.byte $e3; [91]: Item: Mattock [8cfb]f6.byte $f6; [92]: Item: Wing Boots (from quest) [8cfc]df.byte $df; [93]: Item: Red Potion [8cfd]e0.byte $e0; [94]: Item: Poison [8cfe]dc.byte $dc; [95]: Item: Glove [8cff]e2.byte $e2; [96]: Item: Ointment [8d00]e8.byte $e8; [97]: Effect: Spring of Trunk [8d01]e8.byte $e8; [98]: Effect: Spring of Sky [8d02]e8.byte $e8; [99]: Effect: Spring of Tower [8d03]a9.byte $a9; [100]: Effect: Boss Death
;============================================================================ ; TODO: Document SpriteBehavior_MaybeFallingRocks__ClearEntity ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_BounceAndExpire ;============================================================================
[8d04]SpriteBehavior_MaybeFallingRocks__ClearEntity: [8d04]a9 ffLDA #$ff [8d06]9d cc 02STA a:CurrentSprites_Entities,X [8d09]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_BounceAndExpire ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5eb] ;============================================================================
[8d0a]SpriteBehavior_BounceAndExpire: [8d0a]20 85 a8JSR Sprite_IsBehaviorNotReady [8d0d]d0 13BNE @LAB_PRG14__8d22 [8d0f]a9 00LDA #$00 [8d11]9d e4 02STA a:CurrentSprites_Phases,X [8d14]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [8d17]9d 2c 03STA a:CurrentSprites_PPUOffsets,X [8d1a]a9 80LDA #$80 [8d1c]9d dc 02STA a:CurrentSprites_Flags,X [8d1f]20 94 a8JSR Sprite_SetBehaviorReady [8d22]@LAB_PRG14__8d22: [8d22]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [8d25]f0 ddBEQ SpriteBehavior_MaybeFallingRocks__ClearEntity [8d27]bc e4 02LDY a:CurrentSprites_Phases,X [8d2a]d0 20BNE @LAB_PRG14__8d4c [8d2c]a9 04LDA #$04 [8d2e]8d 77 03STA a:Arg_DeltaY_Full [8d31]a9 00LDA #$00 [8d33]8d 76 03STA a:Arg_DeltaY_Frac [8d36]20 c4 85JSR Sprite_MoveVertical [8d39]90 10BCC @_return1 [8d3b]fe e4 02INC a:CurrentSprites_Phases,X [8d3e]a9 20LDA #$20 [8d40]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8d43]bd dc 02LDA a:CurrentSprites_Flags,X [8d46]29 7fAND #$7f [8d48]9d dc 02STA a:CurrentSprites_Flags,X [8d4b]@_return1: [8d4b]60RTS [8d4c]@LAB_PRG14__8d4c: [8d4c]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8d4f]a0 03LDY #$03 [8d51]20 e1 83JSR Sprites_CalcYFromGravity [8d54]a0 04LDY #$04 [8d56]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [8d59]20 c4 85JSR Sprite_MoveVertical [8d5c]bd e4 02LDA a:CurrentSprites_Phases,X [8d5f]a8TAY [8d60]fe f4 02INC a:CurrentSprites_BehaviorData3,X [8d63]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8d66]29 1fAND #$1f [8d68]d0 03BNE @_return2 [8d6a]20 10 84JSR BScript_Action_FlipYDirection [8d6d]@_return2: [8d6d]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Coin ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808b] ;============================================================================
[8d6e]SpriteUpdateHandler_Coin: [8d6e]a9 00LDA #$00 [8d70]85 29STA CurrentSprite_FlipMask [8d72]a0 00LDY #$00 [8d74]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [8d77]29 08AND #$08 [8d79]f0 01BEQ @LAB_PRG14__8d7c [8d7b]c8INY [8d7c]@LAB_PRG14__8d7c: [8d7c]98TYA [8d7d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Raiden ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808f] ;============================================================================
[8d80]SpriteUpdateHandler_Enemy_Raiden: [8d80]20 82 8cJSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8d83]a0 00LDY #$00 [8d85]bd e4 02LDA a:CurrentSprites_Phases,X; Load the current phase. [8d88]c9 02CMP #$02; Is it 2? [8d8a]f0 0aBEQ @_isPhase2; If so, jump. [8d8c]ad 83 03LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8d8f]4aLSR A; Divide by 4. [8d90]4aLSR A [8d91]29 01AND #$01; Use the odd/even bit as the phase, giving phases 0 or 1. [8d93]4c 8e 8cJMP Sprite_EnterNextAppearancePhase; Set that as the new phase. [8d96]@_isPhase2: [8d96]ad 83 03LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8d99]4aLSR A; Divide by 8. [8d9a]4aLSR A [8d9b]4aLSR A [8d9c]29 01AND #$01; Keep the odd/even bit for the phase. [8d9e]09 02ORA #$02; And OR with 2, giving phases 2 or 3. [8da0]4c 8e 8cJMP Sprite_EnterNextAppearancePhase; Set that as the new phase.
;============================================================================ ; TODO: Document SpriteBehavior_NecronAides ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a613] ;============================================================================
[8da3]SpriteBehavior_NecronAides: [8da3]20 85 a8JSR Sprite_IsBehaviorNotReady [8da6]d0 0bBNE @LAB_PRG14__8db3 [8da8]a9 00LDA #$00 [8daa]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8dad]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8db0]20 94 a8JSR Sprite_SetBehaviorReady [8db3]@LAB_PRG14__8db3: [8db3]ae 78 03LDX a:CurrentSpriteIndex [8db6]bd e4 02LDA a:CurrentSprites_Phases,X [8db9]30 53BMI @LAB_PRG14__8e0e [8dbb]bd dc 02LDA a:CurrentSprites_Flags,X [8dbe]2aROL A [8dbf]2aROL A [8dc0]29 01AND #$01 [8dc2]a8TAY [8dc3]b5 c2LDA CurrentSprites_YPos,X [8dc5]18CLC [8dc6]79 3a 8eADC a:BYTE_ARRAY_PRG14__8e3a,Y [8dc9]85 b6STA Arg_PixelPosY [8dcb]b5 baLDA CurrentSprites_XPos_Full,X [8dcd]85 b5STA Arg_PixelPosX [8dcf]20 6c e8JSR Area_ConvertPixelsToBlockPos [8dd2]20 c3 e8JSR ScreenBuffer_LoadBlockProperty [8dd5]ae 78 03LDX a:CurrentSpriteIndex [8dd8]c9 02CMP #$02 [8dda]f0 08BEQ @LAB_PRG14__8de4 [8ddc]bd dc 02LDA a:CurrentSprites_Flags,X [8ddf]49 80EOR #$80 [8de1]9d dc 02STA a:CurrentSprites_Flags,X [8de4]@LAB_PRG14__8de4: [8de4]ad 83 03LDA a:SpriteUpdateCounter [8de7]c9 17CMP #$17 [8de9]f0 04BEQ @LAB_PRG14__8def [8deb]c9 75CMP #$75 [8ded]d0 08BNE @LAB_PRG14__8df7 [8def]@LAB_PRG14__8def: [8def]bd dc 02LDA a:CurrentSprites_Flags,X [8df2]49 80EOR #$80 [8df4]9d dc 02STA a:CurrentSprites_Flags,X [8df7]@LAB_PRG14__8df7: [8df7]ad 83 03LDA a:SpriteUpdateCounter [8dfa]4aLSR A [8dfb]4aLSR A [8dfc]29 03AND #$03 [8dfe]a8TAY [8dff]b9 3c 8eLDA a:BYTE_ARRAY_PRG14__8e3c,Y [8e02]8d 76 03STA a:Arg_DeltaY_Frac [8e05]b9 40 8eLDA a:BYTE_ARRAY_PRG14__8e40,Y [8e08]8d 77 03STA a:Arg_DeltaY_Full [8e0b]4c ca 85JMP Sprite_CalculateNewVertPos [8e0e]@LAB_PRG14__8e0e: [8e0e]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [8e11]90 03BCC @LAB_PRG14__8e16 [8e13]4c 4a 86JMP CurrentSprite_HandleFall [8e16]@LAB_PRG14__8e16: [8e16]ad 83 03LDA a:SpriteUpdateCounter [8e19]c9 26CMP #$26 [8e1b]f0 08BEQ @LAB_PRG14__8e25 [8e1d]c9 48CMP #$48 [8e1f]f0 04BEQ @LAB_PRG14__8e25 [8e21]c9 93CMP #$93 [8e23]d0 08BNE @LAB_PRG14__8e2d [8e25]@LAB_PRG14__8e25: [8e25]bd dc 02LDA a:CurrentSprites_Flags,X [8e28]49 01EOR #$01 [8e2a]9d dc 02STA a:CurrentSprites_Flags,X [8e2d]@LAB_PRG14__8e2d: [8e2d]a9 00LDA #$00 [8e2f]8d 74 03STA a:Arg_DeltaX_Frac [8e32]a9 01LDA #$01 [8e34]8d 75 03STA a:Arg_DeltaX_Full [8e37]4c 94 84JMP Sprites_Something_SomethingAndMoveHoriz
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e3a]BYTE_ARRAY_PRG14__8e3a: [8e3a]ff.byte $ff; [0]: [8e3b]20.byte $20; [1]:
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e3c]BYTE_ARRAY_PRG14__8e3c: [8e3c]20.byte $20; [0]: [8e3d]40.byte $40; [1]: [8e3e]80.byte $80; [2]: [8e3f]00.byte $00; [3]:
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e40]BYTE_ARRAY_PRG14__8e40: [8e40]00.byte $00; [0]: [8e41]00.byte $00; [1]: [8e42]00.byte $00; [2]: [8e43]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_NecronAides ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8091] ;============================================================================
[8e44]SpriteUpdateHandler_Enemy_NecronAides: [8e44]20 82 8cJSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8e47]ad 83 03LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8e4a]4aLSR A; Divide it by 4. [8e4b]4aLSR A [8e4c]bc e4 02LDY a:CurrentSprites_Phases,X; Load the current sprite phase. [8e4f]30 01BMI @_setPhase; If unset, jump. [8e51]4aLSR A; Divide again by 2 (total of 8). [8e52]@_setPhase: [8e52]29 01AND #$01; Keep the odd/even bit, yielding a phase of 0 or 1. [8e54]4c 8e 8cJMP Sprite_EnterNextAppearancePhase; Set the appearance phase.
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Zombie ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8093] ;============================================================================
[8e57]SpriteUpdateHandler_Enemy_Zombie: [8e57]20 82 8cJSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8e5a]a0 00LDY #$00 [8e5c]20 b8 a8JSR Sprite_GetPreviousSpritePhase; Get the previous phase for the sprite. [8e5f]4aLSR A; Divide it by 2. [8e60]b0 0dBCS @LAB_PRG14__8e6f [8e62]ad 83 03LDA a:SpriteUpdateCounter [8e65]4aLSR A [8e66]4aLSR A [8e67]4aLSR A [8e68]29 03AND #$03 [8e6a]a8TAY [8e6b]b9 73 8eLDA a:SPRITEBEHAVIOR_ENEMY_ZOMBIE_PHASES,Y [8e6e]a8TAY [8e6f]@LAB_PRG14__8e6f: [8e6f]98TYA [8e70]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Zombie ;
[8e73]SPRITEBEHAVIOR_ENEMY_ZOMBIE_PHASES: [8e73]00.byte $00; [0]: [8e74]01.byte $01; [1]: [8e75]02.byte $02; [2]: [8e76]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_BuzzAround ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a665] ;============================================================================
[8e77]SpriteBehavior_BuzzAround: [8e77]20 85 a8JSR Sprite_IsBehaviorNotReady [8e7a]d0 0bBNE @LAB_PRG14__8e87 [8e7c]a9 00LDA #$00 [8e7e]9d e4 02STA a:CurrentSprites_Phases,X [8e81]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8e84]20 94 a8JSR Sprite_SetBehaviorReady [8e87]@LAB_PRG14__8e87: [8e87]a9 00LDA #$00 [8e89]8d 74 03STA a:Arg_DeltaX_Frac [8e8c]a9 02LDA #$02 [8e8e]8d 75 03STA a:Arg_DeltaX_Full [8e91]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [8e94]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8e97]4aLSR A [8e98]4aLSR A [8e99]4aLSR A [8e9a]29 07AND #$07 [8e9c]a8TAY [8e9d]b9 b0 8eLDA a:SPRITE_BEHAVIOR_BUZZ_AROUND_Y_FRAC,Y [8ea0]8d 76 03STA a:Arg_DeltaY_Frac [8ea3]b9 b8 8eLDA a:SPRITE_BEHAVIOR_BUZZ_AROUND_X_FRAC,Y [8ea6]8d 77 03STA a:Arg_DeltaY_Full [8ea9]20 64 85JSR Sprite_MoveVertAndFlipIfNeeded [8eac]fe ec 02INC a:CurrentSprites_BehaviorData2,X; Increment the sprite's tick counter. [8eaf]60RTS
; ; XREFS: ; SpriteBehavior_BuzzAround ;
[8eb0]SPRITE_BEHAVIOR_BUZZ_AROUND_Y_FRAC: [8eb0]00.byte $00; [0]: [8eb1]00.byte $00; [1]: [8eb2]80.byte $80; [2]: [8eb3]40.byte $40; [3]: [8eb4]00.byte $00; [4]: [8eb5]40.byte $40; [5]: [8eb6]80.byte $80; [6]: [8eb7]00.byte $00; [7]:
; ; XREFS: ; SpriteBehavior_BuzzAround ;
[8eb8]SPRITE_BEHAVIOR_BUZZ_AROUND_X_FRAC: [8eb8]02.byte $02; [0]: [8eb9]01.byte $01; [1]: [8eba]00.byte $00; [2]: [8ebb]00.byte $00; [3]: [8ebc]00.byte $00; [4]: [8ebd]00.byte $00; [5]: [8ebe]00.byte $00; [6]: [8ebf]01.byte $01; [7]: [8ec0]ff 01.byte $ff,$01; undefined
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Hornet ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8095] ;============================================================================
[8ec2]SpriteUpdateHandler_Enemy_Hornet: [8ec2]20 82 8cJSR CurrentSprite_UpdateFlipMask [8ec5]ad 83 03LDA a:SpriteUpdateCounter [8ec8]4aLSR A [8ec9]4aLSR A [8eca]29 01AND #$01 [8ecc]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Bihoruda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a615] ;============================================================================
[8ecf]SpriteBehavior_Bihoruda: [8ecf]20 85 a8JSR Sprite_IsBehaviorNotReady [8ed2]d0 0dBNE @LAB_PRG14__8ee1 [8ed4]a9 00LDA #$00 [8ed6]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8ed9]a9 40LDA #$40 [8edb]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8ede]20 94 a8JSR Sprite_SetBehaviorReady [8ee1]@LAB_PRG14__8ee1: [8ee1]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8ee4]a0 02LDY #$02 [8ee6]20 e1 83JSR Sprites_CalcYFromGravity [8ee9]a0 03LDY #$03 [8eeb]20 c1 83JSR Sprites_CalcHorizSpriteMovement [8eee]ad 75 03LDA a:Arg_DeltaX_Full [8ef1]29 01AND #$01 [8ef3]8d 75 03STA a:Arg_DeltaX_Full [8ef6]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [8ef9]fe ec 02INC a:CurrentSprites_BehaviorData2,X [8efc]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8eff]a0 02LDY #$02 [8f01]20 e1 83JSR Sprites_CalcYFromGravity [8f04]a0 03LDY #$03 [8f06]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [8f09]ad 77 03LDA a:Arg_DeltaY_Full [8f0c]29 01AND #$01 [8f0e]8d 77 03STA a:Arg_DeltaY_Full [8f11]20 64 85JSR Sprite_MoveVertAndFlipIfNeeded [8f14]fe f4 02INC a:CurrentSprites_BehaviorData3,X [8f17]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Bihoruda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8097] ;============================================================================
[8f18]SpriteUpdateHandler_Enemy_Bihoruda: [8f18]20 82 8cJSR CurrentSprite_UpdateFlipMask [8f1b]a0 00LDY #$00 [8f1d]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8f20]29 7fAND #$7f [8f22]38SEC [8f23]e9 30SBC #$30 [8f25]c9 30CMP #$30 [8f27]90 01BCC @LAB_PRG14__8f2a [8f29]c8INY [8f2a]@LAB_PRG14__8f2a: [8f2a]98TYA [8f2b]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Lilith ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a617] ;============================================================================
[8f2e]SpriteBehavior_Lilith: [8f2e]20 85 a8JSR Sprite_IsBehaviorNotReady [8f31]d0 1eBNE @LAB_PRG14__8f51 [8f33]a9 00LDA #$00 [8f35]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8f38]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8f3b]9d e4 02STA a:CurrentSprites_Phases,X [8f3e]bd dc 02LDA a:CurrentSprites_Flags,X [8f41]09 80ORA #$80 [8f43]9d dc 02STA a:CurrentSprites_Flags,X [8f46]a9 3cLDA #$3c [8f48]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [8f4b]20 94 a8JSR Sprite_SetBehaviorReady [8f4e]20 ad a7JSR BScript_Action_RandomlyFlipXDirection [8f51]@LAB_PRG14__8f51: [8f51]bc e4 02LDY a:CurrentSprites_Phases,X [8f54]f0 03BEQ @LAB_PRG14__8f59 [8f56]4c 9a 8fJMP SpriteBehavior__8f9a [8f59]@LAB_PRG14__8f59: [8f59]a9 01LDA #$01 [8f5b]8d 75 03STA a:Arg_DeltaX_Full [8f5e]a9 00LDA #$00 [8f60]8d 74 03STA a:Arg_DeltaX_Frac [8f63]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [8f66]a0 05LDY #$05 [8f68]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8f6b]20 e1 83JSR Sprites_CalcYFromGravity [8f6e]a0 05LDY #$05 [8f70]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [8f73]20 ca 85JSR Sprite_CalculateNewVertPos [8f76]fe f4 02INC a:CurrentSprites_BehaviorData3,X [8f79]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8f7c]29 0fAND #$0f [8f7e]d0 03BNE @LAB_PRG14__8f83 [8f80]20 10 84JSR BScript_Action_FlipYDirection [8f83]@LAB_PRG14__8f83: [8f83]de fc 02DEC a:CurrentSprites_InternalBehaviorStates,X [8f86]d0 11BNE @_return [8f88]fe e4 02INC a:CurrentSprites_Phases,X [8f8b]20 7b 86JSR BScript_Action_FacePlayerX [8f8e]20 91 86JSR BScript_Action_FacePlayerY [8f91]a9 00LDA #$00 [8f93]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8f96]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8f99]@_return: [8f99]60RTS
; ; XREFS: ; SpriteBehavior_Lilith ;
[8f9a]SpriteBehavior__8f9a: [8f9a]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8f9d]a0 03LDY #$03 [8f9f]20 e1 83JSR Sprites_CalcYFromGravity [8fa2]a0 04LDY #$04 [8fa4]20 c1 83JSR Sprites_CalcHorizSpriteMovement [8fa7]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [8faa]fe ec 02INC a:CurrentSprites_BehaviorData2,X [8fad]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8fb0]29 3fAND #$3f [8fb2]d0 03BNE @LAB_PRG14__8fb7 [8fb4]20 7b 86JSR BScript_Action_FacePlayerX [8fb7]@LAB_PRG14__8fb7: [8fb7]fe f4 02INC a:CurrentSprites_BehaviorData3,X [8fba]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [8fbd]c9 27CMP #$27 [8fbf]f0 08BEQ @LAB_PRG14__8fc9 [8fc1]a9 00LDA #$00 [8fc3]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8fc6]20 91 86JSR BScript_Action_FacePlayerY [8fc9]@LAB_PRG14__8fc9: [8fc9]a9 01LDA #$01 [8fcb]8d 77 03STA a:Arg_DeltaY_Full [8fce]a9 00LDA #$00 [8fd0]8d 76 03STA a:Arg_DeltaY_Frac [8fd3]4c 9c 85JMP Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [8fd6]@_return: [8fd6]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[8fd7]FUN_PRG14__8fd7: [8fd7]a9 00LDA #$00
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Lilith ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8099] ;============================================================================
[8fd9]SpriteUpdateHandler_Enemy_Lilith: [8fd9]20 82 8cJSR CurrentSprite_UpdateFlipMask [8fdc]ad 83 03LDA a:SpriteUpdateCounter [8fdf]4aLSR A [8fe0]4aLSR A [8fe1]4aLSR A [8fe2]29 01AND #$01 [8fe4]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Yuinaru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a619] ;============================================================================
[8fe7]SpriteBehavior_Yuinaru: [8fe7]20 85 a8JSR Sprite_IsBehaviorNotReady [8fea]d0 0dBNE @LAB_PRG14__8ff9 [8fec]a9 00LDA #$00 [8fee]9d ec 02STA a:CurrentSprites_BehaviorData2,X [8ff1]a9 80LDA #$80 [8ff3]9d f4 02STA a:CurrentSprites_BehaviorData3,X [8ff6]20 94 a8JSR Sprite_SetBehaviorReady [8ff9]@LAB_PRG14__8ff9: [8ff9]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [8ffc]a0 01LDY #$01 [8ffe]20 e1 83JSR Sprites_CalcYFromGravity [9001]a0 03LDY #$03 [9003]20 c1 83JSR Sprites_CalcHorizSpriteMovement [9006]ad 75 03LDA a:Arg_DeltaX_Full [9009]29 03AND #$03 [900b]8d 75 03STA a:Arg_DeltaX_Full [900e]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9011]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9014]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9017]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [901a]a0 02LDY #$02 [901c]20 e1 83JSR Sprites_CalcYFromGravity [901f]a0 03LDY #$03 [9021]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9024]ad 77 03LDA a:Arg_DeltaY_Full [9027]29 01AND #$01 [9029]8d 77 03STA a:Arg_DeltaY_Full [902c]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [902f]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9032]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Yuinaru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809d] ;============================================================================
[9033]SpriteUpdateHandler_Enemy_Yuinaru: [9033]20 82 8cJSR CurrentSprite_UpdateFlipMask [9036]a0 00LDY #$00 [9038]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [903b]29 08AND #$08 [903d]f0 01BEQ @LAB_PRG14__9040 [903f]c8INY [9040]@LAB_PRG14__9040: [9040]98TYA [9041]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Snowman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809f] ;============================================================================
[9044]SpriteUpdateHandler_Enemy_Snowman: [9044]20 82 8cJSR CurrentSprite_UpdateFlipMask [9047]a0 00LDY #$00 [9049]bd e4 02LDA a:CurrentSprites_Phases,X [904c]f0 0eBEQ @LAB_PRG14__905c [904e]a8TAY [904f]ad 83 03LDA a:SpriteUpdateCounter [9052]4aLSR A [9053]4aLSR A [9054]c0 01CPY #$01 [9056]d0 01BNE @LAB_PRG14__9059 [9058]4aLSR A [9059]@LAB_PRG14__9059: [9059]29 01AND #$01 [905b]a8TAY [905c]@LAB_PRG14__905c: [905c]98TYA [905d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Nash ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61b] ;============================================================================
[9060]SpriteBehavior_Nash: [9060]20 85 a8JSR Sprite_IsBehaviorNotReady [9063]d0 08BNE @LAB_PRG14__906d [9065]a9 78LDA #$78 [9067]9d ec 02STA a:CurrentSprites_BehaviorData2,X [906a]20 94 a8JSR Sprite_SetBehaviorReady [906d]@LAB_PRG14__906d: [906d]bc e4 02LDY a:CurrentSprites_Phases,X [9070]f0 1dBEQ @LAB_PRG14__908f [9072]88DEY [9073]f0 59BEQ @LAB_PRG14__90ce [9075]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9078]f0 0aBEQ @LAB_PRG14__9084 [907a]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [907d]c9 0aCMP #$0a [907f]d0 0dBNE @_return [9081]4c a0 a0JMP FUN_PRG14__a0a0 [9084]@LAB_PRG14__9084: [9084]a9 00LDA #$00 [9086]9d e4 02STA a:CurrentSprites_Phases,X [9089]a9 78LDA #$78 [908b]9d ec 02STA a:CurrentSprites_BehaviorData2,X [908e]@_return: [908e]60RTS [908f]@LAB_PRG14__908f: [908f]20 bf a8JSR Sprite_SetVisible [9092]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9095]d0 36BNE @_return1 [9097]20 ce a8JSR Sprites_HideSprite [909a]fe e4 02INC a:CurrentSprites_Phases,X [909d]a9 3cLDA #$3c [909f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [90a2]a5 a4LDA Player_Flags [90a4]29 40AND #$40 [90a6]d0 15BNE @LAB_PRG14__90bd [90a8]a5 9eLDA Player_PosX_Block [90aa]18CLC [90ab]69 20ADC #$20 [90ad]95 baSTA CurrentSprites_XPos_Full,X [90af]b0 04BCS @LAB_PRG14__90b5 [90b1]c9 f0CMP #$f0 [90b3]90 18BCC @_return1 [90b5]@LAB_PRG14__90b5: [90b5]a5 9eLDA Player_PosX_Block [90b7]38SEC [90b8]e9 20SBC #$20 [90ba]95 baSTA CurrentSprites_XPos_Full,X [90bc]60RTS [90bd]@LAB_PRG14__90bd: [90bd]a5 9eLDA Player_PosX_Block [90bf]38SEC [90c0]e9 20SBC #$20 [90c2]95 baSTA CurrentSprites_XPos_Full,X [90c4]b0 07BCS @_return1 [90c6]a5 9eLDA Player_PosX_Block [90c8]18CLC [90c9]69 20ADC #$20 [90cb]95 baSTA CurrentSprites_XPos_Full,X [90cd]@_return1: [90cd]60RTS [90ce]@LAB_PRG14__90ce: [90ce]20 7b 86JSR BScript_Action_FacePlayerX [90d1]de ec 02DEC a:CurrentSprites_BehaviorData2,X [90d4]d0 08BNE @_return2 [90d6]a9 3cLDA #$3c [90d8]9d ec 02STA a:CurrentSprites_BehaviorData2,X [90db]fe e4 02INC a:CurrentSprites_Phases,X [90de]@_return2: [90de]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Nash ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a1] ;============================================================================
[90df]SpriteUpdateHandler_Enemy_Nash: [90df]20 82 8cJSR CurrentSprite_UpdateFlipMask [90e2]bd e4 02LDA a:CurrentSprites_Phases,X [90e5]f0 0fBEQ @_return [90e7]c9 02CMP #$02 [90e9]f0 0cBEQ @LAB_PRG14__90f7 [90eb]ad 83 03LDA a:SpriteUpdateCounter [90ee]29 04AND #$04 [90f0]d0 04BNE @_return [90f2]a0 00LDY #$00 [90f4]f0 15BEQ @LAB_PRG14__910b [90f6]@_return: [90f6]60RTS [90f7]@LAB_PRG14__90f7: [90f7]a0 00LDY #$00 [90f9]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [90fc]38SEC [90fd]e9 0aSBC #$0a [90ff]c9 28CMP #$28 [9101]b0 08BCS @LAB_PRG14__910b [9103]a0 01LDY #$01 [9105]c9 14CMP #$14 [9107]b0 02BCS @LAB_PRG14__910b [9109]a0 02LDY #$02 [910b]@LAB_PRG14__910b: [910b]98TYA [910c]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_FireGiant ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a3] ;============================================================================
[910f]SpriteUpdateHandler_Enemy_FireGiant: [910f]20 82 8cJSR CurrentSprite_UpdateFlipMask [9112]a0 02LDY #$02 [9114]bd e4 02LDA a:CurrentSprites_Phases,X [9117]c9 02CMP #$02 [9119]d0 0aBNE @LAB_PRG14__9125 [911b]a0 00LDY #$00 [911d]ad 83 03LDA a:SpriteUpdateCounter [9120]29 04AND #$04 [9122]f0 01BEQ @LAB_PRG14__9125 [9124]c8INY [9125]@LAB_PRG14__9125: [9125]98TYA [9126]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Ishiisu ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a667] ;============================================================================
[9129]SpriteBehavior_Ishiisu: [9129]20 85 a8JSR Sprite_IsBehaviorNotReady [912c]d0 08BNE @LAB_PRG14__9136 [912e]a9 00LDA #$00 [9130]9d e4 02STA a:CurrentSprites_Phases,X [9133]20 94 a8JSR Sprite_SetBehaviorReady [9136]@LAB_PRG14__9136: [9136]bd e4 02LDA a:CurrentSprites_Phases,X [9139]4aLSR A [913a]b0 3aBCS @LAB_PRG14__9176 [913c]b5 baLDA CurrentSprites_XPos_Full,X [913e]38SEC [913f]e5 9eSBC Player_PosX_Block [9141]b0 04BCS @LAB_PRG14__9147 [9143]49 ffEOR #$ff [9145]69 01ADC #$01 [9147]@LAB_PRG14__9147: [9147]c9 20CMP #$20 [9149]90 13BCC @LAB_PRG14__915e [914b]20 7b 86JSR BScript_Action_FacePlayerX [914e]a9 c0LDA #$c0 [9150]8d 74 03STA a:Arg_DeltaX_Frac [9153]a9 00LDA #$00 [9155]8d 75 03STA a:Arg_DeltaX_Full [9158]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [915b]4c 07 85JMP SpriteBehavior_Ishiisu_Something_915b [915e]@LAB_PRG14__915e: [915e]bd dc 02LDA a:CurrentSprites_Flags,X [9161]29 01AND #$01 [9163]a8TAY [9164]a5 a4LDA Player_Flags [9166]29 40AND #$40 [9168]59 8c 91EOR a:BYTE_ARRAY_PRG14__918c,Y [916b]d0 08BNE @_return1 [916d]fe e4 02INC a:CurrentSprites_Phases,X [9170]a9 1eLDA #$1e [9172]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9175]@_return1: [9175]60RTS [9176]@LAB_PRG14__9176: [9176]20 7b 86JSR BScript_Action_FacePlayerX [9179]de ec 02DEC a:CurrentSprites_BehaviorData2,X [917c]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [917f]f0 07BEQ @LAB_PRG14__9188 [9181]c9 14CMP #$14 [9183]d0 06BNE @_return2 [9185]4c a0 a0JMP FUN_PRG14__a0a0 [9188]@LAB_PRG14__9188: [9188]fe e4 02INC a:CurrentSprites_Phases,X [918b]@_return2: [918b]60RTS
; ; XREFS: ; SpriteBehavior_Ishiisu ;
[918c]BYTE_ARRAY_PRG14__918c: [918c]40.byte $40; [0]: [918d]00.byte $00; [1]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Ishiisu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a5] ;============================================================================
[918e]SpriteUpdateHandler_Enemy_Ishiisu: [918e]20 82 8cJSR CurrentSprite_UpdateFlipMask [9191]bd e4 02LDA a:CurrentSprites_Phases,X [9194]4aLSR A [9195]b0 0dBCS @LAB_PRG14__91a4 [9197]a0 00LDY #$00 [9199]ad 83 03LDA a:SpriteUpdateCounter [919c]29 04AND #$04 [919e]f0 0fBEQ @LAB_PRG14__91af [91a0]a0 01LDY #$01 [91a2]d0 0bBNE @LAB_PRG14__91af [91a4]@LAB_PRG14__91a4: [91a4]a0 02LDY #$02 [91a6]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [91a9]c9 14CMP #$14 [91ab]b0 02BCS @LAB_PRG14__91af [91ad]a0 03LDY #$03 [91af]@LAB_PRG14__91af: [91af]98TYA [91b0]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ExecutionHood ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a669] ;============================================================================
[91b3]SpriteBehavior_ExecutionHood: [91b3]20 85 a8JSR Sprite_IsBehaviorNotReady [91b6]d0 0bBNE @LAB_PRG14__91c3 [91b8]a9 00LDA #$00 [91ba]9d f4 02STA a:CurrentSprites_BehaviorData3,X [91bd]9d e4 02STA a:CurrentSprites_Phases,X [91c0]20 94 a8JSR Sprite_SetBehaviorReady [91c3]@LAB_PRG14__91c3: [91c3]bd e4 02LDA a:CurrentSprites_Phases,X [91c6]29 03AND #$03 [91c8]c9 03CMP #$03 [91ca]f0 3fBEQ @LAB_PRG14__920b [91cc]a9 80LDA #$80 [91ce]8d 74 03STA a:Arg_DeltaX_Frac [91d1]a9 00LDA #$00 [91d3]8d 75 03STA a:Arg_DeltaX_Full [91d6]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [91d9]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [91dc]a0 05LDY #$05 [91de]20 e1 83JSR Sprites_CalcYFromGravity [91e1]a0 05LDY #$05 [91e3]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [91e6]a9 00LDA #$00 [91e8]8d 77 03STA a:Arg_DeltaY_Full [91eb]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [91ee]fe f4 02INC a:CurrentSprites_BehaviorData3,X [91f1]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [91f4]29 07AND #$07 [91f6]d0 03BNE @LAB_PRG14__91fb [91f8]20 10 84JSR BScript_Action_FlipYDirection [91fb]@LAB_PRG14__91fb: [91fb]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [91fe]29 0fAND #$0f [9200]d0 08BNE @_return1 [9202]fe e4 02INC a:CurrentSprites_Phases,X [9205]a9 0fLDA #$0f [9207]9d ec 02STA a:CurrentSprites_BehaviorData2,X [920a]@_return1: [920a]60RTS [920b]@LAB_PRG14__920b: [920b]20 7b 86JSR BScript_Action_FacePlayerX [920e]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9211]d0 0bBNE @_return2 [9213]fe e4 02INC a:CurrentSprites_Phases,X [9216]a9 00LDA #$00 [9218]9d f4 02STA a:CurrentSprites_BehaviorData3,X [921b]4c 93 a0JMP SpriteBehavior_ExecutionHood__a093 [921e]@_return2: [921e]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_ExecutionHood ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a7] ;============================================================================
[921f]SpriteUpdateHandler_Enemy_ExecutionHood: [921f]20 82 8cJSR CurrentSprite_UpdateFlipMask [9222]a0 00LDY #$00 [9224]bd e4 02LDA a:CurrentSprites_Phases,X [9227]29 03AND #$03 [9229]c9 03CMP #$03 [922b]d0 08BNE @LAB_PRG14__9235 [922d]ad 83 03LDA a:SpriteUpdateCounter [9230]29 04AND #$04 [9232]f0 01BEQ @LAB_PRG14__9235 [9234]c8INY [9235]@LAB_PRG14__9235: [9235]98TYA [9236]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document BScript_Action_CastMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a7a2] ;============================================================================
[9239]BScript_Action_CastMagic: [9239]20 36 a2JSR Sprites_HasMaxOnScreen [923c]b0 22BCS @_return [923e]bd dc 02LDA a:CurrentSprites_Flags,X [9241]29 01AND #$01 [9243]99 dc 02STA a:CurrentSprites_Flags,Y [9246]b5 baLDA CurrentSprites_XPos_Full,X [9248]99 ba 00STA a:CurrentSprites_XPos_Full,Y [924b]b5 c2LDA CurrentSprites_YPos,X [924d]18CLC [924e]69 08ADC #$08 [9250]99 c2 00STA a:CurrentSprites_YPos,Y [9253]a9 54LDA #$54 [9255]99 cc 02STA a:CurrentSprites_Entities,Y [9258]a9 00LDA #$00 [925a]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [925d]4c 02 a2JMP Sprite_Maybe_ResetState [9260]@_return: [9260]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Charron ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b1] ;============================================================================
[9261]SpriteUpdateHandler_Enemy_Charron: [9261]20 82 8cJSR CurrentSprite_UpdateFlipMask [9264]bd e4 02LDA a:CurrentSprites_Phases,X [9267]f0 12BEQ @LAB_PRG14__927b [9269]c9 05CMP #$05 [926b]f0 13BEQ @LAB_PRG14__9280 [926d]4aLSR A [926e]b0 0bBCS @LAB_PRG14__927b [9270]ad 83 03LDA a:SpriteUpdateCounter [9273]4aLSR A [9274]4aLSR A [9275]4aLSR A [9276]29 01AND #$01 [9278]4c 7d 92JMP @LAB_PRG14__927d [927b]@LAB_PRG14__927b: [927b]a9 01LDA #$01 [927d]@LAB_PRG14__927d: [927d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase [9280]@LAB_PRG14__9280: [9280]a9 02LDA #$02 [9282]d0 f9BNE @LAB_PRG14__927d
;============================================================================ ; TODO: Document _thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a623] ;============================================================================
[9284]_thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7: [9284]4c ac a8JMP Sprite_FinishBehavior
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Geributa ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b5] ;============================================================================
[9287]SpriteUpdateHandler_Enemy_Geributa: [9287]20 82 8cJSR CurrentSprite_UpdateFlipMask [928a]a0 02LDY #$02 [928c]bd e4 02LDA a:CurrentSprites_Phases,X [928f]f0 0aBEQ @LAB_PRG14__929b [9291]a0 00LDY #$00 [9293]ad 83 03LDA a:SpriteUpdateCounter [9296]29 04AND #$04 [9298]f0 01BEQ @LAB_PRG14__929b [929a]c8INY [929b]@LAB_PRG14__929b: [929b]98TYA [929c]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Sugata ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b7] ;============================================================================
[929f]SpriteUpdateHandler_Enemy_Sugata: [929f]20 82 8cJSR CurrentSprite_UpdateFlipMask [92a2]a0 00LDY #$00 [92a4]ad 83 03LDA a:SpriteUpdateCounter [92a7]29 08AND #$08 [92a9]f0 01BEQ @LAB_PRG14__92ac [92ab]c8INY [92ac]@LAB_PRG14__92ac: [92ac]98TYA [92ad]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Grimlock ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b9] ;============================================================================
[92b0]SpriteUpdateHandler_Enemy_Grimlock: [92b0]20 82 8cJSR CurrentSprite_UpdateFlipMask [92b3]a0 03LDY #$03 [92b5]bd e4 02LDA a:CurrentSprites_Phases,X [92b8]c9 09CMP #$09 [92ba]f0 1cBEQ @LAB_PRG14__92d8 [92bc]c9 0bCMP #$0b [92be]f0 18BEQ @LAB_PRG14__92d8 [92c0]a0 00LDY #$00 [92c2]c9 08CMP #$08 [92c4]90 12BCC @LAB_PRG14__92d8 [92c6]a8TAY [92c7]ad 83 03LDA a:SpriteUpdateCounter [92ca]c0 0bCPY #$0b [92cc]f0 01BEQ @LAB_PRG14__92cf [92ce]4aLSR A [92cf]@LAB_PRG14__92cf: [92cf]4aLSR A [92d0]4aLSR A [92d1]29 03AND #$03 [92d3]a8TAY [92d4]b9 dc 92LDA a:SPRITE_GRIMLOCK_PHASES,Y [92d7]a8TAY [92d8]@LAB_PRG14__92d8: [92d8]98TYA [92d9]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Grimlock ;
[92dc]SPRITE_GRIMLOCK_PHASES: [92dc]00.byte $00; [0]: [92dd]01.byte $01; [1]: [92de]02.byte $02; [2]: [92df]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_GiantBees ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a627] ;============================================================================
[92e0]SpriteBehavior_GiantBees: [92e0]20 85 a8JSR Sprite_IsBehaviorNotReady [92e3]d0 08BNE @LAB_PRG14__92ed [92e5]a9 00LDA #$00 [92e7]9d e4 02STA a:CurrentSprites_Phases,X [92ea]20 94 a8JSR Sprite_SetBehaviorReady [92ed]@LAB_PRG14__92ed: [92ed]bc e4 02LDY a:CurrentSprites_Phases,X [92f0]f0 06BEQ @LAB_PRG14__92f8 [92f2]88DEY [92f3]f0 36BEQ @LAB_PRG14__932b [92f5]4c 60 93JMP @LAB_PRG14__9360 [92f8]@LAB_PRG14__92f8: [92f8]a9 00LDA #$00 [92fa]8d 76 03STA a:Arg_DeltaY_Frac [92fd]a9 04LDA #$04 [92ff]8d 77 03STA a:Arg_DeltaY_Full [9302]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [9305]b5 c2LDA CurrentSprites_YPos,X [9307]c9 20CMP #$20 [9309]b0 11BCS @_return1 [930b]fe e4 02INC a:CurrentSprites_Phases,X [930e]a9 ffLDA #$ff [9310]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9313]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9316]20 7b 86JSR BScript_Action_FacePlayerX [9319]20 91 86JSR BScript_Action_FacePlayerY [931c]@_return1: [931c]60RTS [931d]@LAB_PRG14__931d: [931d]fe e4 02INC a:CurrentSprites_Phases,X [9320]a9 40LDA #$40 [9322]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9325]a9 00LDA #$00 [9327]9d f4 02STA a:CurrentSprites_BehaviorData3,X [932a]60RTS [932b]@LAB_PRG14__932b: [932b]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [932e]f0 edBEQ @LAB_PRG14__931d [9330]20 1b 83JSR Sprite_CalcDistanceYToPlayer [9333]c9 08CMP #$08 [9335]90 e6BCC @LAB_PRG14__931d [9337]a9 00LDA #$00 [9339]8d 74 03STA a:Arg_DeltaX_Frac [933c]a9 01LDA #$01 [933e]8d 75 03STA a:Arg_DeltaX_Full [9341]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9344]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9347]a0 02LDY #$02 [9349]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [934c]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [934f]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9352]38SEC [9353]e9 04SBC #$04 [9355]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9358]b0 05BCS @_return2 [935a]a9 00LDA #$00 [935c]9d f4 02STA a:CurrentSprites_BehaviorData3,X [935f]@_return2: [935f]60RTS [9360]@LAB_PRG14__9360: [9360]20 7b 86JSR BScript_Action_FacePlayerX [9363]a9 c0LDA #$c0 [9365]8d 74 03STA a:Arg_DeltaX_Frac [9368]a9 00LDA #$00 [936a]8d 75 03STA a:Arg_DeltaX_Full [936d]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9370]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9373]a0 04LDY #$04 [9375]20 e1 83JSR Sprites_CalcYFromGravity [9378]a0 04LDY #$04 [937a]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [937d]a9 00LDA #$00 [937f]8d 77 03STA a:Arg_DeltaY_Full [9382]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [9385]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9388]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [938b]29 0fAND #$0f [938d]d0 08BNE @LAB_PRG14__9397 [938f]bd dc 02LDA a:CurrentSprites_Flags,X [9392]49 80EOR #$80 [9394]9d dc 02STA a:CurrentSprites_Flags,X [9397]@LAB_PRG14__9397: [9397]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [939a]29 7fAND #$7f [939c]d0 0dBNE @_return [939e]a9 00LDA #$00 [93a0]9d e4 02STA a:CurrentSprites_Phases,X [93a3]bd dc 02LDA a:CurrentSprites_Flags,X [93a6]29 7fAND #$7f [93a8]9d dc 02STA a:CurrentSprites_Flags,X [93ab]@_return: [93ab]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_GiantBees ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bb] ;============================================================================
[93ac]SpriteUpdateHandler_Enemy_GiantBees: [93ac]20 82 8cJSR CurrentSprite_UpdateFlipMask [93af]a0 00LDY #$00 [93b1]ad 83 03LDA a:SpriteUpdateCounter [93b4]29 08AND #$08 [93b6]f0 01BEQ @LAB_PRG14__93b9 [93b8]c8INY [93b9]@LAB_PRG14__93b9: [93b9]98TYA [93ba]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Myconid ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bd] ;============================================================================
[93bd]SpriteUpdateHandler_Enemy_Myconid: [93bd]20 82 8cJSR CurrentSprite_UpdateFlipMask [93c0]bd e4 02LDA a:CurrentSprites_Phases,X [93c3]c9 01CMP #$01 [93c5]f0 0dBEQ @LAB_PRG14__93d4 [93c7]c9 03CMP #$03 [93c9]f0 09BEQ @LAB_PRG14__93d4 [93cb]c9 05CMP #$05 [93cd]f0 05BEQ @LAB_PRG14__93d4 [93cf]a9 00LDA #$00 [93d1]4c 8e 8cJMP Sprite_EnterNextAppearancePhase [93d4]@LAB_PRG14__93d4: [93d4]a8TAY [93d5]ad 83 03LDA a:SpriteUpdateCounter [93d8]c0 05CPY #$05 [93da]f0 01BEQ @LAB_PRG14__93dd [93dc]4aLSR A [93dd]@LAB_PRG14__93dd: [93dd]4aLSR A [93de]4aLSR A [93df]4aLSR A [93e0]29 01AND #$01 [93e2]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Naga ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a629] ;============================================================================
[93e5]SpriteBehavior_Naga: [93e5]20 85 a8JSR Sprite_IsBehaviorNotReady [93e8]d0 0bBNE @LAB_PRG14__93f5 [93ea]a9 00LDA #$00 [93ec]9d f4 02STA a:CurrentSprites_BehaviorData3,X [93ef]9d e4 02STA a:CurrentSprites_Phases,X [93f2]20 94 a8JSR Sprite_SetBehaviorReady [93f5]@LAB_PRG14__93f5: [93f5]20 7b 86JSR BScript_Action_FacePlayerX [93f8]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [93fb]a0 04LDY #$04 [93fd]20 e1 83JSR Sprites_CalcYFromGravity [9400]a0 05LDY #$05 [9402]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9405]ad 77 03LDA a:Arg_DeltaY_Full [9408]29 01AND #$01 [940a]8d 77 03STA a:Arg_DeltaY_Full [940d]20 c4 85JSR Sprite_MoveVertical [9410]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9413]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9416]29 1fAND #$1f [9418]d0 08BNE @LAB_PRG14__9422 [941a]bd dc 02LDA a:CurrentSprites_Flags,X [941d]49 80EOR #$80 [941f]9d dc 02STA a:CurrentSprites_Flags,X [9422]@LAB_PRG14__9422: [9422]20 1b 83JSR Sprite_CalcDistanceYToPlayer [9425]c9 10CMP #$10 [9427]90 18BCC @_return [9429]bd dc 02LDA a:CurrentSprites_Flags,X [942c]48PHA [942d]20 91 86JSR BScript_Action_FacePlayerY [9430]a9 00LDA #$00 [9432]8d 77 03STA a:Arg_DeltaY_Full [9435]a9 c0LDA #$c0 [9437]8d 76 03STA a:Arg_DeltaY_Frac [943a]20 c4 85JSR Sprite_MoveVertical [943d]68PLA [943e]9d dc 02STA a:CurrentSprites_Flags,X [9441]@_return: [9441]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Naga ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bf] ;============================================================================
[9442]SpriteUpdateHandler_Enemy_Naga: [9442]20 82 8cJSR CurrentSprite_UpdateFlipMask [9445]a0 00LDY #$00 [9447]ad 83 03LDA a:SpriteUpdateCounter [944a]29 08AND #$08 [944c]f0 01BEQ @LAB_PRG14__944f [944e]c8INY [944f]@LAB_PRG14__944f: [944f]98TYA [9450]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused29 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c1] ;============================================================================
[9453]SpriteUpdateHandler_Enemy_Unused29: [9453]20 82 8cJSR CurrentSprite_UpdateFlipMask [9456]a0 03LDY #$03 [9458]bd e4 02LDA a:CurrentSprites_Phases,X [945b]f0 0fBEQ @LAB_PRG14__946c [945d]c9 02CMP #$02 [945f]f0 0fBEQ @LAB_PRG14__9470 [9461]a0 01LDY #$01 [9463]ad 83 03LDA a:SpriteUpdateCounter [9466]29 08AND #$08 [9468]f0 02BEQ @LAB_PRG14__946c [946a]a0 02LDY #$02 [946c]@LAB_PRG14__946c: [946c]98TYA [946d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase [9470]@LAB_PRG14__9470: [9470]a0 00LDY #$00 [9472]ad 83 03LDA a:SpriteUpdateCounter [9475]29 10AND #$10 [9477]f0 f3BEQ @LAB_PRG14__946c [9479]a0 02LDY #$02 [947b]d0 efBNE @LAB_PRG14__946c
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_GiantStrider ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c3] ;============================================================================
[947d]SpriteUpdateHandler_Enemy_GiantStrider: [947d]20 82 8cJSR CurrentSprite_UpdateFlipMask [9480]a0 02LDY #$02 [9482]bd e4 02LDA a:CurrentSprites_Phases,X [9485]c9 02CMP #$02 [9487]f0 0aBEQ @LAB_PRG14__9493 [9489]a0 00LDY #$00 [948b]ad 83 03LDA a:SpriteUpdateCounter [948e]29 04AND #$04 [9490]f0 01BEQ @LAB_PRG14__9493 [9492]c8INY [9493]@LAB_PRG14__9493: [9493]98TYA [9494]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_SirGawaineWolfman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a637] ;============================================================================
[9497]SpriteBehavior_SirGawaineWolfman: [9497]20 85 a8JSR Sprite_IsBehaviorNotReady [949a]d0 08BNE @LAB_PRG14__94a4 [949c]a9 00LDA #$00 [949e]9d e4 02STA a:CurrentSprites_Phases,X [94a1]20 94 a8JSR Sprite_SetBehaviorReady [94a4]@LAB_PRG14__94a4: [94a4]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [94a7]90 03BCC @LAB_PRG14__94ac [94a9]20 4a 86JSR CurrentSprite_HandleFall [94ac]@LAB_PRG14__94ac: [94ac]a9 00LDA #$00 [94ae]9d e4 02STA a:CurrentSprites_Phases,X [94b1]20 f8 82JSR Sprite_CalcDistanceXToPlayer [94b4]c9 18CMP #$18 [94b6]f0 1cBEQ @_return1 [94b8]90 1bBCC @LAB_PRG14__94d5 [94ba]20 7b 86JSR BScript_Action_FacePlayerX [94bd]a9 01LDA #$01 [94bf]8d 75 03STA a:Arg_DeltaX_Full [94c2]a9 00LDA #$00 [94c4]8d 74 03STA a:Arg_DeltaX_Frac [94c7]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [94ca]ad 83 03LDA a:SpriteUpdateCounter [94cd]29 08AND #$08 [94cf]f0 03BEQ @_return1 [94d1]fe e4 02INC a:CurrentSprites_Phases,X [94d4]@_return1: [94d4]60RTS [94d5]@LAB_PRG14__94d5: [94d5]a9 01LDA #$01 [94d7]9d e4 02STA a:CurrentSprites_Phases,X [94da]a5 a4LDA Player_Flags [94dc]29 01AND #$01 [94de]d0 13BNE @LAB_PRG14__94f3 [94e0]20 7b 86JSR BScript_Action_FacePlayerX [94e3]a0 00LDY #$00 [94e5]ad 83 03LDA a:SpriteUpdateCounter [94e8]29 10AND #$10 [94ea]f0 02BEQ @LAB_PRG14__94ee [94ec]a0 02LDY #$02 [94ee]@LAB_PRG14__94ee: [94ee]98TYA [94ef]9d e4 02STA a:CurrentSprites_Phases,X [94f2]60RTS [94f3]@LAB_PRG14__94f3: [94f3]a9 00LDA #$00 [94f5]9d e4 02STA a:CurrentSprites_Phases,X [94f8]20 7b 86JSR BScript_Action_FacePlayerX [94fb]a9 02LDA #$02 [94fd]8d 75 03STA a:Arg_DeltaX_Full [9500]a9 00LDA #$00 [9502]8d 74 03STA a:Arg_DeltaX_Frac [9505]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [9508]ad 83 03LDA a:SpriteUpdateCounter [950b]29 04AND #$04 [950d]d0 03BNE @_return2 [950f]fe e4 02INC a:CurrentSprites_Phases,X [9512]@_return2: [9512]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_SirGawaine_Wolfman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c5] ; thunk_SpriteUpdateHandler_Enemy_SirGawaine_Wolfman ;============================================================================
[9513]SpriteUpdateHandler_Enemy_SirGawaine_Wolfman: [9513]20 82 8cJSR CurrentSprite_UpdateFlipMask [9516]bd e4 02LDA a:CurrentSprites_Phases,X [9519]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Maskman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c7] ;============================================================================
[951c]SpriteUpdateHandler_Enemy_Maskman: [951c]20 82 8cJSR CurrentSprite_UpdateFlipMask [951f]a0 04LDY #$04 [9521]bd e4 02LDA a:CurrentSprites_Phases,X [9524]4aLSR A [9525]90 0aBCC @LAB_PRG14__9531 [9527]a0 00LDY #$00 [9529]ad 83 03LDA a:SpriteUpdateCounter [952c]29 08AND #$08 [952e]f0 01BEQ @LAB_PRG14__9531 [9530]c8INY [9531]@LAB_PRG14__9531: [9531]98TYA [9532]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document thunk_SpriteUpdateHandler_Enemy_SirGawaine_Wolfman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c9] ;============================================================================
[9535]thunk_SpriteUpdateHandler_Enemy_SirGawaine_Wolfman: [9535]4c 13 95JMP SpriteUpdateHandler_Enemy_SirGawaine_Wolfman
;============================================================================ ; TODO: Document SpriteBehavior_Yareeka ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62b] ;============================================================================
[9538]SpriteBehavior_Yareeka: [9538]20 85 a8JSR Sprite_IsBehaviorNotReady [953b]d0 0bBNE @LAB_PRG14__9548 [953d]a9 00LDA #$00 [953f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9542]9d e4 02STA a:CurrentSprites_Phases,X [9545]20 94 a8JSR Sprite_SetBehaviorReady [9548]@LAB_PRG14__9548: [9548]bc e4 02LDY a:CurrentSprites_Phases,X [954b]c0 02CPY #$02 [954d]f0 31BEQ @LAB_PRG14__9580 [954f]88DEY [9550]f0 13BEQ @LAB_PRG14__9565 [9552]20 93 95JSR FUN_PRG14__9593 [9555]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9558]c9 40CMP #$40 [955a]90 08BCC @_return1 [955c]fe e4 02INC a:CurrentSprites_Phases,X [955f]a9 40LDA #$40 [9561]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9564]@_return1: [9564]60RTS [9565]@LAB_PRG14__9565: [9565]a9 02LDA #$02 [9567]8d 75 03STA a:Arg_DeltaX_Full [956a]a9 00LDA #$00 [956c]8d 74 03STA a:Arg_DeltaX_Frac [956f]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9572]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9575]d0 08BNE @LAB_PRG14__957f [9577]fe e4 02INC a:CurrentSprites_Phases,X [957a]a9 40LDA #$40 [957c]9d ec 02STA a:CurrentSprites_BehaviorData2,X [957f]@LAB_PRG14__957f: [957f]60RTS [9580]@LAB_PRG14__9580: [9580]20 93 95JSR FUN_PRG14__9593 [9583]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9586]c9 80CMP #$80 [9588]90 08BCC @_return2 [958a]a9 00LDA #$00 [958c]9d e4 02STA a:CurrentSprites_Phases,X [958f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9592]@_return2: [9592]60RTS
;============================================================================ ; TODO: Document FUN_PRG14__9593 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9699 ; LAB_PRG14__96d5 [$PRG14::96d5] ; SpriteBehavior_Yareeka ;============================================================================
[9593]FUN_PRG14__9593: [9593]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9596]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9599]a0 02LDY #$02 [959b]20 e1 83JSR Sprites_CalcYFromGravity [959e]a0 03LDY #$03 [95a0]20 c1 83JSR Sprites_CalcHorizSpriteMovement [95a3]ad 75 03LDA a:Arg_DeltaX_Full [95a6]29 01AND #$01 [95a8]8d 75 03STA a:Arg_DeltaX_Full [95ab]4c 19 84JMP Sprite_MoveHorizAndTurnAroundIfNeeded
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Yareeka ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cb] ;============================================================================
[95ae]SpriteUpdateHandler_Enemy_Yareeka: [95ae]20 82 8cJSR CurrentSprite_UpdateFlipMask [95b1]a0 00LDY #$00 [95b3]ad 83 03LDA a:SpriteUpdateCounter [95b6]29 08AND #$08 [95b8]f0 02BEQ @LAB_PRG14__95bc [95ba]a0 01LDY #$01 [95bc]@LAB_PRG14__95bc: [95bc]98TYA [95bd]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Magman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62d] ;============================================================================
[95c0]SpriteBehavior_Magman: [95c0]20 85 a8JSR Sprite_IsBehaviorNotReady [95c3]d0 15BNE @LAB_PRG14__95da [95c5]a9 3cLDA #$3c [95c7]9d ec 02STA a:CurrentSprites_BehaviorData2,X [95ca]a9 00LDA #$00 [95cc]9d e4 02STA a:CurrentSprites_Phases,X [95cf]a9 d0LDA #$d0 [95d1]95 c2STA CurrentSprites_YPos,X [95d3]a9 f0LDA #$f0 [95d5]95 baSTA CurrentSprites_XPos_Full,X [95d7]20 94 a8JSR Sprite_SetBehaviorReady [95da]@LAB_PRG14__95da: [95da]bd e4 02LDA a:CurrentSprites_Phases,X [95dd]4aLSR A [95de]b0 22BCS @LAB_PRG14__9602 [95e0]de ec 02DEC a:CurrentSprites_BehaviorData2,X [95e3]d0 1cBNE @_return [95e5]fe e4 02INC a:CurrentSprites_Phases,X [95e8]a9 78LDA #$78 [95ea]9d ec 02STA a:CurrentSprites_BehaviorData2,X [95ed]a0 30LDY #$30 [95ef]a5 a4LDA Player_Flags [95f1]29 40AND #$40 [95f3]d0 02BNE @LAB_PRG14__95f7 [95f5]a0 d0LDY #$d0 [95f7]@LAB_PRG14__95f7: [95f7]98TYA [95f8]18CLC [95f9]65 9eADC Player_PosX_Block [95fb]95 baSTA CurrentSprites_XPos_Full,X [95fd]a5 a1LDA Player_PosY [95ff]95 c2STA CurrentSprites_YPos,X [9601]@_return: [9601]60RTS [9602]@LAB_PRG14__9602: [9602]20 7b 86JSR BScript_Action_FacePlayerX [9605]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9608]d0 10BNE RETURN_961A [960a]fe e4 02INC a:CurrentSprites_Phases,X [960d]a9 3cLDA #$3c [960f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9612]a9 d0LDA #$d0 [9614]95 c2STA CurrentSprites_YPos,X [9616]a9 f0LDA #$f0 [9618]95 baSTA CurrentSprites_XPos_Full,X
; ; XREFS: ; SpriteBehavior_Magman ; SpriteUpdateHandler_Enemy_Magman ;
[961a]RETURN_961A: [961a]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Magman ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cd] ;============================================================================
[961b]SpriteUpdateHandler_Enemy_Magman: [961b]20 82 8cJSR CurrentSprite_UpdateFlipMask [961e]bd e4 02LDA a:CurrentSprites_Phases,X [9621]4aLSR A [9622]90 f6BCC RETURN_961A [9624]a0 00LDY #$00 [9626]ad 83 03LDA a:SpriteUpdateCounter [9629]29 08AND #$08 [962b]f0 01BEQ @LAB_PRG14__962e [962d]c8INY [962e]@LAB_PRG14__962e: [962e]98TYA [962f]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused36 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62f] ;============================================================================
[9632]SpriteBehavior_EnemyUnused36: [9632]20 85 a8JSR Sprite_IsBehaviorNotReady [9635]d0 0dBNE @LAB_PRG14__9644 [9637]a9 20LDA #$20 [9639]9d f4 02STA a:CurrentSprites_BehaviorData3,X [963c]a9 00LDA #$00 [963e]9d e4 02STA a:CurrentSprites_Phases,X [9641]20 94 a8JSR Sprite_SetBehaviorReady [9644]@LAB_PRG14__9644: [9644]bd e4 02LDA a:CurrentSprites_Phases,X [9647]29 03AND #$03 [9649]9d e4 02STA a:CurrentSprites_Phases,X [964c]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [964f]a0 04LDY #$04 [9651]20 e1 83JSR Sprites_CalcYFromGravity [9654]a0 05LDY #$05 [9656]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9659]ad 77 03LDA a:Arg_DeltaY_Full [965c]29 01AND #$01 [965e]8d 77 03STA a:Arg_DeltaY_Full [9661]20 c4 85JSR Sprite_MoveVertical [9664]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9667]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [966a]29 1fAND #$1f [966c]d0 03BNE @LAB_PRG14__9671 [966e]20 10 84JSR BScript_Action_FlipYDirection [9671]@LAB_PRG14__9671: [9671]bd e4 02LDA a:CurrentSprites_Phases,X [9674]d0 23BNE FUN_PRG14__9699 [9676]a9 00LDA #$00 [9678]8d 75 03STA a:Arg_DeltaX_Full [967b]a9 c0LDA #$c0 [967d]8d 74 03STA a:Arg_DeltaX_Frac [9680]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9683]20 1b 83JSR Sprite_CalcDistanceYToPlayer [9686]c9 20CMP #$20 [9688]b0 08BCS @_return [968a]fe e4 02INC a:CurrentSprites_Phases,X [968d]a9 00LDA #$00 [968f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9692]@_return: [9692]60RTS
;============================================================================ ; TODO: Document FUN_PRG14__9693 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9699 ;============================================================================
[9693]FUN_PRG14__9693: [9693]a9 00LDA #$00 [9695]9d e4 02STA a:CurrentSprites_Phases,X [9698]60RTS
;============================================================================ ; TODO: Document FUN_PRG14__9699 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused36 ;============================================================================
[9699]FUN_PRG14__9699: [9699]20 1b 83JSR Sprite_CalcDistanceYToPlayer [969c]c9 20CMP #$20 [969e]b0 f3BCS FUN_PRG14__9693 [96a0]bc e4 02LDY a:CurrentSprites_Phases,X [96a3]c0 03CPY #$03 [96a5]f0 2eBEQ @LAB_PRG14__96d5 [96a7]88DEY [96a8]f0 0eBEQ @LAB_PRG14__96b8 [96aa]20 93 95JSR FUN_PRG14__9593 [96ad]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [96b0]c9 40CMP #$40 [96b2]90 03BCC @_return1 [96b4]fe e4 02INC a:CurrentSprites_Phases,X [96b7]@_return1: [96b7]60RTS [96b8]@LAB_PRG14__96b8: [96b8]a9 02LDA #$02 [96ba]8d 75 03STA a:Arg_DeltaX_Full [96bd]a9 00LDA #$00 [96bf]8d 74 03STA a:Arg_DeltaX_Frac [96c2]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [96c5]20 f8 82JSR Sprite_CalcDistanceXToPlayer [96c8]c9 30CMP #$30 [96ca]b0 08BCS @_return2 [96cc]fe e4 02INC a:CurrentSprites_Phases,X [96cf]a9 40LDA #$40 [96d1]9d ec 02STA a:CurrentSprites_BehaviorData2,X [96d4]@_return2: [96d4]60RTS [96d5]@LAB_PRG14__96d5: [96d5]20 93 95JSR FUN_PRG14__9593 [96d8]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [96db]c9 40CMP #$40 [96dd]90 0aBCC @_return3 [96df]a9 01LDA #$01 [96e1]9d e4 02STA a:CurrentSprites_Phases,X [96e4]a9 00LDA #$00 [96e6]9d ec 02STA a:CurrentSprites_BehaviorData2,X [96e9]@_return3: [96e9]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused_CurlyTail ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cf] ;============================================================================
[96ea]SpriteUpdateHandler_Enemy_Unused_CurlyTail: [96ea]20 82 8cJSR CurrentSprite_UpdateFlipMask [96ed]bd e4 02LDA a:CurrentSprites_Phases,X [96f0]d0 04BNE @LAB_PRG14__96f6 [96f2]a0 00LDY #$00 [96f4]f0 02BEQ @LAB_PRG14__96f8 [96f6]@LAB_PRG14__96f6: [96f6]a0 02LDY #$02 [96f8]@LAB_PRG14__96f8: [96f8]ad 83 03LDA a:SpriteUpdateCounter [96fb]29 08AND #$08 [96fd]f0 01BEQ @LAB_PRG14__9700 [96ff]c8INY [9700]@LAB_PRG14__9700: [9700]98TYA [9701]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Ikeda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d3] ;============================================================================
[9704]SpriteUpdateHandler_Enemy_Ikeda: [9704]20 82 8cJSR CurrentSprite_UpdateFlipMask [9707]a0 02LDY #$02 [9709]20 b8 a8JSR Sprite_GetPreviousSpritePhase [970c]4aLSR A [970d]b0 0aBCS @LAB_PRG14__9719 [970f]a0 00LDY #$00 [9711]ad 83 03LDA a:SpriteUpdateCounter [9714]29 04AND #$04 [9716]f0 01BEQ @LAB_PRG14__9719 [9718]c8INY [9719]@LAB_PRG14__9719: [9719]98TYA [971a]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused39 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a631] ;============================================================================
[971d]SpriteBehavior_EnemyUnused39: [971d]20 85 a8JSR Sprite_IsBehaviorNotReady [9720]d0 0bBNE @LAB_PRG14__972d [9722]a9 00LDA #$00 [9724]9d e4 02STA a:CurrentSprites_Phases,X [9727]9d ec 02STA a:CurrentSprites_BehaviorData2,X [972a]20 94 a8JSR Sprite_SetBehaviorReady [972d]@LAB_PRG14__972d: [972d]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [9730]90 03BCC @LAB_PRG14__9735 [9732]4c 4a 86JMP CurrentSprite_HandleFall [9735]@LAB_PRG14__9735: [9735]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9738]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [973b]c9 13CMP #$13 [973d]f0 0cBEQ @LAB_PRG14__974b [973f]c9 56CMP #$56 [9741]f0 08BEQ @LAB_PRG14__974b [9743]c9 85CMP #$85 [9745]f0 04BEQ @LAB_PRG14__974b [9747]c9 c9CMP #$c9 [9749]d0 03BNE @LAB_PRG14__974e [974b]@LAB_PRG14__974b: [974b]20 a0 a0JSR FUN_PRG14__a0a0 [974e]@LAB_PRG14__974e: [974e]20 7b 86JSR BScript_Action_FacePlayerX [9751]a9 40LDA #$40 [9753]8d 74 03STA a:Arg_DeltaX_Frac [9756]a9 00LDA #$00 [9758]8d 75 03STA a:Arg_DeltaX_Full [975b]4c 19 84JMP Sprite_MoveHorizAndTurnAroundIfNeeded
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_MuppetGuy ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d5] ;============================================================================
[975e]SpriteUpdateHandler_Enemy_MuppetGuy: [975e]20 82 8cJSR CurrentSprite_UpdateFlipMask [9761]a0 00LDY #$00 [9763]ad 83 03LDA a:SpriteUpdateCounter [9766]29 10AND #$10 [9768]d0 02BNE @LAB_PRG14__976c [976a]a0 01LDY #$01 [976c]@LAB_PRG14__976c: [976c]98TYA [976d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Lamprey ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d7] ;============================================================================
[9770]SpriteUpdateHandler_Enemy_Lamprey: [9770]20 82 8cJSR CurrentSprite_UpdateFlipMask [9773]ad 83 03LDA a:SpriteUpdateCounter [9776]4aLSR A [9777]4aLSR A [9778]4aLSR A [9779]29 07AND #$07 [977b]a8TAY [977c]a5 29LDA CurrentSprite_FlipMask [977e]59 93 97EOR a:LAMPREY_HORIZ_FLIP_BITS,Y [9781]85 29STA CurrentSprite_FlipMask [9783]b9 8b 97LDA a:BYTE_ARRAY_PRG14__978b,Y [9786]a8TAY [9787]98TYA [9788]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Lamprey ;
[978b]BYTE_ARRAY_PRG14__978b: [978b]00.byte $00; [0]: [978c]01.byte $01; [1]: [978d]01.byte $01; [2]: [978e]00.byte $00; [3]: [978f]01.byte $01; [4]: [9790]01.byte $01; [5]: [9791]00.byte $00; [6]: [9792]01.byte $01; [7]:
; ; XREFS: ; SpriteUpdateHandler_Enemy_Lamprey ;
[9793]LAMPREY_HORIZ_FLIP_BITS: [9793]00.byte $00; [0]: [9794]00.byte $00; [1]: [9795]40.byte $40; [2]: [9796]40.byte $40; [3]: [9797]40.byte $40; [4]: [9798]00.byte $00; [5]: [9799]00.byte $00; [6]: [979a]40.byte $40; [7]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Monodron ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80db] ;============================================================================
[979b]SpriteUpdateHandler_Enemy_Monodron: [979b]20 82 8cJSR CurrentSprite_UpdateFlipMask [979e]20 b8 a8JSR Sprite_GetPreviousSpritePhase [97a1]29 03AND #$03 [97a3]a8TAY [97a4]b9 aa 97LDA a:SPRITE_MONODRON_APPEARANCE_PHASES,Y [97a7]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Monodron ;
[97aa]SPRITE_MONODRON_APPEARANCE_PHASES: [97aa]00.byte $00; [0]: [97ab]02.byte $02; [1]: [97ac]00.byte $00; [2]: [97ad]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused43 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a633] ;============================================================================
[97ae]SpriteBehavior_EnemyUnused43: [97ae]20 85 a8JSR Sprite_IsBehaviorNotReady [97b1]d0 0bBNE @LAB_PRG14__97be [97b3]a9 00LDA #$00 [97b5]9d f4 02STA a:CurrentSprites_BehaviorData3,X [97b8]9d e4 02STA a:CurrentSprites_Phases,X [97bb]20 94 a8JSR Sprite_SetBehaviorReady [97be]@LAB_PRG14__97be: [97be]20 7b 86JSR BScript_Action_FacePlayerX [97c1]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [97c4]a0 04LDY #$04 [97c6]20 e1 83JSR Sprites_CalcYFromGravity [97c9]a0 05LDY #$05 [97cb]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [97ce]ad 77 03LDA a:Arg_DeltaY_Full [97d1]29 01AND #$01 [97d3]8d 77 03STA a:Arg_DeltaY_Full [97d6]20 c4 85JSR Sprite_MoveVertical [97d9]fe f4 02INC a:CurrentSprites_BehaviorData3,X [97dc]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [97df]29 1fAND #$1f [97e1]d0 08BNE @LAB_PRG14__97eb [97e3]bd dc 02LDA a:CurrentSprites_Flags,X [97e6]49 80EOR #$80 [97e8]9d dc 02STA a:CurrentSprites_Flags,X [97eb]@LAB_PRG14__97eb: [97eb]a0 00LDY #$00 [97ed]a5 a4LDA Player_Flags [97ef]29 40AND #$40 [97f1]f0 01BEQ @LAB_PRG14__97f4 [97f3]c8INY [97f4]@LAB_PRG14__97f4: [97f4]a5 9eLDA Player_PosX_Block [97f6]18CLC [97f7]79 51 98ADC a:BYTE_ARRAY_PRG14__9851,Y [97fa]38SEC [97fb]f5 baSBC CurrentSprites_XPos_Full,X [97fd]f0 21BEQ @LAB_PRG14__9820 [97ff]a9 00LDA #$00 [9801]2aROL A [9802]85 00STA Temp_00 [9804]bd dc 02LDA a:CurrentSprites_Flags,X [9807]48PHA [9808]29 feAND #$fe [980a]05 00ORA Temp_00 [980c]9d dc 02STA a:CurrentSprites_Flags,X [980f]a9 01LDA #$01 [9811]8d 75 03STA a:Arg_DeltaX_Full [9814]a9 00LDA #$00 [9816]8d 74 03STA a:Arg_DeltaX_Frac [9819]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [981c]68PLA [981d]9d dc 02STA a:CurrentSprites_Flags,X [9820]@LAB_PRG14__9820: [9820]a5 a1LDA Player_PosY [9822]38SEC [9823]e9 18SBC #$18 [9825]38SEC [9826]f5 c2SBC CurrentSprites_YPos,X [9828]f0 26BEQ @_return [982a]a8TAY [982b]a9 00LDA #$00 [982d]6aROR A [982e]85 00STA Temp_00 [9830]c0 20CPY #$20 [9832]90 1cBCC @_return [9834]bd dc 02LDA a:CurrentSprites_Flags,X [9837]48PHA [9838]29 7fAND #$7f [983a]05 00ORA Temp_00 [983c]9d dc 02STA a:CurrentSprites_Flags,X [983f]a9 01LDA #$01 [9841]8d 77 03STA a:Arg_DeltaY_Full [9844]a9 00LDA #$00 [9846]8d 76 03STA a:Arg_DeltaY_Frac [9849]20 c4 85JSR Sprite_MoveVertical [984c]68PLA [984d]9d dc 02STA a:CurrentSprites_Flags,X [9850]@_return: [9850]60RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused43 ;
[9851]BYTE_ARRAY_PRG14__9851: [9851]20.byte $20; [0]:
; ; XREFS: ; SpriteBehavior_EnemyUnused43 ;
[9852]BYTE_ARRAY_PRG14__9851_1_: [9852]e0.byte $e0; [1]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused_WingedSkeleton ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80dd] ;============================================================================
[9853]SpriteUpdateHandler_Enemy_Unused_WingedSkeleton: [9853]20 82 8cJSR CurrentSprite_UpdateFlipMask [9856]a0 00LDY #$00 [9858]ad 83 03LDA a:SpriteUpdateCounter [985b]29 08AND #$08 [985d]f0 02BEQ @LAB_PRG14__9861 [985f]a0 01LDY #$01 [9861]@LAB_PRG14__9861: [9861]98TYA [9862]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Tamazutsu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a635] ;============================================================================
[9865]SpriteBehavior_Tamazutsu: [9865]20 85 a8JSR Sprite_IsBehaviorNotReady [9868]d0 0dBNE @LAB_PRG14__9877 [986a]a9 3cLDA #$3c [986c]9d ec 02STA a:CurrentSprites_BehaviorData2,X [986f]a9 00LDA #$00 [9871]9d e4 02STA a:CurrentSprites_Phases,X [9874]20 94 a8JSR Sprite_SetBehaviorReady [9877]@LAB_PRG14__9877: [9877]20 7b 86JSR BScript_Action_FacePlayerX [987a]bc e4 02LDY a:CurrentSprites_Phases,X [987d]f0 08BEQ @LAB_PRG14__9887 [987f]88DEY [9880]f0 0dBEQ @LAB_PRG14__988f [9882]88DEY [9883]f0 12BEQ @LAB_PRG14__9897 [9885]d0 18BNE @LAB_PRG14__989f [9887]@LAB_PRG14__9887: [9887]20 bf a8JSR Sprite_SetVisible [988a]a9 0bLDA #$0b [988c]4c a7 98JMP @LAB_PRG14__98a7 [988f]@LAB_PRG14__988f: [988f]20 bf a8JSR Sprite_SetVisible [9892]a9 3cLDA #$3c [9894]4c a7 98JMP @LAB_PRG14__98a7 [9897]@LAB_PRG14__9897: [9897]20 ce a8JSR Sprites_HideSprite [989a]a9 0bLDA #$0b [989c]4c a7 98JMP @LAB_PRG14__98a7 [989f]@LAB_PRG14__989f: [989f]20 bf a8JSR Sprite_SetVisible [98a2]a9 3cLDA #$3c [98a4]4c a7 98JMP @LAB_PRG14__98a7 [98a7]@LAB_PRG14__98a7: [98a7]de ec 02DEC a:CurrentSprites_BehaviorData2,X [98aa]d0 06BNE RETURN_98B2 [98ac]fe e4 02INC a:CurrentSprites_Phases,X [98af]9d ec 02STA a:CurrentSprites_BehaviorData2,X
; ; XREFS: ; SpriteBehavior_Tamazutsu ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[98b2]RETURN_98B2: [98b2]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Tamazutsu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80df] ;============================================================================
[98b3]SpriteUpdateHandler_Enemy_Tamazutsu: [98b3]bd e4 02LDA a:CurrentSprites_Phases,X [98b6]29 03AND #$03 [98b8]9d e4 02STA a:CurrentSprites_Phases,X [98bb]20 82 8cJSR CurrentSprite_UpdateFlipMask [98be]bc e4 02LDY a:CurrentSprites_Phases,X [98c1]f0 08BEQ @LAB_PRG14__98cb [98c3]88DEY [98c4]f0 16BEQ @LAB_PRG14__98dc [98c6]88DEY [98c7]f0 20BEQ @LAB_PRG14__98e9 [98c9]d0 2bBNE @LAB_PRG14__98f6 [98cb]@LAB_PRG14__98cb: [98cb]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [98ce]c9 1eCMP #$1e [98d0]b0 e0BCS RETURN_98B2 [98d2]a0 00LDY #$00 [98d4]29 08AND #$08 [98d6]f0 28BEQ @LAB_PRG14__9900 [98d8]a0 02LDY #$02 [98da]d0 24BNE @LAB_PRG14__9900 [98dc]@LAB_PRG14__98dc: [98dc]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [98df]4aLSR A [98e0]4aLSR A [98e1]a8TAY [98e2]b9 05 99LDA a:BYTE_ARRAY_PRG14__9905,Y [98e5]a8TAY [98e6]4c 00 99JMP @LAB_PRG14__9900 [98e9]@LAB_PRG14__98e9: [98e9]a0 0aLDY #$0a [98eb]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [98ee]29 08AND #$08 [98f0]f0 0eBEQ @LAB_PRG14__9900 [98f2]a0 0cLDY #$0c [98f4]d0 0aBNE @LAB_PRG14__9900 [98f6]@LAB_PRG14__98f6: [98f6]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [98f9]4aLSR A [98fa]4aLSR A [98fb]a8TAY [98fc]b9 08 99LDA a:BYTE_ARRAY_PRG14__9908,Y [98ff]a8TAY [9900]@LAB_PRG14__9900: [9900]98TYA [9901]4aLSR A [9902]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[9905]BYTE_ARRAY_PRG14__9905: [9905]08.byte $08; [0]: [9906]06.byte $06; [1]: [9907]04.byte $04; [2]:
; ; XREFS: ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[9908]BYTE_ARRAY_PRG14__9908: [9908]04.byte $04; [0]: [9909]06.byte $06; [1]: [990a]08.byte $08; [2]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Rokusutahn ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a9] ;============================================================================
[990b]SpriteUpdateHandler_Boss_Rokusutahn: [990b]ad 83 03LDA a:SpriteUpdateCounter [990e]4aLSR A [990f]4aLSR A [9910]4aLSR A [9911]4aLSR A [9912]29 03AND #$03 [9914]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document FUN_PRG14__9917 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BScript_Op_SwitchBehavior ;============================================================================
[9917]FUN_PRG14__9917: [9917]a9 00LDA #$00 [9919]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [991c]38SEC [991d]b5 c2LDA CurrentSprites_YPos,X [991f]e9 10SBC #$10 [9921]8d 7c 03STA a:Sprite12BodyPartHandler_3_ [9924]e9 10SBC #$10 [9926]8d 7d 03STA a:Sprite12BodyPartHandler_4_ [9929]e9 10SBC #$10 [992b]8d 7e 03STA a:Sprite12BodyPartHandler_5_ [992e]b5 baLDA CurrentSprites_XPos_Full,X [9930]8d 79 03STA a:Sprite12BodyPartHandler [9933]8d 7a 03STA a:Sprite12BodyPartHandler_1_ [9936]8d 7b 03STA a:Sprite12BodyPartHandler_2_ [9939]a9 00LDA #$00 [993b]9d ec 02STA a:CurrentSprites_BehaviorData2,X [993e]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9941]a9 00LDA #$00 [9943]9d e4 02STA a:CurrentSprites_Phases,X [9946]60RTS
;============================================================================ ; TODO: Document thunk_FUN_PRG14__9a3c ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused18__994a ;============================================================================
[9947]thunk_FUN_PRG14__9a3c: [9947]4c 3c 9aJMP FUN_PRG14__9a3c
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18__994a ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; CALL_FUN_PRG14__994a [$PRG14::9a2c] ;============================================================================
[994a]SpriteBehavior_EnemyUnused18__994a: [994a]bd e4 02LDA a:CurrentSprites_Phases,X [994d]c9 03CMP #$03 [994f]d0 f6BNE thunk_FUN_PRG14__9a3c [9951]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [9954]29 03AND #$03 [9956]4aLSR A [9957]b0 2aBCS @LAB_PRG14__9983 [9959]f0 14BEQ @LAB_PRG14__996f [995b]ee 7b 03INC a:Sprite12BodyPartHandler_2_ [995e]ce 7e 03DEC a:Sprite12BodyPartHandler_5_ [9961]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9964]d0 08BNE @_return [9966]a9 3cLDA #$3c [9968]9d ec 02STA a:CurrentSprites_BehaviorData2,X [996b]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [996e]@_return: [996e]60RTS [996f]@LAB_PRG14__996f: [996f]ce 7b 03DEC a:Sprite12BodyPartHandler_2_ [9972]ee 7e 03INC a:Sprite12BodyPartHandler_5_ [9975]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9978]d0 08BNE @_return1 [997a]a9 3cLDA #$3c [997c]9d ec 02STA a:CurrentSprites_BehaviorData2,X [997f]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [9982]@_return1: [9982]60RTS [9983]@LAB_PRG14__9983: [9983]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9986]d0 08BNE @_return2 [9988]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [998b]a9 08LDA #$08 [998d]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9990]@_return2: [9990]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18__9991 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; CALL_FUN_PRG14__9a2f [$PRG14::9a2f] ;============================================================================
[9991]SpriteBehavior_EnemyUnused18__9991: [9991]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9994]f0 5dBEQ Maybe_SpriteBody__99f3 [9996]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [9999]29 0fAND #$0f [999b]d0 3fBNE @LAB_PRG14__99dc [999d]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [99a0]d0 14BNE @LAB_PRG14__99b6 [99a2]b5 baLDA CurrentSprites_XPos_Full,X [99a4]4aLSR A [99a5]4aLSR A [99a6]4aLSR A [99a7]4aLSR A [99a8]85 00STA Temp_00 [99aa]b5 c2LDA CurrentSprites_YPos,X [99ac]29 f0AND #$f0 [99ae]05 00ORA Temp_00 [99b0]8d cf 03STA a:Something_UnusedSprite_ScreenBufferOffset [99b3]4c d1 99JMP @LAB_PRG14__99d1 [99b6]@LAB_PRG14__99b6: [99b6]4aLSR A [99b7]4aLSR A [99b8]4aLSR A [99b9]4aLSR A [99ba]29 03AND #$03 [99bc]a8TAY [99bd]88DEY [99be]b9 79 03LDA a:Sprite12BodyPartHandler,Y [99c1]4aLSR A [99c2]4aLSR A [99c3]4aLSR A [99c4]4aLSR A [99c5]85 00STA Temp_00 [99c7]b9 7c 03LDA a:Sprite12BodyPartHandler_3_,Y [99ca]29 f0AND #$f0 [99cc]05 00ORA Temp_00 [99ce]8d cf 03STA a:Something_UnusedSprite_ScreenBufferOffset [99d1]@LAB_PRG14__99d1: [99d1]a4 24LDY Area_CurrentArea [99d3]b9 ef 99LDA a:BYTE_ARRAY_PRG14__99ef,Y [99d6]8d ce 03STA a:Something_UnusedSprite_BlockOffset [99d9]20 b0 d7JSR SpriteBehavior_EnemyUnused18_SomethingSetBlocks [99dc]@LAB_PRG14__99dc: [99dc]ae 78 03LDX a:CurrentSpriteIndex [99df]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [99e2]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [99e5]29 c0AND #$c0 [99e7]f0 05BEQ @_return [99e9]a9 ffLDA #$ff [99eb]9d cc 02STA a:CurrentSprites_Entities,X [99ee]@_return: [99ee]60RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused18__9991 ;
[99ef]BYTE_ARRAY_PRG14__99ef: [99ef]00.byte $00; [0]: [99f0]08.byte $08; [1]: [99f1]00.byte $00; [2]: [99f2]00.byte $00; [3]:
;============================================================================ ; TODO: Document Maybe_SpriteBody__99f3 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused18__9991 ;============================================================================
[99f3]Maybe_SpriteBody__99f3: [99f3]a0 03LDY #$03 [99f5]b5 baLDA CurrentSprites_XPos_Full,X [99f7]18CLC [99f8]69 0fADC #$0f [99fa]cd 79 03CMP a:Sprite12BodyPartHandler [99fd]90 04BCC @LAB_PRG14__9a03 [99ff]ee 79 03INC a:Sprite12BodyPartHandler [9a02]88DEY [9a03]@LAB_PRG14__9a03: [9a03]b5 baLDA CurrentSprites_XPos_Full,X [9a05]18CLC [9a06]69 1fADC #$1f [9a08]cd 7a 03CMP a:Sprite12BodyPartHandler_1_ [9a0b]90 04BCC @LAB_PRG14__9a11 [9a0d]ee 7a 03INC a:Sprite12BodyPartHandler_1_ [9a10]88DEY [9a11]@LAB_PRG14__9a11: [9a11]b5 baLDA CurrentSprites_XPos_Full,X [9a13]18CLC [9a14]69 2fADC #$2f [9a16]cd 7b 03CMP a:Sprite12BodyPartHandler_2_ [9a19]90 04BCC @LAB_PRG14__9a1f [9a1b]ee 7b 03INC a:Sprite12BodyPartHandler_2_ [9a1e]88DEY [9a1f]@LAB_PRG14__9a1f: [9a1f]c0 03CPY #$03 [9a21]d0 08BNE @LAB_PRG14__9a2b [9a23]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9a26]a9 00LDA #$00 [9a28]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [9a2b]@LAB_PRG14__9a2b: [9a2b]60RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused18 ;
[9a2c]CALL_FUN_PRG14__994a: [9a2c]4c 4a 99JMP SpriteBehavior_EnemyUnused18__994a
; ; XREFS: ; SpriteBehavior_EnemyUnused18 ;
[9a2f]CALL_FUN_PRG14__9a2f: [9a2f]4c 91 99JMP SpriteBehavior_EnemyUnused18__9991
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18 ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f3] ;============================================================================
[9a32]SpriteBehavior_EnemyUnused18: [9a32]bc e4 02LDY a:CurrentSprites_Phases,X [9a35]30 f8BMI CALL_FUN_PRG14__9a2f [9a37]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9a3a]d0 f0BNE CALL_FUN_PRG14__994a
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document FUN_PRG14__9a3c ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; thunk_FUN_PRG14__9a3c ;============================================================================
[9a3c]FUN_PRG14__9a3c: [9a3c]bd e4 02LDA a:CurrentSprites_Phases,X [9a3f]29 03AND #$03 [9a41]9d e4 02STA a:CurrentSprites_Phases,X [9a44]0aASL A [9a45]a8TAY [9a46]b9 50 9aLDA a:MAYBE_BODY_HANDLERS+1,Y [9a49]48PHA [9a4a]b9 4f 9aLDA a:MAYBE_BODY_HANDLERS,Y [9a4d]48PHA [9a4e]60RTS
; ; XREFS: ; FUN_PRG14__9a3c ;
[9a4f]MAYBE_BODY_HANDLERS: [9a4f]56 9apointer Maybe_BodyHandler__9a57-1; [0]: [9a51]79 9apointer Maybe_BodyHandler__9a7a-1; [1]: [9a53]79 9apointer Maybe_BodyHandler__9a7a-1; [2]: [9a55]56 9apointer Maybe_BodyHandler__9a57-1; [3]:
;============================================================================ ; TODO: Document Maybe_BodyHandler__9a57 ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; MAYBE_BODY_HANDLERS [$PRG14::9a4f] ; MAYBE_BODY_HANDLERS [$PRG14::9a55] ;============================================================================
[9a57]Maybe_BodyHandler__9a57: [9a57]20 87 9aJSR FUN_PRG14__9a87 [9a5a]be 91 9aLDX a:BYTE_ARRAY_PRG14__9a91,Y [9a5d]caDEX [9a5e]fe 79 03INC a:Sprite12BodyPartHandler,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document FUN_PRG14__9a61 ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Maybe_BodyHandler__9a7a ;============================================================================
[9a61]FUN_PRG14__9a61: [9a61]ae 78 03LDX a:CurrentSpriteIndex [9a64]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9a67]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9a6a]c9 40CMP #$40 [9a6c]90 0bBCC @_return [9a6e]fe e4 02INC a:CurrentSprites_Phases,X [9a71]a9 00LDA #$00 [9a73]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9a76]4c a1 9aJMP FUN_PRG14__9aa1 [9a79]@_return: [9a79]60RTS
;============================================================================ ; TODO: Document Maybe_BodyHandler__9a7a ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; MAYBE_BODY_HANDLERS [$PRG14::9a51] ; MAYBE_BODY_HANDLERS [$PRG14::9a53] ;============================================================================
[9a7a]Maybe_BodyHandler__9a7a: [9a7a]20 87 9aJSR FUN_PRG14__9a87 [9a7d]be 99 9aLDX a:BYTE_ARRAY_PRG14__9a99,Y [9a80]caDEX [9a81]de 79 03DEC a:Sprite12BodyPartHandler,X [9a84]4c 61 9aJMP FUN_PRG14__9a61
;============================================================================ ; TODO: Document FUN_PRG14__9a87 ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; Maybe_BodyHandler__9a57 ; Maybe_BodyHandler__9a7a ;============================================================================
[9a87]FUN_PRG14__9a87: [9a87]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9a8a]4aLSR A [9a8b]4aLSR A [9a8c]4aLSR A [9a8d]29 07AND #$07 [9a8f]a8TAY [9a90]60RTS
; ; XREFS: ; Maybe_BodyHandler__9a57 ;
[9a91]BYTE_ARRAY_PRG14__9a91: [9a91]00.byte $00; [0]: [9a92]01.byte $01; [1]: [9a93]02.byte $02; [2]: [9a94]03.byte $03; [3]: [9a95]02.byte $02; [4]: [9a96]03.byte $03; [5]: [9a97]03.byte $03; [6]: [9a98]00.byte $00; [7]:
; ; XREFS: ; Maybe_BodyHandler__9a7a ;
[9a99]BYTE_ARRAY_PRG14__9a99: [9a99]00.byte $00; [0]: [9a9a]03.byte $03; [1]: [9a9b]03.byte $03; [2]: [9a9c]02.byte $02; [3]: [9a9d]03.byte $03; [4]: [9a9e]02.byte $02; [5]: [9a9f]01.byte $01; [6]: [9aa0]00.byte $00; [7]:
;============================================================================ ; TODO: Document FUN_PRG14__9aa1 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9a61 ;============================================================================
[9aa1]FUN_PRG14__9aa1: [9aa1]b5 baLDA CurrentSprites_XPos_Full,X [9aa3]38SEC [9aa4]e5 9eSBC Player_PosX_Block [9aa6]b0 04BCS @LAB_PRG14__9aac [9aa8]49 ffEOR #$ff [9aaa]69 01ADC #$01 [9aac]@LAB_PRG14__9aac: [9aac]c9 40CMP #$40 [9aae]b0 10BCS @LAB_PRG14__9ac0 [9ab0]a9 01LDA #$01 [9ab2]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9ab5]a9 00LDA #$00 [9ab7]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [9aba]a9 08LDA #$08 [9abc]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9abf]60RTS [9ac0]@LAB_PRG14__9ac0: [9ac0]a9 00LDA #$00 [9ac2]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9ac5]60RTS
;============================================================================ ; TODO: Document FUN_PRG14__9ac6 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[9ac6]FUN_PRG14__9ac6: [9ac6]a9 80LDA #$80 [9ac8]9d e4 02STA a:CurrentSprites_Phases,X [9acb]a9 00LDA #$00 [9acd]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9ad0]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9ad3]b5 c2LDA CurrentSprites_YPos,X [9ad5]38SEC [9ad6]e9 30SBC #$30 [9ad8]8d 7e 03STA a:Sprite12BodyPartHandler_5_ [9adb]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ab] ;============================================================================
[9adc]SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart: [9adc]20 82 8cJSR CurrentSprite_UpdateFlipMask [9adf]a9 04LDA #$04 [9ae1]20 8e 8cJSR Sprite_EnterNextAppearancePhase [9ae4]ae 78 03LDX a:CurrentSpriteIndex [9ae7]ad 79 03LDA a:Sprite12BodyPartHandler [9aea]85 27STA Arg_DrawSprite_PosX [9aec]ad 7c 03LDA a:Sprite12BodyPartHandler_3_ [9aef]85 28STA Arg_DrawSprite_PosY [9af1]bd 2c 03LDA a:CurrentSprites_PPUOffsets,X [9af4]85 33STA Sprites_PPUOffset [9af6]a9 04LDA #$04 [9af8]20 8e 8cJSR Sprite_EnterNextAppearancePhase [9afb]ae 78 03LDX a:CurrentSpriteIndex [9afe]ad 7a 03LDA a:Sprite12BodyPartHandler_1_ [9b01]85 27STA Arg_DrawSprite_PosX [9b03]ad 7d 03LDA a:Sprite12BodyPartHandler_4_ [9b06]85 28STA Arg_DrawSprite_PosY [9b08]bd 2c 03LDA a:CurrentSprites_PPUOffsets,X [9b0b]85 33STA Sprites_PPUOffset [9b0d]a9 04LDA #$04 [9b0f]20 8e 8cJSR Sprite_EnterNextAppearancePhase [9b12]ae 78 03LDX a:CurrentSpriteIndex [9b15]ad 7b 03LDA a:Sprite12BodyPartHandler_2_ [9b18]85 27STA Arg_DrawSprite_PosX [9b1a]ad 7e 03LDA a:Sprite12BodyPartHandler_5_ [9b1d]85 28STA Arg_DrawSprite_PosY [9b1f]bd 2c 03LDA a:CurrentSprites_PPUOffsets,X [9b22]85 33STA Sprites_PPUOffset [9b24]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9b27]d0 0dBNE @LAB_PRG14__9b36 [9b29]a0 02LDY #$02 [9b2b]ad 83 03LDA a:SpriteUpdateCounter [9b2e]29 08AND #$08 [9b30]f0 0fBEQ @LAB_PRG14__9b41 [9b32]a0 03LDY #$03 [9b34]d0 0bBNE @LAB_PRG14__9b41 [9b36]@LAB_PRG14__9b36: [9b36]a0 00LDY #$00 [9b38]ad 83 03LDA a:SpriteUpdateCounter [9b3b]29 08AND #$08 [9b3d]f0 02BEQ @LAB_PRG14__9b41 [9b3f]a0 01LDY #$01 [9b41]@LAB_PRG14__9b41: [9b41]98TYA [9b42]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ripasheiku ;============================================================================
[9b45]SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos: [9b45]ad 83 03LDA a:SpriteUpdateCounter [9b48]29 3fAND #$3f [9b4a]c9 20CMP #$20 [9b4c]d0 1aBNE @LAB_PRG14__9b68 [9b4e]bd dc 02LDA a:CurrentSprites_Flags,X [9b51]29 01AND #$01 [9b53]a8TAY [9b54]b5 baLDA CurrentSprites_XPos_Full,X [9b56]18CLC [9b57]79 81 9bADC a:BYTE_ARRAY_PRG14__9b81,Y [9b5a]8d 84 03STA a:CurrentSprite_Arg_CastMagicX [9b5d]b5 c2LDA CurrentSprites_YPos,X [9b5f]18CLC [9b60]69 20ADC #$20 [9b62]8d 85 03STA a:CurrentSprite_Arg_CastMagicY [9b65]20 f6 a0JSR Sprite_CastMagic [9b68]@LAB_PRG14__9b68: [9b68]20 7b 86JSR BScript_Action_FacePlayerX [9b6b]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9b6e]d0 10BNE @_return [9b70]a9 01LDA #$01 [9b72]9d e4 02STA a:CurrentSprites_Phases,X [9b75]a9 00LDA #$00 [9b77]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9b7a]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9b7d]20 7b 86JSR BScript_Action_FacePlayerX [9b80]@_return: [9b80]60RTS
; ; XREFS: ; SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ;
[9b81]BYTE_ARRAY_PRG14__9b81: [9b81]10.byte $10; [0]: [9b82]00.byte $00; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_Ripasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5fb] ;============================================================================
[9b83]SpriteBehavior_Ripasheiku: [9b83]ad 85 a8LDA a:Sprite_IsBehaviorNotReady [9b86]d0 12BNE @LAB_PRG14__9b9a [9b88]a9 03LDA #$03 [9b8a]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9b8d]a9 1eLDA #$1e [9b8f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9b92]a9 00LDA #$00 [9b94]9d e4 02STA a:CurrentSprites_Phases,X [9b97]20 94 a8JSR Sprite_SetBehaviorReady [9b9a]@LAB_PRG14__9b9a: [9b9a]bc e4 02LDY a:CurrentSprites_Phases,X [9b9d]f0 09BEQ @LAB_PRG14__9ba8 [9b9f]88DEY [9ba0]f0 1aBEQ @LAB_PRG14__9bbc [9ba2]88DEY [9ba3]d0 a0BNE SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos [9ba5]4c 0e 9cJMP @LAB_PRG14__9c0e [9ba8]@LAB_PRG14__9ba8: [9ba8]20 7b 86JSR BScript_Action_FacePlayerX [9bab]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9bae]d0 0bBNE @_return [9bb0]fe e4 02INC a:CurrentSprites_Phases,X [9bb3]a9 00LDA #$00 [9bb5]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9bb8]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9bbb]@_return: [9bbb]60RTS [9bbc]@LAB_PRG14__9bbc: [9bbc]20 43 9cJSR Sprite_MoveHorizOneBlockOrTurnAround [9bbf]bd dc 02LDA a:CurrentSprites_Flags,X [9bc2]29 7fAND #$7f [9bc4]9d dc 02STA a:CurrentSprites_Flags,X [9bc7]b5 c2LDA CurrentSprites_YPos,X [9bc9]c9 30CMP #$30 [9bcb]90 31BCC @LAB_PRG14__9bfe [9bcd]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9bd0]10 0cBPL @LAB_PRG14__9bde [9bd2]a9 04LDA #$04 [9bd4]8d 77 03STA a:Arg_DeltaY_Full [9bd7]a9 00LDA #$00 [9bd9]8d 76 03STA a:Arg_DeltaY_Frac [9bdc]f0 0aBEQ @LAB_PRG14__9be8 [9bde]@LAB_PRG14__9bde: [9bde]a0 03LDY #$03 [9be0]20 e1 83JSR Sprites_CalcYFromGravity [9be3]a0 05LDY #$05 [9be5]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9be8]@LAB_PRG14__9be8: [9be8]20 c4 85JSR Sprite_MoveVertical [9beb]b0 10BCS @_return2 [9bed]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9bf0]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9bf3]29 1fAND #$1f [9bf5]d0 05BNE @_return1 [9bf7]a9 ffLDA #$ff [9bf9]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9bfc]@_return1: [9bfc]60RTS [9bfd]@_return2: [9bfd]60RTS [9bfe]@LAB_PRG14__9bfe: [9bfe]a9 00LDA #$00 [9c00]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9c03]a9 ffLDA #$ff [9c05]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9c08]fe e4 02INC a:CurrentSprites_Phases,X [9c0b]4c 7b 86JMP BScript_Action_FacePlayerX [9c0e]@LAB_PRG14__9c0e: [9c0e]20 43 9cJSR Sprite_MoveHorizOneBlockOrTurnAround [9c11]bd dc 02LDA a:CurrentSprites_Flags,X [9c14]09 80ORA #$80 [9c16]9d dc 02STA a:CurrentSprites_Flags,X [9c19]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9c1c]a0 02LDY #$02 [9c1e]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9c21]20 c4 85JSR Sprite_MoveVertical [9c24]b0 0bBCS @LAB_PRG14__9c31 [9c26]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9c29]38SEC [9c2a]e9 04SBC #$04 [9c2c]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9c2f]b0 11BCS @_return3 [9c31]@LAB_PRG14__9c31: [9c31]fe e4 02INC a:CurrentSprites_Phases,X [9c34]a9 00LDA #$00 [9c36]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9c39]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9c3c]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [9c3f]20 7b 86JSR BScript_Action_FacePlayerX [9c42]@_return3: [9c42]60RTS
;============================================================================ ; TODO: Document Sprite_MoveHorizOneBlockOrTurnAround ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ripasheiku ;============================================================================
[9c43]Sprite_MoveHorizOneBlockOrTurnAround: [9c43]a9 01LDA #$01 [9c45]8d 75 03STA a:Arg_DeltaX_Full [9c48]a9 00LDA #$00 [9c4a]8d 74 03STA a:Arg_DeltaX_Frac [9c4d]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9c50]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Ripasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e1] ;============================================================================
[9c51]SpriteUpdateHandler_Boss_Ripasheiku: [9c51]20 82 8cJSR CurrentSprite_UpdateFlipMask [9c54]a0 00LDY #$00 [9c56]bd e4 02LDA a:CurrentSprites_Phases,X [9c59]f0 0fBEQ @LAB_PRG14__9c6a [9c5b]c9 03CMP #$03 [9c5d]f0 0fBEQ @LAB_PRG14__9c6e [9c5f]a0 01LDY #$01 [9c61]ad 83 03LDA a:SpriteUpdateCounter [9c64]29 08AND #$08 [9c66]f0 02BEQ @LAB_PRG14__9c6a [9c68]a0 02LDY #$02 [9c6a]@LAB_PRG14__9c6a: [9c6a]98TYA [9c6b]4c 8e 8cJMP Sprite_EnterNextAppearancePhase [9c6e]@LAB_PRG14__9c6e: [9c6e]a0 01LDY #$01 [9c70]ad 83 03LDA a:SpriteUpdateCounter [9c73]29 20AND #$20 [9c75]f0 f3BEQ @LAB_PRG14__9c6a [9c77]a0 03LDY #$03 [9c79]d0 efBNE @LAB_PRG14__9c6a
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Zoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e3] ;============================================================================
[9c7b]SpriteUpdateHandler_Boss_Zoradohna: [9c7b]20 82 8cJSR CurrentSprite_UpdateFlipMask [9c7e]ad 83 03LDA a:SpriteUpdateCounter [9c81]4aLSR A [9c82]4aLSR A [9c83]4aLSR A [9c84]29 03AND #$03 [9c86]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Borabohra ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ff] ;============================================================================
[9c89]SpriteBehavior_Borabohra: [9c89]20 85 a8JSR Sprite_IsBehaviorNotReady [9c8c]d0 10BNE @LAB_PRG14__9c9e [9c8e]a9 02LDA #$02 [9c90]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9c93]a9 00LDA #$00 [9c95]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9c98]9d e4 02STA a:CurrentSprites_Phases,X [9c9b]20 94 a8JSR Sprite_SetBehaviorReady [9c9e]@LAB_PRG14__9c9e: [9c9e]bd e4 02LDA a:CurrentSprites_Phases,X [9ca1]4aLSR A [9ca2]b0 11BCS @LAB_PRG14__9cb5 [9ca4]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9ca7]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9caa]c9 14CMP #$14 [9cac]90 06BCC @_return1 [9cae]fe e4 02INC a:CurrentSprites_Phases,X [9cb1]20 7b 86JSR BScript_Action_FacePlayerX [9cb4]@_return1: [9cb4]60RTS [9cb5]@LAB_PRG14__9cb5: [9cb5]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9cb8]a0 02LDY #$02 [9cba]20 e1 83JSR Sprites_CalcYFromGravity [9cbd]a0 02LDY #$02 [9cbf]20 c1 83JSR Sprites_CalcHorizSpriteMovement [9cc2]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [9cc5]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9cc8]29 7fAND #$7f [9cca]d0 03BNE @_return2 [9ccc]20 7b 86JSR BScript_Action_FacePlayerX [9ccf]@_return2: [9ccf]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Borabohra ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e5] ;============================================================================
[9cd0]SpriteUpdateHandler_Boss_Borabohra: [9cd0]20 82 8cJSR CurrentSprite_UpdateFlipMask [9cd3]bd e4 02LDA a:CurrentSprites_Phases,X [9cd6]4aLSR A [9cd7]b0 09BCS @LAB_PRG14__9ce2 [9cd9]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9cdc]4aLSR A [9cdd]4aLSR A [9cde]a8TAY [9cdf]4c ed 9cJMP @LAB_PRG14__9ced [9ce2]@LAB_PRG14__9ce2: [9ce2]ad 83 03LDA a:SpriteUpdateCounter [9ce5]4aLSR A [9ce6]4aLSR A [9ce7]29 06AND #$06 [9ce9]18CLC [9cea]69 08ADC #$08 [9cec]a8TAY [9ced]@LAB_PRG14__9ced: [9ced]98TYA [9cee]4aLSR A [9cef]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Pakukame ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a601] ;============================================================================
[9cf2]SpriteBehavior_Pakukame: [9cf2]20 85 a8JSR Sprite_IsBehaviorNotReady [9cf5]d0 10BNE @LAB_PRG14__9d07 [9cf7]a9 00LDA #$00 [9cf9]9d e4 02STA a:CurrentSprites_Phases,X [9cfc]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9cff]a9 04LDA #$04 [9d01]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9d04]20 94 a8JSR Sprite_SetBehaviorReady [9d07]@LAB_PRG14__9d07: [9d07]bd e4 02LDA a:CurrentSprites_Phases,X [9d0a]c9 01CMP #$01 [9d0c]b0 1dBCS @LAB_PRG14__9d2b [9d0e]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9d11]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9d14]c9 40CMP #$40 [9d16]90 12BCC @_return1 [9d18]20 36 a2JSR Sprites_HasMaxOnScreen [9d1b]b0 0dBCS @_return1 [9d1d]20 78 9dJSR SpriteBehavior_Pakukame__9d78 [9d20]b0 08BCS @_return1 [9d22]fe e4 02INC a:CurrentSprites_Phases,X [9d25]a9 12LDA #$12 [9d27]20 e4 d0JSR Sound_PlayEffect [9d2a]@_return1: [9d2a]60RTS [9d2b]@LAB_PRG14__9d2b: [9d2b]ad 83 03LDA a:SpriteUpdateCounter [9d2e]29 07AND #$07 [9d30]d0 12BNE @_return2 [9d32]fe e4 02INC a:CurrentSprites_Phases,X [9d35]bd e4 02LDA a:CurrentSprites_Phases,X [9d38]c9 05CMP #$05 [9d3a]90 09BCC @LAB_PRG14__9d45 [9d3c]a9 00LDA #$00 [9d3e]9d e4 02STA a:CurrentSprites_Phases,X [9d41]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9d44]@_return2: [9d44]60RTS [9d45]@LAB_PRG14__9d45: [9d45]c9 03CMP #$03 [9d47]d0 fbBNE @_return2 [9d49]20 36 a2JSR Sprites_HasMaxOnScreen [9d4c]b0 f6BCS @_return2 [9d4e]b5 c2LDA CurrentSprites_YPos,X [9d50]69 10ADC #$10 [9d52]99 c2 00STA a:CurrentSprites_YPos,Y [9d55]b5 baLDA CurrentSprites_XPos_Full,X [9d57]69 08ADC #$08 [9d59]99 ba 00STA a:CurrentSprites_XPos_Full,Y [9d5c]a9 9eLDA #$9e [9d5e]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [9d61]a9 00LDA #$00 [9d63]99 dc 02STA a:CurrentSprites_Flags,Y [9d66]a9 09LDA #$09 [9d68]99 cc 02STA a:CurrentSprites_Entities,Y [9d6b]aaTAX [9d6c]bd a9 b5LDA a:SPRITE_ENTITIES_HP,X [9d6f]99 44 03STA a:CurrentSprites_HP,Y [9d72]ae 78 03LDX a:CurrentSpriteIndex [9d75]4c 02 a2JMP Sprite_Maybe_ResetState
;============================================================================ ; TODO: Document SpriteBehavior_Pakukame__9d78 ; ; INPUTS: ; None. ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_Pakukame ;============================================================================
[9d78]SpriteBehavior_Pakukame__9d78: [9d78]a0 07LDY #$07 [9d7a]a9 00LDA #$00 [9d7c]85 00STA Temp_00 [9d7e]@LAB_PRG14__9d7e: [9d7e]b9 cc 02LDA a:CurrentSprites_Entities,Y [9d81]c9 09CMP #$09 [9d83]d0 0aBNE @LAB_PRG14__9d8f [9d85]e6 00INC Temp_00 [9d87]a5 00LDA Temp_00 [9d89]c9 03CMP #$03 [9d8b]90 02BCC @LAB_PRG14__9d8f [9d8d]38SEC [9d8e]60RTS [9d8f]@LAB_PRG14__9d8f: [9d8f]88DEY [9d90]10 ecBPL @LAB_PRG14__9d7e [9d92]18CLC [9d93]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Pakukame ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e7] ;============================================================================
[9d94]SpriteUpdateHandler_Boss_Pakukame: [9d94]a0 00LDY #$00 [9d96]bd e4 02LDA a:CurrentSprites_Phases,X [9d99]f0 04BEQ @LAB_PRG14__9d9f [9d9b]bc e4 02LDY a:CurrentSprites_Phases,X [9d9e]88DEY [9d9f]@LAB_PRG14__9d9f: [9d9f]b9 a5 9dLDA a:BYTE_ARRAY_PRG14__9da5,Y [9da2]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_Pakukame ;
[9da5]BYTE_ARRAY_PRG14__9da5: [9da5]00.byte $00; [0]: [9da6]01.byte $01; [1]: [9da7]02.byte $02; [2]: [9da8]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a603] ;============================================================================
[9da9]SpriteBehavior_Zorugeriru: [9da9]20 85 a8JSR Sprite_IsBehaviorNotReady [9dac]d0 10BNE @LAB_PRG14__9dbe [9dae]a9 04LDA #$04 [9db0]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9db3]a9 00LDA #$00 [9db5]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9db8]9d e4 02STA a:CurrentSprites_Phases,X [9dbb]20 94 a8JSR Sprite_SetBehaviorReady [9dbe]@LAB_PRG14__9dbe: [9dbe]bd e4 02LDA a:CurrentSprites_Phases,X [9dc1]4aLSR A [9dc2]b0 1dBCS @LAB_PRG14__9de1 [9dc4]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9dc7]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9dca]29 0fAND #$0f [9dcc]d0 12BNE @_return1 [9dce]20 36 a2JSR Sprites_HasMaxOnScreen [9dd1]b0 0dBCS @_return1 [9dd3]20 f7 9dJSR SpriteBehavior_Zorugeriru__9df7 [9dd6]b0 08BCS @_return1 [9dd8]fe e4 02INC a:CurrentSprites_Phases,X [9ddb]a9 00LDA #$00 [9ddd]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9de0]@_return1: [9de0]60RTS [9de1]@LAB_PRG14__9de1: [9de1]fe ec 02INC a:CurrentSprites_BehaviorData2,X [9de4]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9de7]c9 20CMP #$20 [9de9]90 0bBCC @_return2 [9deb]fe e4 02INC a:CurrentSprites_Phases,X [9dee]a9 3cLDA #$3c [9df0]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9df3]4c 13 9eJMP SpriteBehavior_Zorugeriru__9e13 [9df6]@_return2: [9df6]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru__9df7 ; ; INPUTS: ; None. ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_Zorugeriru ;============================================================================
[9df7]SpriteBehavior_Zorugeriru__9df7: [9df7]a0 07LDY #$07 [9df9]a9 00LDA #$00 [9dfb]85 00STA Temp_00 [9dfd]@LAB_PRG14__9dfd: [9dfd]b9 cc 02LDA a:CurrentSprites_Entities,Y [9e00]c9 03CMP #$03 [9e02]d0 0aBNE @LAB_PRG14__9e0e [9e04]e6 00INC Temp_00 [9e06]a5 00LDA Temp_00 [9e08]c9 04CMP #$04 [9e0a]90 02BCC @LAB_PRG14__9e0e [9e0c]38SEC [9e0d]60RTS [9e0e]@LAB_PRG14__9e0e: [9e0e]88DEY [9e0f]10 ecBPL @LAB_PRG14__9dfd [9e11]18CLC
; ; XREFS: ; SpriteBehavior_Zorugeriru__9e13 ;
[9e12]RETURN_9E12: [9e12]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru__9e13 ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Zorugeriru ;============================================================================
[9e13]SpriteBehavior_Zorugeriru__9e13: [9e13]20 36 a2JSR Sprites_HasMaxOnScreen [9e16]b0 faBCS RETURN_9E12 [9e18]a9 03LDA #$03 [9e1a]99 cc 02STA a:CurrentSprites_Entities,Y [9e1d]a9 00LDA #$00 [9e1f]99 e4 02STA a:CurrentSprites_Phases,Y [9e22]99 dc 02STA a:CurrentSprites_Flags,Y [9e25]a9 ffLDA #$ff [9e27]99 34 03STA a:CurrentSprites_HitByMagicBehavior,Y [9e2a]b5 baLDA CurrentSprites_XPos_Full,X [9e2c]18CLC [9e2d]69 10ADC #$10 [9e2f]85 00STA Temp_00 [9e31]a5 9eLDA Player_PosX_Block [9e33]d5 baCMP CurrentSprites_XPos_Full,X [9e35]90 07BCC @LAB_PRG14__9e3e [9e37]c5 00CMP Temp_00 [9e39]b0 03BCS @LAB_PRG14__9e3e [9e3b]38SEC [9e3c]e9 10SBC #$10 [9e3e]@LAB_PRG14__9e3e: [9e3e]99 ba 00STA a:CurrentSprites_XPos_Full,Y [9e41]a9 20LDA #$20 [9e43]99 c2 00STA a:CurrentSprites_YPos,Y [9e46]bd 2c 03LDA a:CurrentSprites_PPUOffsets,X [9e49]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [9e4c]4c 02 a2JMP Sprite_Maybe_ResetState
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Zorugeriru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e9] ;============================================================================
[9e4f]SpriteUpdateHandler_Boss_Zorugeriru: [9e4f]20 82 8cJSR CurrentSprite_UpdateFlipMask [9e52]a0 00LDY #$00 [9e54]bd e4 02LDA a:CurrentSprites_Phases,X [9e57]4aLSR A [9e58]90 09BCC @LAB_PRG14__9e63 [9e5a]ad 83 03LDA a:SpriteUpdateCounter [9e5d]4aLSR A [9e5e]4aLSR A [9e5f]4aLSR A [9e60]29 03AND #$03 [9e62]a8TAY [9e63]@LAB_PRG14__9e63: [9e63]b9 69 9eLDA a:BYTE_ARRAY_PRG14__9e69,Y [9e66]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_Zorugeriru ;
[9e69]BYTE_ARRAY_PRG14__9e69: [9e69]00.byte $00; [0]: [9e6a]01.byte $01; [1]: [9e6b]02.byte $02; [2]: [9e6c]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_Garbled3 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ed] ;============================================================================
[9e6d]SpriteBehavior_Garbled3: [9e6d]20 85 a8JSR Sprite_IsBehaviorNotReady [9e70]d0 10BNE @LAB_PRG14__9e82 [9e72]a9 00LDA #$00 [9e74]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9e77]a9 00LDA #$00 [9e79]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9e7c]9d e4 02STA a:CurrentSprites_Phases,X [9e7f]20 94 a8JSR Sprite_SetBehaviorReady [9e82]@LAB_PRG14__9e82: [9e82]bc e4 02LDY a:CurrentSprites_Phases,X [9e85]88DEY [9e86]f0 34BEQ @LAB_PRG14__9ebc [9e88]88DEY [9e89]f0 4eBEQ @LAB_PRG14__9ed9 [9e8b]bd dc 02LDA a:CurrentSprites_Flags,X [9e8e]09 80ORA #$80 [9e90]9d dc 02STA a:CurrentSprites_Flags,X [9e93]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9e96]a0 05LDY #$05 [9e98]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9e9b]20 c4 85JSR Sprite_MoveVertical [9e9e]b0 0eBCS @LAB_PRG14__9eae [9ea0]fe f4 02INC a:CurrentSprites_BehaviorData3,X [9ea3]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9ea6]c9 41CMP #$41 [9ea8]90 11BCC @_return1 [9eaa]de f4 02DEC a:CurrentSprites_BehaviorData3,X [9ead]60RTS [9eae]@LAB_PRG14__9eae: [9eae]fe e4 02INC a:CurrentSprites_Phases,X [9eb1]a9 05LDA #$05 [9eb3]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9eb6]a9 07LDA #$07 [9eb8]20 e4 d0JSR Sound_PlayEffect [9ebb]@_return1: [9ebb]60RTS [9ebc]@LAB_PRG14__9ebc: [9ebc]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9ebf]29 01AND #$01 [9ec1]0aASL A [9ec2]0aASL A [9ec3]38SEC [9ec4]e9 02SBC #$02 [9ec6]18CLC [9ec7]75 c2ADC CurrentSprites_YPos,X [9ec9]95 c2STA CurrentSprites_YPos,X [9ecb]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9ece]d0 08BNE @_return2 [9ed0]a9 0fLDA #$0f [9ed2]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9ed5]fe e4 02INC a:CurrentSprites_Phases,X [9ed8]@_return2: [9ed8]60RTS [9ed9]@LAB_PRG14__9ed9: [9ed9]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9edc]d0 05BNE @_return3 [9ede]a9 ffLDA #$ff [9ee0]9d cc 02STA a:CurrentSprites_Entities,X [9ee3]@_return3: [9ee3]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Garbled03 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808d] ;============================================================================
[9ee4]SpriteUpdateHandler_Garbled03: [9ee4]20 82 8cJSR CurrentSprite_UpdateFlipMask [9ee7]a0 03LDY #$03 [9ee9]bd e4 02LDA a:CurrentSprites_Phases,X [9eec]c9 02CMP #$02 [9eee]90 0fBCC @LAB_PRG14__9eff [9ef0]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [9ef3]c9 0aCMP #$0a [9ef5]b0 08BCS @LAB_PRG14__9eff [9ef7]a0 03LDY #$03 [9ef9]c9 05CMP #$05 [9efb]b0 02BCS @LAB_PRG14__9eff [9efd]a0 05LDY #$05 [9eff]@LAB_PRG14__9eff: [9eff]98TYA [9f00]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a605] ;============================================================================
[9f03]SpriteBehavior_KingGrieve: [9f03]20 85 a8JSR Sprite_IsBehaviorNotReady [9f06]d0 15BNE @LAB_PRG14__9f1d [9f08]a9 05LDA #$05 [9f0a]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9f0d]a9 ffLDA #$ff [9f0f]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9f12]a9 00LDA #$00 [9f14]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9f17]9d e4 02STA a:CurrentSprites_Phases,X [9f1a]20 94 a8JSR Sprite_SetBehaviorReady [9f1d]@LAB_PRG14__9f1d: [9f1d]bd e4 02LDA a:CurrentSprites_Phases,X [9f20]29 03AND #$03 [9f22]a8TAY [9f23]f0 09BEQ @LAB_PRG14__9f2e [9f25]88DEY [9f26]f0 3dBEQ SpriteBehavior_KingGrieve_9f65 [9f28]88DEY [9f29]f0 73BEQ SpriteBehavior_KingGrieve_MoveDown [9f2b]4c 86 9fJMP SpriteBehavior_KingGrieve_9f86 [9f2e]@LAB_PRG14__9f2e: [9f2e]a9 01LDA #$01 [9f30]8d 75 03STA a:Arg_DeltaX_Full [9f33]a9 00LDA #$00 [9f35]8d 74 03STA a:Arg_DeltaX_Frac [9f38]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [9f3b]bd dc 02LDA a:CurrentSprites_Flags,X [9f3e]09 80ORA #$80 [9f40]9d dc 02STA a:CurrentSprites_Flags,X [9f43]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9f46]a0 02LDY #$02 [9f48]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [9f4b]20 c4 85JSR Sprite_MoveVertical [9f4e]b0 0cBCS @LAB_PRG14__9f5c [9f50]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [9f53]38SEC [9f54]e9 02SBC #$02 [9f56]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9f59]90 01BCC @LAB_PRG14__9f5c [9f5b]60RTS [9f5c]@LAB_PRG14__9f5c: [9f5c]fe e4 02INC a:CurrentSprites_Phases,X [9f5f]a9 3cLDA #$3c [9f61]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9f64]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve_9f65 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve ;============================================================================
[9f65]SpriteBehavior_KingGrieve_9f65: [9f65]ad 83 03LDA a:SpriteUpdateCounter [9f68]29 0fAND #$0f [9f6a]d0 1aBNE SpriteBehavior_KingGrieve_9f86 [9f6c]bd dc 02LDA a:CurrentSprites_Flags,X [9f6f]29 01AND #$01 [9f71]a8TAY [9f72]b5 baLDA CurrentSprites_XPos_Full,X [9f74]18CLC [9f75]79 9c 9fADC a:BYTE_ARRAY_PRG14__9f9c,Y [9f78]8d 84 03STA a:CurrentSprite_Arg_CastMagicX [9f7b]b5 c2LDA CurrentSprites_YPos,X [9f7d]18CLC [9f7e]69 04ADC #$04 [9f80]8d 85 03STA a:CurrentSprite_Arg_CastMagicY [9f83]20 f6 a0JSR Sprite_CastMagic
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve_9f86 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve ; SpriteBehavior_KingGrieve_9f65 ;============================================================================
[9f86]SpriteBehavior_KingGrieve_9f86: [9f86]20 7b 86JSR BScript_Action_FacePlayerX [9f89]de ec 02DEC a:CurrentSprites_BehaviorData2,X [9f8c]d0 0dBNE @LAB_PRG14__9f9b [9f8e]fe e4 02INC a:CurrentSprites_Phases,X [9f91]a9 ffLDA #$ff [9f93]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9f96]a9 00LDA #$00 [9f98]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9f9b]@LAB_PRG14__9f9b: [9f9b]60RTS
; ; XREFS: ; SpriteBehavior_KingGrieve_9f65 ;
[9f9c]BYTE_ARRAY_PRG14__9f9c: [9f9c]00.byte $00; [0]: [9f9d]30.byte $30; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve_MoveDown ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve ;============================================================================
[9f9e]SpriteBehavior_KingGrieve_MoveDown: [9f9e]bd dc 02LDA a:CurrentSprites_Flags,X [9fa1]29 7fAND #$7f [9fa3]9d dc 02STA a:CurrentSprites_Flags,X [9fa6]a9 00LDA #$00 [9fa8]8d 76 03STA a:Arg_DeltaY_Frac [9fab]a9 01LDA #$01 [9fad]8d 77 03STA a:Arg_DeltaY_Full [9fb0]20 c4 85JSR Sprite_MoveVertical [9fb3]b0 06BCS @LAB_PRG14__9fbb [9fb5]b5 c2LDA CurrentSprites_YPos,X [9fb7]c9 10CMP #$10 [9fb9]b0 08BCS @LAB_PRG14__9fc3 [9fbb]@LAB_PRG14__9fbb: [9fbb]fe e4 02INC a:CurrentSprites_Phases,X [9fbe]a9 1eLDA #$1e [9fc0]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9fc3]@LAB_PRG14__9fc3: [9fc3]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_KingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80eb] ;============================================================================
[9fc4]SpriteUpdateHandler_Boss_KingGrieve: [9fc4]20 82 8cJSR CurrentSprite_UpdateFlipMask [9fc7]a0 02LDY #$02 [9fc9]bd e4 02LDA a:CurrentSprites_Phases,X [9fcc]29 03AND #$03 [9fce]f0 09BEQ @LAB_PRG14__9fd9 [9fd0]ad 83 03LDA a:SpriteUpdateCounter [9fd3]4aLSR A [9fd4]4aLSR A [9fd5]4aLSR A [9fd6]29 03AND #$03 [9fd8]a8TAY [9fd9]@LAB_PRG14__9fd9: [9fd9]b9 df 9fLDA a:BYTE_ARRAY_PRG14__9fdf,Y [9fdc]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_KingGrieve ;
[9fdf]BYTE_ARRAY_PRG14__9fdf: [9fdf]00.byte $00; [0]: [9fe0]01.byte $01; [1]:
; ; XREFS: ; SpriteUpdateHandler_Boss_KingGrieve ;
[9fe1]BYTE_ARRAY_PRG14__9fdf_2_: [9fe1]02.byte $02; [2]: [9fe2]01.byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a607] ;============================================================================
[9fe3]SpriteBehavior_ShadowEura: [9fe3]20 85 a8JSR Sprite_IsBehaviorNotReady [9fe6]d0 1fBNE @LAB_PRG14__a007 [9fe8]a9 06LDA #$06 [9fea]9d 04 03STA a:CurrentSprites_HitBoxTypes,X [9fed]a9 00LDA #$00 [9fef]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [9ff2]9d f4 02STA a:CurrentSprites_BehaviorData3,X [9ff5]9d e4 02STA a:CurrentSprites_Phases,X [9ff8]a9 14LDA #$14 [9ffa]9d ec 02STA a:CurrentSprites_BehaviorData2,X [9ffd]20 7b 86JSR BScript_Action_FacePlayerX [a000]20 94 a8JSR Sprite_SetBehaviorReady [a003]a9 0aLDA #$0a [a005]85 faSTA Music_Current [a007]@LAB_PRG14__a007: [a007]20 7b 86JSR BScript_Action_FacePlayerX [a00a]bd e4 02LDA a:CurrentSprites_Phases,X [a00d]4aLSR A [a00e]b0 43BCS @LAB_PRG14__a053 [a010]fe f4 02INC a:CurrentSprites_BehaviorData3,X [a013]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [a016]29 07AND #$07 [a018]d0 38BNE @LAB_PRG14__a052 [a01a]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [a01d]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [a020]c9 0aCMP #$0a [a022]90 05BCC @LAB_PRG14__a029 [a024]a9 00LDA #$00 [a026]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [a029]@LAB_PRG14__a029: [a029]48PHA [a02a]c9 03CMP #$03 [a02c]f0 04BEQ @LAB_PRG14__a032 [a02e]c9 08CMP #$08 [a030]d0 03BNE @LAB_PRG14__a035 [a032]@LAB_PRG14__a032: [a032]20 77 a0JSR SpriteBehavior_ShadowEura__a077 [a035]@LAB_PRG14__a035: [a035]68PLA [a036]a8TAY [a037]b9 64 a0LDA a:BYTE_ARRAY_PRG14__a064,Y [a03a]8d 75 03STA a:Arg_DeltaX_Full [a03d]a9 00LDA #$00 [a03f]8d 74 03STA a:Arg_DeltaX_Frac [a042]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [a045]de ec 02DEC a:CurrentSprites_BehaviorData2,X [a048]d0 08BNE @LAB_PRG14__a052 [a04a]fe e4 02INC a:CurrentSprites_Phases,X [a04d]a9 1eLDA #$1e [a04f]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a052]@LAB_PRG14__a052: [a052]60RTS [a053]@LAB_PRG14__a053: [a053]20 7b 86JSR BScript_Action_FacePlayerX [a056]de ec 02DEC a:CurrentSprites_BehaviorData2,X [a059]d0 08BNE @_return [a05b]fe e4 02INC a:CurrentSprites_Phases,X [a05e]a9 14LDA #$14 [a060]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a063]@_return: [a063]60RTS
; ; XREFS: ; SpriteBehavior_ShadowEura ;
[a064]BYTE_ARRAY_PRG14__a064: [a064]00.byte $00; [0]: [a065]00.byte $00; [1]: [a066]08.byte $08; [2]: [a067]08.byte $08; [3]: [a068]08.byte $08; [4]: [a069]00.byte $00; [5]: [a06a]00.byte $00; [6]: [a06b]08.byte $08; [7]: [a06c]08.byte $08; [8]: [a06d]08.byte $08; [9]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_ShadowEura ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ed] ;============================================================================
[a06e]SpriteUpdateHandler_Boss_ShadowEura: [a06e]20 82 8cJSR CurrentSprite_UpdateFlipMask [a071]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [a074]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura__a077 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ShadowEura ;============================================================================
[a077]SpriteBehavior_ShadowEura__a077: [a077]bd dc 02LDA a:CurrentSprites_Flags,X [a07a]29 01AND #$01 [a07c]a8TAY [a07d]b5 baLDA CurrentSprites_XPos_Full,X [a07f]18CLC [a080]79 91 a0ADC a:BYTE_ARRAY_PRG14__a091,Y [a083]8d 84 03STA a:CurrentSprite_Arg_CastMagicX [a086]b5 c2LDA CurrentSprites_YPos,X [a088]18CLC [a089]69 10ADC #$10 [a08b]8d 85 03STA a:CurrentSprite_Arg_CastMagicY [a08e]4c 2d a1JMP SpriteBehavior_ShadowEura__a12d
; ; XREFS: ; SpriteBehavior_ShadowEura__a077 ;
[a091]BYTE_ARRAY_PRG14__a091: [a091]00.byte $00; [0]: [a092]20.byte $20; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_ExecutionHood__a093 ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ExecutionHood ;============================================================================
[a093]SpriteBehavior_ExecutionHood__a093: [a093]20 36 a2JSR Sprites_HasMaxOnScreen [a096]b0 32BCS RETURN_A0CA [a098]b5 c2LDA CurrentSprites_YPos,X [a09a]99 c2 00STA a:CurrentSprites_YPos,Y [a09d]4c ad a0JMP SpriteBehavior_ExecutionHood__a0ad
;============================================================================ ; TODO: Document FUN_PRG14__a0a0 ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; LAB_PRG14__974b [$PRG14::974b] ; SpriteBehavior_Ishiisu ; SpriteBehavior_Nash ;============================================================================
[a0a0]FUN_PRG14__a0a0: [a0a0]20 36 a2JSR Sprites_HasMaxOnScreen [a0a3]b0 25BCS RETURN_A0CA [a0a5]b5 c2LDA CurrentSprites_YPos,X [a0a7]18CLC [a0a8]69 0cADC #$0c [a0aa]99 c2 00STA a:CurrentSprites_YPos,Y
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_ExecutionHood__a0ad ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ExecutionHood__a093 ;============================================================================
[a0ad]SpriteBehavior_ExecutionHood__a0ad: [a0ad]a9 51LDA #$51 [a0af]99 cc 02STA a:CurrentSprites_Entities,Y [a0b2]b5 baLDA CurrentSprites_XPos_Full,X [a0b4]18CLC [a0b5]69 04ADC #$04 [a0b7]99 ba 00STA a:CurrentSprites_XPos_Full,Y [a0ba]bd dc 02LDA a:CurrentSprites_Flags,X [a0bd]29 01AND #$01 [a0bf]99 dc 02STA a:CurrentSprites_Flags,Y [a0c2]a9 00LDA #$00 [a0c4]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [a0c7]4c 02 a2JMP Sprite_Maybe_ResetState
; ; XREFS: ; FUN_PRG14__a0a0 ; SpriteBehavior_ExecutionHood__a093 ;
[a0ca]RETURN_A0CA: [a0ca]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_EnemyMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61d] ; _thunk_SpriteBehavior__a0cb ;============================================================================
[a0cb]SpriteBehavior_EnemyMagic: [a0cb]20 85 a8JSR Sprite_IsBehaviorNotReady [a0ce]d0 03BNE @LAB_PRG14__a0d3 [a0d0]20 94 a8JSR Sprite_SetBehaviorReady [a0d3]@LAB_PRG14__a0d3: [a0d3]a9 02LDA #$02 [a0d5]8d 75 03STA a:Arg_DeltaX_Full [a0d8]a9 00LDA #$00 [a0da]8d 74 03STA a:Arg_DeltaX_Frac [a0dd]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [a0e0]90 05BCC @_return [a0e2]a9 ffLDA #$ff [a0e4]9d cc 02STA a:CurrentSprites_Entities,X [a0e7]@_return: [a0e7]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Magic_81 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8129] ;============================================================================
[a0e8]SpriteUpdateHandler_Magic_81: [a0e8]a9 00LDA #$00 [a0ea]85 29STA CurrentSprite_FlipMask [a0ec]ad 83 03LDA a:SpriteUpdateCounter [a0ef]4aLSR A [a0f0]4aLSR A [a0f1]29 01AND #$01 [a0f3]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document Sprite_CastMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve_9f65 ; SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ;============================================================================
[a0f6]Sprite_CastMagic: [a0f6]20 36 a2JSR Sprites_HasMaxOnScreen [a0f9]b0 21BCS @_return [a0fb]a9 0aLDA #$0a [a0fd]99 cc 02STA a:CurrentSprites_Entities,Y [a100]ad 84 03LDA a:CurrentSprite_Arg_CastMagicX [a103]99 ba 00STA a:CurrentSprites_XPos_Full,Y [a106]ad 85 03LDA a:CurrentSprite_Arg_CastMagicY [a109]99 c2 00STA a:CurrentSprites_YPos,Y [a10c]bd dc 02LDA a:CurrentSprites_Flags,X [a10f]29 01AND #$01 [a111]99 dc 02STA a:CurrentSprites_Flags,Y [a114]a9 80LDA #$80 [a116]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [a119]4c 02 a2JMP Sprite_Maybe_ResetState [a11c]@_return: [a11c]60RTS
;============================================================================ ; TODO: Document _thunk_SpriteBehavior__a0cb ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61f] ;============================================================================
[a11d]_thunk_SpriteBehavior__a0cb: [a11d]4c cb a0JMP SpriteBehavior_EnemyMagic
;============================================================================ ; TODO: Document SpriteUpdateHandler_TODO_Garbled10 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809b] ;============================================================================
[a120]SpriteUpdateHandler_TODO_Garbled10: [a120]20 82 8cJSR CurrentSprite_UpdateFlipMask [a123]ad 83 03LDA a:SpriteUpdateCounter [a126]4aLSR A [a127]4aLSR A [a128]29 01AND #$01 [a12a]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura__a12d ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ShadowEura__a077 ;============================================================================
[a12d]SpriteBehavior_ShadowEura__a12d: [a12d]20 36 a2JSR Sprites_HasMaxOnScreen [a130]b0 21BCS @_return [a132]a9 53LDA #$53 [a134]99 cc 02STA a:CurrentSprites_Entities,Y [a137]ad 84 03LDA a:CurrentSprite_Arg_CastMagicX [a13a]99 ba 00STA a:CurrentSprites_XPos_Full,Y [a13d]ad 85 03LDA a:CurrentSprite_Arg_CastMagicY [a140]99 c2 00STA a:CurrentSprites_YPos,Y [a143]bd dc 02LDA a:CurrentSprites_Flags,X [a146]29 01AND #$01 [a148]99 dc 02STA a:CurrentSprites_Flags,Y [a14b]a9 00LDA #$00 [a14d]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [a150]4c 02 a2JMP Sprite_Maybe_ResetState [a153]@_return: [a153]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_Unknown_29 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a621] ;============================================================================
[a154]SpriteBehavior_Unknown_29: [a154]20 85 a8JSR Sprite_IsBehaviorNotReady [a157]d0 2aBNE @LAB_PRG14__a183 [a159]a9 00LDA #$00 [a15b]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [a15e]bd dc 02LDA a:CurrentSprites_Flags,X [a161]29 01AND #$01 [a163]48PHA [a164]20 29 83JSR SpriteBehavior_Unknown_29_SomeSetup [a167]1e 1c 03ASL a:CurrentSprites_BehaviorState_XFrac,X [a16a]3e 0c 03ROL a:CurrentSprites_BehaviorState_XFull,X [a16d]1e 24 03ASL a:CurrentSprites_BehaviorState_YFrac,X [a170]3e 14 03ROL a:CurrentSprites_BehaviorState_YFull,X [a173]68PLA [a174]85 00STA Temp_00 [a176]bd dc 02LDA a:CurrentSprites_Flags,X [a179]29 feAND #$fe [a17b]05 00ORA Temp_00 [a17d]9d dc 02STA a:CurrentSprites_Flags,X [a180]20 94 a8JSR Sprite_SetBehaviorReady [a183]@LAB_PRG14__a183: [a183]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [a186]8d 75 03STA a:Arg_DeltaX_Full [a189]bd 1c 03LDA a:CurrentSprites_BehaviorState_XFrac,X [a18c]8d 74 03STA a:Arg_DeltaX_Frac [a18f]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [a192]b0 28BCS @LAB_PRG14__a1bc [a194]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [a197]8d 77 03STA a:Arg_DeltaY_Full [a19a]bd 24 03LDA a:CurrentSprites_BehaviorState_YFrac,X [a19d]8d 76 03STA a:Arg_DeltaY_Frac [a1a0]20 c4 85JSR Sprite_MoveVertical [a1a3]b0 17BCS @LAB_PRG14__a1bc [a1a5]ad 83 03LDA a:SpriteUpdateCounter [a1a8]29 03AND #$03 [a1aa]d0 0fBNE @_return [a1ac]fe fc 02INC a:CurrentSprites_InternalBehaviorStates,X [a1af]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [a1b2]c9 03CMP #$03 [a1b4]90 05BCC @_return [a1b6]a9 00LDA #$00 [a1b8]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [a1bb]@_return: [a1bb]60RTS [a1bc]@LAB_PRG14__a1bc: [a1bc]a9 ffLDA #$ff [a1be]9d cc 02STA a:CurrentSprites_Entities,X [a1c1]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Magic_83 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::812d] ;============================================================================
[a1c2]SpriteUpdateHandler_Magic_83: [a1c2]a9 00LDA #$00 [a1c4]85 29STA CurrentSprite_FlipMask [a1c6]bd fc 02LDA a:CurrentSprites_InternalBehaviorStates,X [a1c9]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document FUN_PRG14__a1cc ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ;============================================================================
[a1cc]FUN_PRG14__a1cc: [a1cc]20 36 a2JSR Sprites_HasMaxOnScreen [a1cf]b0 23BCS @_return [a1d1]a9 54LDA #$54 [a1d3]99 cc 02STA a:CurrentSprites_Entities,Y [a1d6]ad 84 03LDA a:CurrentSprite_Arg_CastMagicX [a1d9]99 ba 00STA a:CurrentSprites_XPos_Full,Y [a1dc]ad 85 03LDA a:CurrentSprite_Arg_CastMagicY [a1df]99 c2 00STA a:CurrentSprites_YPos,Y [a1e2]bd dc 02LDA a:CurrentSprites_Flags,X [a1e5]29 01AND #$01 [a1e7]09 80ORA #$80 [a1e9]99 dc 02STA a:CurrentSprites_Flags,Y [a1ec]a9 00LDA #$00 [a1ee]99 2c 03STA a:CurrentSprites_PPUOffsets,Y [a1f1]4c 02 a2JMP Sprite_Maybe_ResetState [a1f4]@_return: [a1f4]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_EnemyMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::812f] ;============================================================================
[a1f5]SpriteUpdateHandler_EnemyMagic: [a1f5]20 82 8cJSR CurrentSprite_UpdateFlipMask [a1f8]ad 83 03LDA a:SpriteUpdateCounter [a1fb]4aLSR A [a1fc]4aLSR A [a1fd]29 03AND #$03 [a1ff]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document Sprite_Maybe_ResetState ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; A ; ; XREFS: ; BScript_Action_CastMagic ; SpriteBehavior_ExecutionHood__a0ad ; SpriteBehavior_Pakukame ; SpriteBehavior_ShadowEura__a12d ; SpriteBehavior_Zorugeriru__9e13 ; Sprite_CastMagic ;============================================================================
[a202]Sprite_Maybe_ResetState: [a202]8aTXA [a203]48PHA [a204]b9 cc 02LDA a:CurrentSprites_Entities,Y [a207]0aASL A [a208]aaTAX [a209]bd 2d adLDA a:SPRITE_BSCRIPTS,X [a20c]99 54 03STA a:CurrentSprites_BehaviorAddrs_L,Y [a20f]bd 2e adLDA a:SPRITE_BSCRIPTS+1,X [a212]99 5c 03STA a:CurrentSprites_BehaviorAddrs_U,Y [a215]a9 ffLDA #$ff [a217]99 d4 02STA a:CurrentSprites_Behaviors,Y [a21a]99 34 03STA a:CurrentSprites_HitByMagicBehavior,Y [a21d]be cc 02LDX a:CurrentSprites_Entities,Y [a220]bd df b4LDA a:SPRITE_ENTITIES_HITBOX_TYPES,X [a223]99 04 03STA a:CurrentSprites_HitBoxTypes,Y [a226]a9 00LDA #$00 [a228]99 e4 02STA a:CurrentSprites_Phases,Y [a22b]b9 dc 02LDA a:CurrentSprites_Flags,Y [a22e]29 bfAND #$bf [a230]99 dc 02STA a:CurrentSprites_Flags,Y [a233]68PLA [a234]aaTAX [a235]60RTS
;============================================================================ ; Return whether all sprite slots are populated. ; ; INPUTS: ; CurrentSprites_Entities: ; All populated sprite entities on the screen. ; ; OUTPUTS: ; C: ; 1 if all sprite slot are populated. ; 0 if any are unpopulated. ; ; XREFS: ; BScript_Action_CastMagic ; FUN_PRG14__a0a0 ; FUN_PRG14__a1cc ; SpriteBehavior_ExecutionHood__a093 ; SpriteBehavior_Pakukame ; SpriteBehavior_ShadowEura__a12d ; SpriteBehavior_Zorugeriru ; SpriteBehavior_Zorugeriru__9e13 ; Sprite_CastMagic ; Sprite_HandleDeathDropIfPossible ;============================================================================
[a236]Sprites_HasMaxOnScreen: [a236]a0 07LDY #$07; Y = 7 (our loop counter) [a238]@_loop: [a238]b9 cc 02LDA a:CurrentSprites_Entities,Y; A = sprite entity at X [a23b]c9 ffCMP #$ff; Is it 0xFF (unpopulated)? [a23d]d0 02BNE @_isPopulated; If not, jump to prepare the next loop.
; ; There's an unpopulated sprite. Return a false result. ;
[a23f]18CLC; Set C = 0 [a240]60RTS; And return it. [a241]@_isPopulated: [a241]88DEY; Y-- [a242]10 f4BPL @_loop; If >= 0, loop.
; ; All slots are populated. Return a true result. ;
[a244]38SEC; Set C = 1 [a245]60RTS; And return it.
;============================================================================ ; TODO: Document SpriteBehavior_Ointment ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a639] ;============================================================================
[a246]SpriteBehavior_Ointment: [a246]20 85 a8JSR Sprite_IsBehaviorNotReady [a249]d0 0eBNE Sprite_FallIfNeeded [a24b]ad 27 04LDA a:DurationOintment [a24e]30 06BMI Sprite_SetReadyAndFallIfNeeded
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_a25f_ClearEntity ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ;============================================================================
[a250]SpriteBehavior_a25f_ClearEntity: [a250]a9 ffLDA #$ff [a252]9d cc 02STA a:CurrentSprites_Entities,X [a255]60RTS
;============================================================================ ; TODO: Document Sprite_SetReadyAndFallIfNeeded ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ; SpriteBehavior_Ointment ;============================================================================
[a256]Sprite_SetReadyAndFallIfNeeded: [a256]20 94 a8JSR Sprite_SetBehaviorReady
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprite_FallIfNeeded ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ; SpriteBehavior_Ointment ;============================================================================
[a259]Sprite_FallIfNeeded: [a259]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [a25c]4c 4a 86JMP CurrentSprite_HandleFall
;============================================================================ ; TODO: Document SpriteBehavior_Glove ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63b] ;============================================================================
[a25f]SpriteBehavior_Glove: [a25f]20 85 a8JSR Sprite_IsBehaviorNotReady [a262]d0 f5BNE Sprite_FallIfNeeded [a264]ad 28 04LDA a:DurationGlove [a267]30 edBMI Sprite_SetReadyAndFallIfNeeded [a269]10 e5BPL SpriteBehavior_a25f_ClearEntity
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_Walking ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ef] ; thunk1_SpriteUpdateHandler_NPC_Walking ; thunk2_SpriteUpdateHandler_NPC_Walking ;============================================================================
[a26b]SpriteUpdateHandler_NPC_Walking: [a26b]20 82 8cJSR CurrentSprite_UpdateFlipMask [a26e]a0 00LDY #$00 [a270]bd e4 02LDA a:CurrentSprites_Phases,X [a273]c9 02CMP #$02 [a275]f0 09BEQ @LAB_PRG14__a280 [a277]ad 83 03LDA a:SpriteUpdateCounter [a27a]4aLSR A [a27b]4aLSR A [a27c]4aLSR A [a27d]29 03AND #$03 [a27f]a8TAY [a280]@LAB_PRG14__a280: [a280]b9 86 a2LDA a:BYTE_ARRAY_PRG14__a286,Y [a283]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_NPC_Walking ;
[a286]BYTE_ARRAY_PRG14__a286: [a286]00.byte $00; [0]: [a287]01.byte $01; [1]: [a288]00.byte $00; [2]: [a289]02.byte $02; [3]:
;============================================================================ ; TODO: Document thunk1_SpriteUpdateHandler_NPC_Walking ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f1] ;============================================================================
[a28a]thunk1_SpriteUpdateHandler_NPC_Walking: [a28a]4c 6b a2JMP SpriteUpdateHandler_NPC_Walking
;============================================================================ ; TODO: Document thunk2_SpriteUpdateHandler_NPC_Walking ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f3] ;============================================================================
[a28d]thunk2_SpriteUpdateHandler_NPC_Walking: [a28d]4c 6b a2JMP SpriteUpdateHandler_NPC_Walking
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_ArmorSalesman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f5] ;============================================================================
[a290]SpriteUpdateHandler_NPC_ArmorSalesman: [a290]a9 00LDA #$00 [a292]85 29STA CurrentSprite_FlipMask [a294]ad 83 03LDA a:SpriteUpdateCounter [a297]4aLSR A [a298]4aLSR A [a299]4aLSR A [a29a]4aLSR A [a29b]29 01AND #$01 [a29d]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_MartialArts ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f7] ;============================================================================
[a2a0]SpriteUpdateHandler_NPC_MartialArts: [a2a0]20 82 8cJSR CurrentSprite_UpdateFlipMask [a2a3]ad 83 03LDA a:SpriteUpdateCounter [a2a6]4aLSR A [a2a7]4aLSR A [a2a8]4aLSR A [a2a9]4aLSR A [a2aa]29 01AND #$01 [a2ac]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_Priest ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f9] ;============================================================================
[a2af]SpriteUpdateHandler_NPC_Priest: [a2af]20 82 8cJSR CurrentSprite_UpdateFlipMask [a2b2]ad 83 03LDA a:SpriteUpdateCounter [a2b5]4aLSR A [a2b6]4aLSR A [a2b7]4aLSR A [a2b8]4aLSR A [a2b9]29 01AND #$01 [a2bb]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_King ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80fb] ;============================================================================
[a2be]SpriteUpdateHandler_NPC_King: [a2be]a9 40LDA #$40 [a2c0]85 29STA CurrentSprite_FlipMask [a2c2]bc e4 02LDY a:CurrentSprites_Phases,X [a2c5]88DEY [a2c6]ad 83 03LDA a:SpriteUpdateCounter [a2c9]4aLSR A [a2ca]4aLSR A [a2cb]4aLSR A [a2cc]4aLSR A [a2cd]29 01AND #$01 [a2cf]18CLC [a2d0]79 d6 a2ADC a:BYTE_ARRAY_PRG14__a2d6,Y [a2d3]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_NPC_King ;
[a2d6]BYTE_ARRAY_PRG14__a2d6: [a2d6]00.byte $00; [0]: [a2d7]02.byte $02; [1]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_MagicTeacher ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80fd] ;============================================================================
[a2d8]SpriteUpdateHandler_NPC_MagicTeacher: [a2d8]20 82 8cJSR CurrentSprite_UpdateFlipMask [a2db]ad 83 03LDA a:SpriteUpdateCounter [a2de]4aLSR A [a2df]4aLSR A [a2e0]4aLSR A [a2e1]4aLSR A [a2e2]29 01AND #$01 [a2e4]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_KeySalesman_Others ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ff] ; SPRITE_UPDATE_HANDLERS [$PRG14::8101] ; SPRITE_UPDATE_HANDLERS [$PRG14::8103] ; SPRITE_UPDATE_HANDLERS [$PRG14::8105] ;============================================================================
[a2e7]SpriteUpdateHandler_NPC_KeySalesman_Others: [a2e7]a9 40LDA #$40 [a2e9]85 29STA CurrentSprite_FlipMask
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document FUN_PRG14__a2eb ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura ; SpriteUpdateHandler_NPC_Doctor ; SpriteUpdateHandler_NPC_MeatSalesman_Others ;============================================================================
[a2eb]FUN_PRG14__a2eb: [a2eb]ad 83 03LDA a:SpriteUpdateCounter [a2ee]4aLSR A [a2ef]4aLSR A [a2f0]4aLSR A [a2f1]4aLSR A [a2f2]29 01AND #$01 [a2f4]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_Doctor ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::810d] ;============================================================================
[a2f7]SpriteUpdateHandler_NPC_Doctor: [a2f7]a9 00LDA #$00 [a2f9]85 29STA CurrentSprite_FlipMask [a2fb]4c eb a2JMP FUN_PRG14__a2eb
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_MeatSalesman_Others ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8107] ; SPRITE_UPDATE_HANDLERS [$PRG14::8109] ; SPRITE_UPDATE_HANDLERS [$PRG14::810b] ; SPRITE_UPDATE_HANDLERS [$PRG14::810f] ; SPRITE_UPDATE_HANDLERS [$PRG14::8111] ;============================================================================
[a2fe]SpriteUpdateHandler_NPC_MeatSalesman_Others: [a2fe]20 82 8cJSR CurrentSprite_UpdateFlipMask [a301]4c eb a2JMP FUN_PRG14__a2eb
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8113] ; SPRITE_UPDATE_HANDLERS [$PRG14::8115] ;============================================================================
[a304]SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura: [a304]20 82 8cJSR CurrentSprite_UpdateFlipMask [a307]4c eb a2JMP FUN_PRG14__a2eb
;============================================================================ ; TODO: Document SpriteUpdateHandler_Item_Standard ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8117] ; SPRITE_UPDATE_HANDLERS [$PRG14::811d] ; SPRITE_UPDATE_HANDLERS [$PRG14::811f] ; SPRITE_UPDATE_HANDLERS [$PRG14::8121] ; SPRITE_UPDATE_HANDLERS [$PRG14::8123] ; SPRITE_UPDATE_HANDLERS [$PRG14::8127] ; SPRITE_UPDATE_HANDLERS [$PRG14::8131] ; SPRITE_UPDATE_HANDLERS [$PRG14::8133] ; SPRITE_UPDATE_HANDLERS [$PRG14::813d] ; SPRITE_UPDATE_HANDLERS [$PRG14::813f] ; SPRITE_UPDATE_HANDLERS [$PRG14::8141] ; SPRITE_UPDATE_HANDLERS [$PRG14::8143] ; SPRITE_UPDATE_HANDLERS [$PRG14::8145] ; SPRITE_UPDATE_HANDLERS [$PRG14::8147] ;============================================================================
[a30a]SpriteUpdateHandler_Item_Standard: [a30a]a9 00LDA #$00 [a30c]85 29STA CurrentSprite_FlipMask [a30e]a9 00LDA #$00 [a310]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Bread ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8089] ;============================================================================
[a313]SpriteUpdateHandler_Bread: [a313]a9 00LDA #$00 [a315]85 33STA Sprites_PPUOffset [a317]85 29STA CurrentSprite_FlipMask [a319]a9 00LDA #$00 [a31b]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Fountain ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a659] ;============================================================================
[a31e]SpriteBehavior_Fountain: [a31e]20 85 a8JSR Sprite_IsBehaviorNotReady [a321]d0 03BNE @_checkQuest [a323]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a326]@_checkQuest: [a326]ad 2d 04LDA a:Quests [a329]29 07AND #$07 [a32b]c9 07CMP #$07 [a32d]d0 03BNE @_setVisible [a32f]4c ce a8JMP Sprites_HideSprite [a332]@_setVisible: [a332]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_Fountain ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::812b] ; SpriteUpdateHandler_Effect_Spring ;============================================================================
[a335]SpriteUpdateHandler_Effect_Fountain: [a335]a9 00LDA #$00 [a337]85 29STA CurrentSprite_FlipMask [a339]ad 83 03LDA a:SpriteUpdateCounter [a33c]4aLSR A [a33d]4aLSR A [a33e]29 03AND #$03 [a340]a8TAY [a341]b9 47 a3LDA a:SPRITE_FOUNTAIN_PHASES,Y [a344]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Effect_Fountain ;
[a347]SPRITE_FOUNTAIN_PHASES: [a347]04.byte $04; [0]: [a348]05.byte $05; [1]: [a349]06.byte $06; [2]: [a34a]05.byte $05; [3]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Item_Special ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8119] ; SPRITE_UPDATE_HANDLERS [$PRG14::811b] ; SPRITE_UPDATE_HANDLERS [$PRG14::8135] ; SPRITE_UPDATE_HANDLERS [$PRG14::8137] ; SPRITE_UPDATE_HANDLERS [$PRG14::8139] ; SPRITE_UPDATE_HANDLERS [$PRG14::813b] ;============================================================================
[a34b]SpriteUpdateHandler_Item_Special: [a34b]a9 00LDA #$00 [a34d]85 29STA CurrentSprite_FlipMask [a34f]a9 00LDA #$00 [a351]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_BattleSuitDroppedByZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63d] ;============================================================================
[a354]SpriteBehavior_BattleSuitDroppedByZoradohna: [a354]20 85 a8JSR Sprite_IsBehaviorNotReady [a357]d0 1eBNE @_checkOnScreen [a359]ad be 03LDA a:SelectedArmor [a35c]c9 03CMP #$03 [a35e]f0 54BEQ Sprites_ClearAllEntities [a360]ac c3 03LDY a:NumberOfArmors [a363]@_checkArmorLoop: [a363]88DEY [a364]30 09BMI @_setReady [a366]b9 a1 03LDA a:ArmorInventory,Y [a369]c9 03CMP #$03 [a36b]f0 47BEQ Sprites_ClearAllEntities [a36d]d0 f4BNE @_checkArmorLoop [a36f]@_setReady: [a36f]a9 00LDA #$00 [a371]9d e4 02STA a:CurrentSprites_Phases,X [a374]20 94 a8JSR Sprite_SetBehaviorReady [a377]@_checkOnScreen: [a377]a9 2eLDA #$2e [a379]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a37c]90 03BCC @_setVisible [a37e]4c ce a8JMP Sprites_HideSprite [a381]@_setVisible: [a381]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_BattleHelmetDroppedByZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63f] ;============================================================================
[a384]SpriteBehavior_BattleHelmetDroppedByZoradohna: [a384]20 85 a8JSR Sprite_IsBehaviorNotReady [a387]d0 1eBNE @_checkOnScreen [a389]ad bf 03LDA a:SelectedShield [a38c]c9 03CMP #$03 [a38e]f0 24BEQ Sprites_ClearAllEntities [a390]ac c4 03LDY a:NumberOfShields [a393]@_checkShieldLoop: [a393]88DEY [a394]30 09BMI @_setReady [a396]b9 a5 03LDA a:ShieldInventory,Y [a399]c9 03CMP #$03 [a39b]f0 17BEQ Sprites_ClearAllEntities [a39d]d0 f4BNE @_checkShieldLoop [a39f]@_setReady: [a39f]a9 00LDA #$00 [a3a1]9d e4 02STA a:CurrentSprites_Phases,X [a3a4]20 94 a8JSR Sprite_SetBehaviorReady [a3a7]@_checkOnScreen: [a3a7]a9 2eLDA #$2e [a3a9]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a3ac]90 03BCC @_setVisible [a3ae]4c ce a8JMP Sprites_HideSprite [a3b1]@_setVisible: [a3b1]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document Sprites_ClearAllEntities ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ;============================================================================
[a3b4]Sprites_ClearAllEntities: [a3b4]a0 07LDY #$07 [a3b6]@_loop: [a3b6]a9 ffLDA #$ff [a3b8]99 cc 02STA a:CurrentSprites_Entities,Y [a3bb]88DEY [a3bc]10 f8BPL @_loop [a3be]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_DragonSlayerDroppedByKingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a641] ;============================================================================
[a3bf]SpriteBehavior_DragonSlayerDroppedByKingGrieve: [a3bf]20 85 a8JSR Sprite_IsBehaviorNotReady [a3c2]d0 1eBNE @_checkOnScreen [a3c4]ad c8 03LDA a:Player_CurWeapon [a3c7]c9 03CMP #$03 [a3c9]f0 e9BEQ Sprites_ClearAllEntities [a3cb]ac c2 03LDY a:NumberOfWeapons [a3ce]@_checkWeaponLoop: [a3ce]88DEY [a3cf]30 09BMI @_setReady [a3d1]b9 9d 03LDA a:WeaponInventory,Y [a3d4]c9 03CMP #$03 [a3d6]f0 dcBEQ Sprites_ClearAllEntities [a3d8]d0 f4BNE @_checkWeaponLoop [a3da]@_setReady: [a3da]a9 00LDA #$00 [a3dc]9d e4 02STA a:CurrentSprites_Phases,X [a3df]20 94 a8JSR Sprite_SetBehaviorReady [a3e2]@_checkOnScreen: [a3e2]a9 32LDA #$32 [a3e4]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a3e7]90 03BCC @_setVisible [a3e9]4c ce a8JMP Sprites_HideSprite [a3ec]@_setVisible: [a3ec]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_MattockDroppedFromRipasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a643] ;============================================================================
[a3ef]SpriteBehavior_MattockDroppedFromRipasheiku: [a3ef]20 85 a8JSR Sprite_IsBehaviorNotReady [a3f2]d0 12BNE @_checkOnScreen [a3f4]ad 2d 04LDA a:Quests [a3f7]29 10AND #$10 [a3f9]f0 03BEQ @_setReady [a3fb]4c 23 a5JMP Sprites_Remove [a3fe]@_setReady: [a3fe]a9 00LDA #$00 [a400]9d e4 02STA a:CurrentSprites_Phases,X [a403]20 94 a8JSR Sprite_SetBehaviorReady [a406]@_checkOnScreen: [a406]a9 2dLDA #$2d [a408]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a40b]90 03BCC @_setVisible [a40d]4c ce a8JMP Sprites_HideSprite [a410]@_setVisible: [a410]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; ## Behavior $2F: Wing Boots Dropped by Zorugeriru ; ; Shows the sprite on screen only if all conditions are met: ; ; 1. The player has not retrieved the Wingboots from Zorugeriru ; 2. Zorugeriru is not on the screen ; ; Parameters: ; 1. Unused (1 byte) ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a645] ;============================================================================
[a413]SpriteBehavior_WingBootsDroppedByZorugeriru: [a413]20 85 a8JSR Sprite_IsBehaviorNotReady; Is the sprite behavior disabled? [a416]d0 12BNE @_checkOnScreen [a418]ad 2d 04LDA a:Quests [a41b]29 08AND #$08 [a41d]f0 03BEQ @_setReady [a41f]4c 23 a5JMP Sprites_Remove [a422]@_setReady: [a422]a9 00LDA #$00 [a424]9d e4 02STA a:CurrentSprites_Phases,X [a427]20 94 a8JSR Sprite_SetBehaviorReady [a42a]@_checkOnScreen: [a42a]a9 31LDA #$31 [a42c]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a42f]90 03BCC @_setVisible [a431]4c ce a8JMP Sprites_HideSprite [a434]@_setVisible: [a434]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_BlackOnyxDropFromZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a647] ;============================================================================
[a437]SpriteBehavior_BlackOnyxDropFromZoradohna: [a437]20 85 a8JSR Sprite_IsBehaviorNotReady [a43a]d0 12BNE @_checkOnScreen [a43c]ad 2c 04LDA a:SpecialItems [a43f]29 01AND #$01 [a441]f0 03BEQ @_setReady [a443]4c 23 a5JMP Sprites_Remove [a446]@_setReady: [a446]a9 00LDA #$00 [a448]9d e4 02STA a:CurrentSprites_Phases,X [a44b]20 94 a8JSR Sprite_SetBehaviorReady [a44e]@_checkOnScreen: [a44e]a9 2eLDA #$2e [a450]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a453]90 03BCC @_setVisible [a455]4c ce a8JMP Sprites_HideSprite [a458]@_setVisible: [a458]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_PendantDroppedFromRipasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a649] ;============================================================================
[a45b]SpriteBehavior_PendantDroppedFromRipasheiku: [a45b]20 85 a8JSR Sprite_IsBehaviorNotReady [a45e]d0 12BNE @_checkOnScreen [a460]ad 2c 04LDA a:SpecialItems [a463]29 02AND #$02 [a465]f0 03BEQ @_setReady [a467]4c 23 a5JMP Sprites_Remove [a46a]@_setReady: [a46a]a9 00LDA #$00 [a46c]9d e4 02STA a:CurrentSprites_Phases,X [a46f]20 94 a8JSR Sprite_SetBehaviorReady [a472]@_checkOnScreen: [a472]a9 2dLDA #$2d [a474]20 e6 efJSR Maybe_IsSpriteEntityNotOnScreen [a477]90 03BCC @_setVisible [a479]4c ce a8JMP Sprites_HideSprite [a47c]@_setVisible: [a47c]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_ShowMagicalRod ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a661] ;============================================================================
[a47f]SpriteBehavior_ShowMagicalRod: [a47f]ad 2c 04LDA a:SpecialItems [a482]29 04AND #$04 [a484]f0 03BEQ @_return [a486]4c 23 a5JMP Sprites_Remove [a489]@_return: [a489]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_50 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64b] ;============================================================================
[a48a]SpriteBehavior_RandomlyShowItem_50: [a48a]20 85 a8JSR Sprite_IsBehaviorNotReady [a48d]d0 0bBNE @LAB_PRG14__a49a [a48f]20 29 a5JSR Screen_Is3Of4Visits [a492]90 03BCC @LAB_PRG14__a497 [a494]4c 23 a5JMP Sprites_Remove [a497]@LAB_PRG14__a497: [a497]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a49a]@LAB_PRG14__a49a: [a49a]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_51 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64d] ;============================================================================
[a49d]SpriteBehavior_RandomlyShowItem_51: [a49d]20 85 a8JSR Sprite_IsBehaviorNotReady [a4a0]d0 0bBNE @LAB_PRG14__a4ad [a4a2]20 29 a5JSR Screen_Is3Of4Visits [a4a5]90 03BCC @LAB_PRG14__a4aa [a4a7]4c 23 a5JMP Sprites_Remove [a4aa]@LAB_PRG14__a4aa: [a4aa]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a4ad]@LAB_PRG14__a4ad: [a4ad]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_52 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64f] ;============================================================================
[a4b0]SpriteBehavior_RandomlyShowItem_52: [a4b0]20 85 a8JSR Sprite_IsBehaviorNotReady [a4b3]d0 0bBNE @LAB_PRG14__a4c0 [a4b5]20 29 a5JSR Screen_Is3Of4Visits [a4b8]90 03BCC @LAB_PRG14__a4bd [a4ba]4c 23 a5JMP Sprites_Remove [a4bd]@LAB_PRG14__a4bd: [a4bd]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a4c0]@LAB_PRG14__a4c0: [a4c0]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_53 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a651] ;============================================================================
[a4c3]SpriteBehavior_RandomlyShowItem_53: [a4c3]20 85 a8JSR Sprite_IsBehaviorNotReady [a4c6]d0 0bBNE @LAB_PRG14__a4d3 [a4c8]20 29 a5JSR Screen_Is3Of4Visits [a4cb]90 03BCC @LAB_PRG14__a4d0 [a4cd]4c 23 a5JMP Sprites_Remove [a4d0]@LAB_PRG14__a4d0: [a4d0]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a4d3]@LAB_PRG14__a4d3: [a4d3]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_54 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a653] ;============================================================================
[a4d6]SpriteBehavior_RandomlyShowItem_54: [a4d6]20 85 a8JSR Sprite_IsBehaviorNotReady [a4d9]d0 0bBNE @LAB_PRG14__a4e6 [a4db]20 29 a5JSR Screen_Is3Of4Visits [a4de]90 03BCC @LAB_PRG14__a4e3 [a4e0]4c 23 a5JMP Sprites_Remove [a4e3]@LAB_PRG14__a4e3: [a4e3]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a4e6]@LAB_PRG14__a4e6: [a4e6]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_56 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a657] ;============================================================================
[a4e9]SpriteBehavior_RandomlyShowItem_56: [a4e9]20 85 a8JSR Sprite_IsBehaviorNotReady [a4ec]d0 0bBNE @LAB_PRG14__a4f9 [a4ee]20 29 a5JSR Screen_Is3Of4Visits [a4f1]90 03BCC @LAB_PRG14__a4f6 [a4f3]4c 23 a5JMP Sprites_Remove [a4f6]@LAB_PRG14__a4f6: [a4f6]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a4f9]@LAB_PRG14__a4f9: [a4f9]4c 10 a5JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_55 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a655] ;============================================================================
[a4fc]SpriteBehavior_RandomlyShowItem_55: [a4fc]20 85 a8JSR Sprite_IsBehaviorNotReady [a4ff]d0 0bBNE @LAB_PRG14__a50c [a501]20 29 a5JSR Screen_Is3Of4Visits [a504]90 03BCC @LAB_PRG14__a509 [a506]4c 23 a5JMP Sprites_Remove [a509]@LAB_PRG14__a509: [a509]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a50c]@LAB_PRG14__a50c: [a50c]4c 10 a5JMP Sprite_ShowIfNoEnemies [a50f]60RTS
;============================================================================ ; Show a sprite if there are no enemies on the screen. ; ; This is used for things like item drops. ; ; If there are enemies on the screen, the sprite will be ; hidden. ; ; INPUTS: ; X: ; The index of the sprite to show or hide. ; ; OUTPUTS: ; None. ; ; CALLS: ; Sprites_HasAnyEnemyOnScreen ; Sprite_SetVisible ; Sprites_HideSprite ; ; XREFS: ; SpriteBehavior_RandomlyShowItem_50 ; SpriteBehavior_RandomlyShowItem_51 ; SpriteBehavior_RandomlyShowItem_52 ; SpriteBehavior_RandomlyShowItem_53 ; SpriteBehavior_RandomlyShowItem_54 ; SpriteBehavior_RandomlyShowItem_55 ; SpriteBehavior_RandomlyShowItem_56 ;============================================================================
[a510]Sprite_ShowIfNoEnemies: [a510]20 3c a5JSR Sprites_HasAnyEnemyOnScreen; Are there any enemies on screen? [a513]90 03BCC @_hideSprite; If so, jump to hide the sprite. [a515]4c bf a8JMP Sprite_SetVisible; Else, show the sprite. [a518]@_hideSprite: [a518]4c ce a8JMP Sprites_HideSprite; Hide the sprite.
;============================================================================ ; TODO: Document Sprites_MaybeResetPhaseAndEnable ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Fountain ; SpriteBehavior_RandomlyShowItem_50 ; SpriteBehavior_RandomlyShowItem_51 ; SpriteBehavior_RandomlyShowItem_52 ; SpriteBehavior_RandomlyShowItem_53 ; SpriteBehavior_RandomlyShowItem_54 ; SpriteBehavior_RandomlyShowItem_55 ; SpriteBehavior_RandomlyShowItem_56 ; SpriteBehavior_SpringOfFortress ; SpriteBehavior_SpringOfJoker ; SpriteBehavior_SpringOfSky ;============================================================================
[a51b]Sprites_MaybeResetPhaseAndEnable: [a51b]a9 00LDA #$00 [a51d]9d e4 02STA a:CurrentSprites_Phases,X [a520]4c 94 a8JMP Sprite_SetBehaviorReady
;============================================================================ ; Queue removal of a sprite. ; ; This clears the sprite type for the given sprite index. ; ; INPUTS: ; X: ; The index of the sprite to clear. ; ; OUTPUTS: ; None ; ; XREFS: ; SpriteBehavior_BlackOnyxDropFromZoradohna ; SpriteBehavior_MattockDroppedFromRipasheiku ; SpriteBehavior_PendantDroppedFromRipasheiku ; SpriteBehavior_RandomlyShowItem_50 ; SpriteBehavior_RandomlyShowItem_51 ; SpriteBehavior_RandomlyShowItem_52 ; SpriteBehavior_RandomlyShowItem_53 ; SpriteBehavior_RandomlyShowItem_54 ; SpriteBehavior_RandomlyShowItem_55 ; SpriteBehavior_RandomlyShowItem_56 ; SpriteBehavior_ShowMagicalRod ; SpriteBehavior_WingBootsDroppedByZorugeriru ;============================================================================
[a523]Sprites_Remove: [a523]a9 ffLDA #$ff [a525]9d cc 02STA a:CurrentSprites_Entities,X; Unset the sprite entity. [a528]60RTS
;============================================================================ ; Return whether the screen visit count is 3 out of 4 values. ; ; This is used to determine whether to conditionally show ; certain items on a screen. Every 3 of 4 visits, this will ; return true (via the Carry flag). On the 4th visit, it ; will return false. ; ; The counter is only updated when this function is called, ; leaving the counter to only increment on some screens. ; ; INPUTS: ; Screen_TrackedVisitCount: ; The incrementing visit counter. ; ; OUTPUTS: ; C: ; 1 = This is 3 out of 4 screen visits. ; 0 = This is the 4th out of 4 screen visits. ; ; XREFS: ; SpriteBehavior_RandomlyShowItem_50 ; SpriteBehavior_RandomlyShowItem_51 ; SpriteBehavior_RandomlyShowItem_52 ; SpriteBehavior_RandomlyShowItem_53 ; SpriteBehavior_RandomlyShowItem_54 ; SpriteBehavior_RandomlyShowItem_55 ; SpriteBehavior_RandomlyShowItem_56 ;============================================================================
[a529]Screen_Is3Of4Visits: [a529]ee 3a 04INC a:Screen_TrackedVisitCount; Increment the visit count. [a52c]ad 3a 04LDA a:Screen_TrackedVisitCount; Load it. [a52f]c9 04CMP #$04; Is it < 4? [a531]90 07BCC @_returnTrue; If so, jump to return true. [a533]a9 00LDA #$00; Else, reset the track to 0. [a535]8d 3a 04STA a:Screen_TrackedVisitCount; And store as the new count. [a538]18CLC; Set C = 0 (false result). [a539]60RTS [a53a]@_returnTrue: [a53a]38SEC; Set C = 1 (true result). [a53b]60RTS
;============================================================================ ; Return whether there are any enemies on screen. ; ; This will check for all current sprites on screen. ; If any are an enemy, this will set Carry to 1. ; Otherwise, Carry will be set to 0. ; ; INPUTS: ; CurrentSprites_Entities: ; The sprite entities currently on screen. ; ; SPRITE_CATEGORIES_BY_ENTITY: ; The mapping of sprite entities to categories. ; ; OUTPUTS: ; C: ; 1 = One or more enemies on screen. ; 0 = No enemies on screen. ; ; XREFS: ; Sprite_ShowIfNoEnemies ;============================================================================
[a53c]Sprites_HasAnyEnemyOnScreen: [a53c]a0 07LDY #$07; Y = 7 (loop counter) [a53e]@_loop: [a53e]b9 cc 02LDA a:CurrentSprites_Entities,Y; A = Sprite entity at Y [a541]c9 ffCMP #$ff; Is it unset? [a543]f0 0bBEQ @_prepareNextLoop; If it's set, jump to prepare for next loop. [a545]aaTAX; X = A [a546]bd 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,X; A = Sprite category for entity X [a549]d0 05BNE @_prepareNextLoop; If not an enemy, jump to prepare for next loop. [a54b]ae 78 03LDX a:CurrentSpriteIndex; Else, restore the X register. [a54e]38SEC; Set C = 1 (true result). [a54f]60RTS [a550]@_prepareNextLoop: [a550]88DEY; Y-- [a551]10 ebBPL @_loop; If Y >= 0, loop. [a553]ae 78 03LDX a:CurrentSpriteIndex; Else, restore the X register. [a556]18CLC; Set C = 0 (false result). [a557]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfFortress ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65b] ;============================================================================
[a558]SpriteBehavior_SpringOfFortress: [a558]20 85 a8JSR Sprite_IsBehaviorNotReady [a55b]d0 03BNE @LAB_PRG14__a560 [a55d]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a560]@LAB_PRG14__a560: [a560]bd e4 02LDA a:CurrentSprites_Phases,X [a563]d0 38BNE SpriteBehavior_Springs_UpdateFlowing [a565]ad 2d 04LDA a:Quests [a568]29 01AND #$01 [a56a]d0 31BNE SpriteBehavior_Springs_UpdateFlowing [a56c]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfSky ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65d] ;============================================================================
[a56f]SpriteBehavior_SpringOfSky: [a56f]20 85 a8JSR Sprite_IsBehaviorNotReady [a572]d0 03BNE @LAB_PRG14__a577 [a574]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a577]@LAB_PRG14__a577: [a577]bd e4 02LDA a:CurrentSprites_Phases,X [a57a]d0 21BNE SpriteBehavior_Springs_UpdateFlowing [a57c]ad 2d 04LDA a:Quests [a57f]29 02AND #$02 [a581]d0 1aBNE SpriteBehavior_Springs_UpdateFlowing [a583]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfJoker ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65f] ;============================================================================
[a586]SpriteBehavior_SpringOfJoker: [a586]20 85 a8JSR Sprite_IsBehaviorNotReady [a589]d0 03BNE @LAB_PRG14__a58e [a58b]20 1b a5JSR Sprites_MaybeResetPhaseAndEnable [a58e]@LAB_PRG14__a58e: [a58e]bd e4 02LDA a:CurrentSprites_Phases,X [a591]d0 0aBNE SpriteBehavior_Springs_UpdateFlowing [a593]ad 2d 04LDA a:Quests [a596]29 04AND #$04 [a598]d0 03BNE SpriteBehavior_Springs_UpdateFlowing [a59a]4c bf a8JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_Springs_UpdateFlowing ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_SpringOfFortress ; SpriteBehavior_SpringOfJoker ; SpriteBehavior_SpringOfSky ;============================================================================
[a59d]SpriteBehavior_Springs_UpdateFlowing: [a59d]20 ce a8JSR Sprites_HideSprite [a5a0]bd e4 02LDA a:CurrentSprites_Phases,X [a5a3]d0 0bBNE @LAB_PRG14__a5b0 [a5a5]fe e4 02INC a:CurrentSprites_Phases,X [a5a8]a9 00LDA #$00 [a5aa]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a5ad]9d f4 02STA a:CurrentSprites_BehaviorData3,X [a5b0]@LAB_PRG14__a5b0: [a5b0]bd e4 02LDA a:CurrentSprites_Phases,X [a5b3]c9 01CMP #$01 [a5b5]d0 15BNE Sprite_SetPhase2 [a5b7]fe f4 02INC a:CurrentSprites_BehaviorData3,X [a5ba]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [a5bd]29 03AND #$03 [a5bf]d0 0aBNE RETURN_A5CB [a5c1]fe ec 02INC a:CurrentSprites_BehaviorData2,X [a5c4]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [a5c7]c9 04CMP #$04 [a5c9]b0 01BCS Sprite_SetPhase2
; ; XREFS: ; SpriteBehavior_Springs_UpdateFlowing ; SpriteUpdateHandler_Effect_Spring ;
[a5cb]RETURN_A5CB: [a5cb]60RTS
;============================================================================ ; TODO: Document Sprite_SetPhase2 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Springs_UpdateFlowing ;============================================================================
[a5cc]Sprite_SetPhase2: [a5cc]a9 02LDA #$02 [a5ce]9d e4 02STA a:CurrentSprites_Phases,X [a5d1]60RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_Spring ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8149] ; SPRITE_UPDATE_HANDLERS [$PRG14::814b] ; SPRITE_UPDATE_HANDLERS [$PRG14::814d] ;============================================================================
[a5d2]SpriteUpdateHandler_Effect_Spring: [a5d2]bd e4 02LDA a:CurrentSprites_Phases,X [a5d5]f0 f4BEQ RETURN_A5CB [a5d7]c9 01CMP #$01 [a5d9]f0 03BEQ @LAB_PRG14__a5de [a5db]4c 35 a3JMP SpriteUpdateHandler_Effect_Fountain [a5de]@LAB_PRG14__a5de: [a5de]20 82 8cJSR CurrentSprite_UpdateFlipMask [a5e1]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [a5e4]4c 8e 8cJMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; Sprites_UpdateBehavior ;
[a5e7]SPRITE_BEHAVIORS: [a5e7]fb a8pointer SpriteBehavior_MoveTowardPlayer-1; [0]: Common [a5e9]8a a9pointer SpriteBehavior_Wait-1; [1]: Common [a5eb]09 8dpointer SpriteBehavior_BounceAndExpire-1; [2]: Item: Dropped coin [a5ed]6c 9epointer SpriteBehavior_Garbled3-1; [3]: [a5ef]40 a9pointer SpriteBehavior_WalkForward-1; [4]: Common [a5f1]ad a6pointer SpriteBehavior_Return-1; [5]: [a5f3]31 9apointer SpriteBehavior_EnemyUnused18-1; [6]: [a5f5]cb abpointer SpriteBehavior_EnemyDeath-1; [7]: [a5f7]cb abpointer SpriteBehavior_EnemyDeath-1; [8]: [a5f9]dd a9pointer SpriteBehavior_Hop-1; [9]: Enemy: Monodron [a5fb]82 9bpointer SpriteBehavior_Ripasheiku-1; [10]: Boss: Dragon boss guy [a5fd]ad a6pointer SpriteBehavior_Return-1; [11]: [a5ff]88 9cpointer SpriteBehavior_Borabohra-1; [12]: [a601]f1 9cpointer SpriteBehavior_Pakukame-1; [13]: [a603]a8 9dpointer SpriteBehavior_Zorugeriru-1; [14]: [a605]02 9fpointer SpriteBehavior_KingGrieve-1; [15]: [a607]e2 9fpointer SpriteBehavior_ShadowEura-1; [16]: [a609]96 a9pointer SpriteBehavior_SomethingEyeball_17-1; [17]: [a60b]85 aapointer SpriteBehavior_SomethingZoradohna_18-1; [18]: [a60d]f9 aapointer SpriteBehavior_MoveVertically-1; [19]: [a60f]d6 a8pointer SpriteBehavior__a8d7-1; [20]: [a611]77 a9pointer SpriteBehavior_Fall-1; [21]: Common [a613]a2 8dpointer SpriteBehavior_NecronAides-1; [22]: Enemy: Necron Aides [a615]ce 8epointer SpriteBehavior_Bihoruda-1; [23]: Enemy: Bihoruda [a617]2d 8fpointer SpriteBehavior_Lilith-1; [24]: Enemy: Lilith [a619]e6 8fpointer SpriteBehavior_Yuinaru-1; [25]: Enemy: Yuinaru [a61b]5f 90pointer SpriteBehavior_Nash-1; [26]: Enemy: Nash [a61d]ca a0pointer SpriteBehavior_EnemyMagic-1; [27]: [a61f]1c a1pointer _thunk_SpriteBehavior__a0cb-1; [28]: [a621]53 a1pointer SpriteBehavior_Unknown_29-1; [29]: [a623]83 92pointer _thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7-1; [30]: [a625]25 abpointer SpriteBehavior_FlashScreenHitPlayer-1; [31]: [a627]df 92pointer SpriteBehavior_GiantBees-1; [32]: Enemy: Giant Bees [a629]e4 93pointer SpriteBehavior_Naga-1; [33]: Enemy: Naga [a62b]37 95pointer SpriteBehavior_Yareeka-1; [34]: Enemy: Yareeka [a62d]bf 95pointer SpriteBehavior_Magman-1; [35]: Enemy: Magman [a62f]31 96pointer SpriteBehavior_EnemyUnused36-1; [36]: Enemy: Unused 36 [a631]1c 97pointer SpriteBehavior_EnemyUnused39-1; [37]: Enemy: Unused 39 [a633]ad 97pointer SpriteBehavior_EnemyUnused43-1; [38]: Enemy: Unused 43 [a635]64 98pointer SpriteBehavior_Tamazutsu-1; [39]: Enemy: Tamazutsu [a637]96 94pointer SpriteBehavior_SirGawaineWolfman-1; [40]: Enemy: Sir Gawaine Enemy: Wolfman [a639]45 a2pointer SpriteBehavior_Ointment-1; [41]: Item: Ointment [a63b]5e a2pointer SpriteBehavior_Glove-1; [42]: Item: Glove [a63d]53 a3pointer SpriteBehavior_BattleSuitDroppedByZoradohna-1; [43]: Item: Battle Suit [a63f]83 a3pointer SpriteBehavior_BattleHelmetDroppedByZoradohna-1; [44]: Item: Battle Helmet [a641]be a3pointer SpriteBehavior_DragonSlayerDroppedByKingGrieve-1; [45]: Item: Dragon Slayer [a643]ee a3pointer SpriteBehavior_MattockDroppedFromRipasheiku-1; [46]: Item: Mattock [a645]12 a4pointer SpriteBehavior_WingBootsDroppedByZorugeriru-1; [47]: Item: Wing Boots [a647]36 a4pointer SpriteBehavior_BlackOnyxDropFromZoradohna-1; [48]: Item: Black Onyx [a649]5a a4pointer SpriteBehavior_PendantDroppedFromRipasheiku-1; [49]: Item: Pendant [a64b]89 a4pointer SpriteBehavior_RandomlyShowItem_50-1; [50]: [a64d]9c a4pointer SpriteBehavior_RandomlyShowItem_51-1; [51]: [a64f]af a4pointer SpriteBehavior_RandomlyShowItem_52-1; [52]: [a651]c2 a4pointer SpriteBehavior_RandomlyShowItem_53-1; [53]: [a653]d5 a4pointer SpriteBehavior_RandomlyShowItem_54-1; [54]: [a655]fb a4pointer SpriteBehavior_RandomlyShowItem_55-1; [55]: [a657]e8 a4pointer SpriteBehavior_RandomlyShowItem_56-1; [56]: [a659]1d a3pointer SpriteBehavior_Fountain-1; [57]: Spring of Fountain [a65b]57 a5pointer SpriteBehavior_SpringOfFortress-1; [58]: Spring of Fortress [a65d]6e a5pointer SpriteBehavior_SpringOfSky-1; [59]: Spring of Sky [a65f]85 a5pointer SpriteBehavior_SpringOfJoker-1; [60]: Spring of Joker [a661]7e a4pointer SpriteBehavior_ShowMagicalRod-1; [61]: Item: Magical Rod [a663]66 abpointer SpriteBehavior_BossDeath-1; [62]: Effect: Boss Death [a665]76 8epointer SpriteBehavior_BuzzAround-1; [63]: Enemy: Hornet [a667]28 91pointer SpriteBehavior_Ishiisu-1; [64]: Enemy: Ishiisu [a669]b2 91pointer SpriteBehavior_ExecutionHood-1; [65]: Enemy: Execution Hood
;============================================================================ ; TODO: Document Sprites_UpdateBehavior ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; LAB_PRG14__802e [$PRG14::802e] ;============================================================================
[a66b]Sprites_UpdateBehavior: [a66b]ad 2a 04LDA a:DurationHourGlass [a66e]30 09BMI @LAB_PRG14__a679 [a670]bc cc 02LDY a:CurrentSprites_Entities,X [a673]b9 44 b5LDA a:SPRITE_CATEGORIES_BY_ENTITY,Y [a676]d0 01BNE @LAB_PRG14__a679
; ; This is an enemy sprite, and the Hour Glass is active. ; Don't run any behavior updates. ;
[a678]60RTS
; ; Set the currently-processing sprite behavior address to ; the one from the current sprites map. ;
[a679]@LAB_PRG14__a679: [a679]ae 78 03LDX a:CurrentSpriteIndex [a67c]bd 54 03LDA a:CurrentSprites_BehaviorAddrs_L,X [a67f]85 caSTA Sprites_ReadInfoAddr [a681]bd 5c 03LDA a:CurrentSprites_BehaviorAddrs_U,X [a684]85 cbSTA Sprites_ReadInfoAddr_U [a686]20 bc a6JSR BScripts_LoadNextOp [a689]bd d4 02LDA a:CurrentSprites_Behaviors,X [a68c]0aASL A [a68d]a8TAY [a68e]c0 84CPY #$84 [a690]b0 0fBCS @_updateCurrentSprites [a692]a9 a6LDA #$a6 [a694]48PHA [a695]a9 a0LDA #$a0 [a697]48PHA [a698]b9 e8 a5LDA a:SPRITE_BEHAVIORS+1,Y [a69b]48PHA [a69c]b9 e7 a5LDA a:SPRITE_BEHAVIORS,Y [a69f]48PHA [a6a0]60RTS
; ; Update the map of current sprites to sprite behavior addresses ; with the updated address. ;
[a6a1]@_updateCurrentSprites: [a6a1]ae 78 03LDX a:CurrentSpriteIndex [a6a4]a5 caLDA Sprites_ReadInfoAddr [a6a6]9d 54 03STA a:CurrentSprites_BehaviorAddrs_L,X [a6a9]a5 cbLDA Sprites_ReadInfoAddr_U [a6ab]9d 5c 03STA a:CurrentSprites_BehaviorAddrs_U,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_Return ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f1] ; SPRITE_BEHAVIORS [$PRG14::a5fd] ; Sprites_CountdownBehavior ;============================================================================
[a6ae]SpriteBehavior_Return: [a6ae]60RTS
;============================================================================ ; TODO: Document Sprites_CountdownBehavior ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Fall ; SpriteBehavior_MoveVertically ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_Wait ; SpriteBehavior_WalkForward ; SpriteBehavior__a91e ;============================================================================
[a6af]Sprites_CountdownBehavior: [a6af]bd 64 03LDA a:CurrentSprites_BehaviorArg1,X [a6b2]f0 faBEQ SpriteBehavior_Return [a6b4]de 64 03DEC a:CurrentSprites_BehaviorArg1,X [a6b7]d0 f5BNE SpriteBehavior_Return [a6b9]4c ac a8JMP Sprite_FinishBehavior
;============================================================================ ; TODO: Document BScripts_LoadNextOp ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; BScript_Op_AddToSpriteData ; BScript_Op_FinishBehavior ; BScript_Op_GoTo ; BScript_Op_SetPhase ; SpriteOp_CheckDistanceToPlayer_X ; SpriteOp_CheckDistanceToPlayer_Y ; Sprites_MaybeDisableAndGoTo ; Sprites_Maybe_Skip2AndLoadNextAction ; Sprites_UpdateBehavior ;============================================================================
[a6bc]BScripts_LoadNextOp: [a6bc]a0 00LDY #$00 [a6be]b1 caLDA (Sprites_ReadInfoAddr),Y [a6c0]c9 ffCMP #$ff [a6c2]f0 0bBEQ @LAB_PRG14__a6cf [a6c4]0aASL A [a6c5]a8TAY [a6c6]b9 d9 a6LDA a:BSCRIPT_OP_HANDLERS+1,Y [a6c9]48PHA [a6ca]b9 d8 a6LDA a:BSCRIPT_OP_HANDLERS,Y [a6cd]48PHA [a6ce]60RTS [a6cf]@LAB_PRG14__a6cf: [a6cf]bd d4 02LDA a:CurrentSprites_Behaviors,X [a6d2]29 7fAND #$7f [a6d4]9d d4 02STA a:CurrentSprites_Behaviors,X [a6d7]60RTS
; ; XREFS: ; BScripts_LoadNextOp ;
[a6d8]BSCRIPT_OP_HANDLERS: [a6d8]fe a6pointer BScript_Op_SwitchBehavior-1; [0]: [a6da]2b a7pointer BScript_Op_MaybeDisableAndGoTo-1; [1]: [a6dc]71 a7pointer BScript_Op_RunAction-1; [2]: [a6de]e4 a7pointer BScript_Op_CheckDistanceToPlayer-1; [3]: [a6e0]6d a8pointer BScript_Op_FinishBehavior-1; [4]: [a6e2]4b a7pointer BScript_Op_GoTo-1; [5]: [a6e4]4e a8pointer BScript_Op_AddToSpriteData-1; [6]: [a6e6]e7 a6pointer BScript_Op_SetPhase-1; [7]:
;============================================================================ ; TODO: Document BScript_Op_SetPhase ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6e6] ;============================================================================
[a6e8]BScript_Op_SetPhase: [a6e8]bd d4 02LDA a:CurrentSprites_Behaviors,X [a6eb]30 03BMI @LAB_PRG14__a6f0 [a6ed]4c 71 a7JMP RETURN_A771 [a6f0]@LAB_PRG14__a6f0: [a6f0]a0 01LDY #$01 [a6f2]b1 caLDA (Sprites_ReadInfoAddr),Y [a6f4]9d e4 02STA a:CurrentSprites_Phases,X [a6f7]a9 02LDA #$02 [a6f9]20 79 a8JSR Sprites_IncrementScriptAddr [a6fc]4c bc a6JMP BScripts_LoadNextOp
;============================================================================ ; TODO: Document BScript_Op_SwitchBehavior ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6d8] ;============================================================================
[a6ff]BScript_Op_SwitchBehavior: [a6ff]bd d4 02LDA a:CurrentSprites_Behaviors,X [a702]30 03BMI @LAB_PRG14__a707 [a704]4c 71 a7JMP RETURN_A771 [a707]@LAB_PRG14__a707: [a707]fe e4 02INC a:CurrentSprites_Phases,X [a70a]a9 01LDA #$01 [a70c]20 79 a8JSR Sprites_IncrementScriptAddr [a70f]a0 00LDY #$00 [a711]b1 caLDA (Sprites_ReadInfoAddr),Y [a713]9d d4 02STA a:CurrentSprites_Behaviors,X [a716]c8INY [a717]b1 caLDA (Sprites_ReadInfoAddr),Y [a719]9d 64 03STA a:CurrentSprites_BehaviorArg1,X [a71c]a9 02LDA #$02 [a71e]20 79 a8JSR Sprites_IncrementScriptAddr [a721]bd d4 02LDA a:CurrentSprites_Behaviors,X [a724]c9 06CMP #$06 [a726]d0 03BNE @_return [a728]4c 17 99JMP FUN_PRG14__9917 [a72b]@_return: [a72b]60RTS
;============================================================================ ; TODO: Document BScript_Op_MaybeDisableAndGoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6da] ;============================================================================
[a72c]BScript_Op_MaybeDisableAndGoTo: [a72c]bd d4 02LDA a:CurrentSprites_Behaviors,X [a72f]30 03BMI Sprites_MaybeDisableAndGoTo [a731]4c 71 a7JMP RETURN_A771
;============================================================================ ; TODO: Document Sprites_MaybeDisableAndGoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BScript_Op_MaybeDisableAndGoTo ;============================================================================
[a734]Sprites_MaybeDisableAndGoTo: [a734]a9 01LDA #$01 [a736]20 79 a8JSR Sprites_IncrementScriptAddr [a739]a0 00LDY #$00 [a73b]b1 caLDA (Sprites_ReadInfoAddr),Y [a73d]48PHA [a73e]c8INY [a73f]b1 caLDA (Sprites_ReadInfoAddr),Y [a741]85 cbSTA Sprites_ReadInfoAddr_U [a743]68PLA [a744]85 caSTA Sprites_ReadInfoAddr [a746]20 ac a8JSR Sprite_FinishBehavior [a749]4c bc a6JMP BScripts_LoadNextOp
;============================================================================ ; TODO: Document BScript_Op_GoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6e2] ;============================================================================
[a74c]BScript_Op_GoTo: [a74c]bd d4 02LDA a:CurrentSprites_Behaviors,X [a74f]30 03BMI @LAB_PRG14__a754 [a751]4c 71 a7JMP RETURN_A771 [a754]@LAB_PRG14__a754: [a754]a9 01LDA #$01 [a756]20 79 a8JSR Sprites_IncrementScriptAddr [a759]a0 00LDY #$00 [a75b]b1 caLDA (Sprites_ReadInfoAddr),Y [a75d]48PHA [a75e]c8INY [a75f]b1 caLDA (Sprites_ReadInfoAddr),Y [a761]85 cbSTA Sprites_ReadInfoAddr_U [a763]68PLA [a764]85 caSTA Sprites_ReadInfoAddr [a766]a9 00LDA #$00 [a768]9d e4 02STA a:CurrentSprites_Phases,X [a76b]20 ac a8JSR Sprite_FinishBehavior [a76e]4c bc a6JMP BScripts_LoadNextOp
; ; XREFS: ; BScript_Op_GoTo ; BScript_Op_MaybeDisableAndGoTo ; BScript_Op_RunAction ; BScript_Op_SetPhase ; BScript_Op_SwitchBehavior ;
[a771]RETURN_A771: [a771]60RTS
;============================================================================ ; TODO: Document BScript_Op_RunAction ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6dc] ;============================================================================
[a772]BScript_Op_RunAction: [a772]bd d4 02LDA a:CurrentSprites_Behaviors,X [a775]10 faBPL RETURN_A771 [a777]a0 01LDY #$01 [a779]b1 caLDA (Sprites_ReadInfoAddr),Y [a77b]0aASL A [a77c]a8TAY [a77d]a9 a7LDA #$a7 [a77f]48PHA [a780]a9 8bLDA #$8b [a782]48PHA [a783]b9 95 a7LDA a:BSCRIPT_ACTIONS+1,Y [a786]48PHA [a787]b9 94 a7LDA a:BSCRIPT_ACTIONS,Y [a78a]48PHA [a78b]60RTS
;============================================================================ ; TODO: Document Sprites_Maybe_Skip2AndLoadNextAction ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[a78c]Sprites_Maybe_Skip2AndLoadNextAction: [a78c]a9 02LDA #$02 [a78e]20 79 a8JSR Sprites_IncrementScriptAddr [a791]4c bc a6JMP BScripts_LoadNextOp
; ; XREFS: ; BScript_Op_RunAction ;
[a794]BSCRIPT_ACTIONS: [a794]7a 86pointer BScript_Action_FacePlayerX-1; [0]: Face Player (X) [a796]06 84pointer BScript_Action_FlipXDirection-1; [1]: Flip X Direction [a798]90 86pointer BScript_Action_FacePlayerY-1; [2]: Face Player (Y) [a79a]0f 84pointer BScript_Action_FlipYDirection-1; [3]: Flip Y Direction [a79c]ac a7pointer BScript_Action_RandomlyFlipXDirection-1; [4]: Randomly Flip X Direction [a79e]c8 a7pointer BScript_Action_RandomlyFlipYDirection-1; [5]: Randomly Flip Y Direction [a7a0]a3 a7pointer BScript_Action_RiseUp-1; [6]: Rise Up [a7a2]38 92pointer BScript_Action_CastMagic-1; [7]: Cast Magic
;============================================================================ ; BScript Action $06: Rise Up ; ; This will clear the Falling flag for the sprite, causing it to rise up. ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a7a0] ;============================================================================
[a7a4]BScript_Action_RiseUp: [a7a4]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a7a7]29 7fAND #$7f; Clear the Falling bit. [a7a9]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a7ac]60RTS
;============================================================================ ; BScript Action $04: Randomly flip the X direction. ; ; This will generate a random number. If it's < 128, the sprite will face ; right. Otherwise it will face left. ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a79c] ; SpriteBehavior_Lilith ;============================================================================
[a7ad]BScript_Action_RandomlyFlipXDirection: [a7ad]20 6e caJSR GetRandom; Load a random value. [a7b0]ae 78 03LDX a:CurrentSpriteIndex; X = Current sprite index. [a7b3]c9 80CMP #$80; Is the random value < 128? [a7b5]b0 09BCS @_setFaceRight; If so, jump to set facing right. [a7b7]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite flags. [a7ba]29 feAND #$fe; Clear the Facing Right bit. [a7bc]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a7bf]60RTS [a7c0]@_setFaceRight: [a7c0]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite flags. [a7c3]09 01ORA #$01; Set the Facing Right bit. [a7c5]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a7c8]60RTS
;============================================================================ ; BScript Action $05: Randomly flip the Y direction. ; ; This will generate a random number. If it's < 128, the sprite will fall. ; Otherwise it will rise. ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a79e] ;============================================================================
[a7c9]BScript_Action_RandomlyFlipYDirection: [a7c9]20 6e caJSR GetRandom; Load a random value. [a7cc]ae 78 03LDX a:CurrentSpriteIndex; X = Current sprite index. [a7cf]c9 80CMP #$80; Is the random value < 128? [a7d1]b0 09BCS @_setFalling; If so, jump to set falling. [a7d3]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite flags. [a7d6]29 7fAND #$7f; Clear the falling bit. [a7d8]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a7db]60RTS [a7dc]@_setFalling: [a7dc]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite flags. [a7df]09 80ORA #$80; Set the falling bit. [a7e1]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a7e4]60RTS
;============================================================================ ; BScript Op $03: Check Distance to Player. ; ; Check if the distance between the player and sprite is ; within or outside the given value. ; ; This can check in either the X or Y direction. Depending ; on the result, this will jump to one of two addresses ; defined in the arguments. ; ; Arguments: ; 1. Check direction (0=X, 1=Y) (1 byte) ; 2. Distance value (1 byte) ; 3. Address to jump to if distance < value (2 bytes) ; 4. Address to jump to if distance >= value (2 bytes) ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6de] ;============================================================================
[a7e5]BScript_Op_CheckDistanceToPlayer: [a7e5]a0 01LDY #$01; Y = 1 (op direction argument) [a7e7]b1 caLDA (Sprites_ReadInfoAddr),Y; Read the direction to check. [a7e9]0aASL A; Convert to a word boundary for the lookup table. [a7ea]a8TAY; Y = A [a7eb]b9 f5 a7LDA a:SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS+1,Y; Load the lower byte of the subcommand address. [a7ee]48PHA; Push to the stack. [a7ef]b9 f4 a7LDA a:SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS,Y; Load the upper byte of the subcommand address. [a7f2]48PHA; Push to the stack. [a7f3]60RTS
;============================================================================ ; Subcommand table for the Check Distance to Player op. ; ; Keys correspond to the first argument to the op. ; ; XREFS: ; BScript_Op_CheckDistanceToPlayer ;============================================================================
; ; XREFS: ; BScript_Op_CheckDistanceToPlayer ;
[a7f4]SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS: [a7f4]f7 a7pointer SpriteOp_CheckDistanceToPlayer_X-1; [0]: [a7f6]29 a8pointer SpriteOp_CheckDistanceToPlayer_Y-1; [1]:
;============================================================================ ; Jump to an address based on X distance between sprite and player. ; ; If the distance is < the value provided to the script, ; this will return the first address (parameter 3). ; ; If the distance is >= the value provided to the script, ; this will return the second address (parameter 4). ; ; INPUTS: ; X: ; The sprite index. ; ; CurrentSprites_Behaviors: ; The current sprite behaviors. ; ; Sprites_ReadInfoAddr: ; The read address for the script arguments. ; ; OUTPUTS: ; Sprites_ReadInfoAddr: ; The new address to read from. ; ; CALLS: ; Sprites_IncrementScriptAddr ; BScripts_LoadNextOp ; Sprite_CalcDistanceXToPlayer ; ; XREFS: ; SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS ; [$PRG14::a7f4] ;============================================================================
[a7f8]SpriteOp_CheckDistanceToPlayer_X: [a7f8]bd d4 02LDA a:CurrentSprites_Behaviors,X; A = Sprite behavior [a7fb]10 08BPL @_checkDistance; If the behavior is ready, jump to check.
; ; The behavior is not ready, so skip this check and all ; arguments. ;
[a7fd]a9 07LDA #$07; 7 = bytes to skip. [a7ff]20 79 a8JSR Sprites_IncrementScriptAddr; Skip them. [a802]4c bc a6JMP BScripts_LoadNextOp; Load the next operation.
; ; Check the distance to the player. This will result in ; jumping to code that sets the address for one of the ; script jump address destinations. ;
[a805]@_checkDistance: [a805]20 f8 82JSR Sprite_CalcDistanceXToPlayer; Calculate the distance between the sprite and player. [a808]a0 02LDY #$02; Y = 2 (op distance argument) [a80a]d1 caCMP (Sprites_ReadInfoAddr),Y; Is distance < argument? [a80c]90 0fBCC @_isLessThan; If so, jump.
; ; The calculated distance is >= the distance argument. ; Choose the second address. ;
[a80e]a0 04LDY #$04; Y = 4 [a810]c8INY; Y++ (5) [a811]b1 caLDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a813]48PHA; Push to the stack. [a814]c8INY; Y++ (6) [a815]b1 caLDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a817]85 cbSTA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a819]68PLA; Pop the lower byte. [a81a]85 caSTA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a81c]60RTS; Return.
; ; The calculated distance is < the distance argument. ; Choose the first address. ;
[a81d]@_isLessThan: [a81d]c8INY; Y++ (3) [a81e]b1 caLDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a820]48PHA; Push to the stack. [a821]c8INY; Y++ (4) [a822]b1 caLDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a824]85 cbSTA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a826]68PLA; Pop the lower byte. [a827]85 caSTA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a829]60RTS; Return.
;============================================================================ ; Jump to an address based on Y distance between sprite and player. ; ; If the distance is < the value provided to the script, ; this will return the first address (parameter 3). ; ; If the distance is >= the value provided to the script, ; this will return the second address (parameter 4). ; ; INPUTS: ; X: ; The sprite index. ; ; CurrentSprites_Behaviors: ; The current sprite behaviors. ; ; Sprites_ReadInfoAddr: ; The read address for the script arguments. ; ; OUTPUTS: ; Sprites_ReadInfoAddr: ; The new address to read from. ; ; CALLS: ; Sprites_IncrementScriptAddr ; BScripts_LoadNextOp ; Sprite_CalcDistanceYToPlayer ; ; XREFS: ; SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS ; [$PRG14::a7f6] ;============================================================================
[a82a]SpriteOp_CheckDistanceToPlayer_Y: [a82a]bd d4 02LDA a:CurrentSprites_Behaviors,X; A = Sprite behavior [a82d]10 08BPL @_checkDistance; If the behavior is ready, jump to check.
; ; The behavior is not ready, so skip this check and all ; arguments. ;
[a82f]a9 07LDA #$07; 7 = bytes to skip. [a831]20 79 a8JSR Sprites_IncrementScriptAddr; Skip them. [a834]4c bc a6JMP BScripts_LoadNextOp; Load the next operation.
; ; Check the distance to the player. This will result in ; a value for Y, which will be the offset to the jump address ; - 1. ;
[a837]@_checkDistance: [a837]20 1b 83JSR Sprite_CalcDistanceYToPlayer; Calculate the distance between the sprite and player. [a83a]a0 02LDY #$02; Y = 2 (op distance argument) [a83c]d1 caCMP (Sprites_ReadInfoAddr),Y; Is distance < argument? [a83e]90 02BCC @_isLessThan; If so, jump.
; ; The calculated distance is >= the distance argument. ; Choose the first address. ;
[a840]a0 04LDY #$04; Y = 4 (byte before second address)
; ; Load the jump address for the script based on Y above. ;
[a842]@_isLessThan: [a842]c8INY; Y++ (target jump address) [a843]b1 caLDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a845]48PHA; Push to the stack. [a846]c8INY; Y++ [a847]b1 caLDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a849]85 cbSTA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a84b]68PLA; Pop the lower byte. [a84c]85 caSTA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a84e]60RTS; Return.
;============================================================================ ; Op $06: Add Value To Sprite Data ; ; Add a value to the existing value in a Current Sprites ; data block of RAM, as in: ; ; existing_value += new_value ; ; This is valid for several collections of Current ; Sprite data in RAM, including: ; ; * CurrentSprites_Flags ; * CurrentSprites_XPos_Full ; * CurrentSprites_YPos ; * CurrentSprites_HitCounter ; * CurrentSprites_Values ; ; ; The value will be set for the current sprite in that array. ; ; Arguments: ; 1. Sprites data RAM address (2 bytes) ; 2. Value to set (1 byte) ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6e4] ;============================================================================
[a84f]BScript_Op_AddToSpriteData:
; ; Load the address from parameter 1. ;
[a84f]a0 01LDY #$01; Y = 1 (argument 1, byte 1) [a851]b1 caLDA (Sprites_ReadInfoAddr),Y; Load the lower byte. [a853]85 02STA Temp_Addr_L; Store as the lower byte of the address to write to. [a855]c8INY; Y++ (argument 1, byte 2) [a856]b1 caLDA (Sprites_ReadInfoAddr),Y; Load the upper byte. [a858]85 03STA Temp_Addr_U; Store as the upper byte of the address to write to.
; ; Load the value to set from parameter 2. ;
[a85a]c8INY; Y++ (argument 2) [a85b]b1 caLDA (Sprites_ReadInfoAddr),Y; Load the value.
; ; Set the value in the address. ;
[a85d]48PHA; Push the new value to the stack. [a85e]8aTXA; A = X (sprite index) [a85f]a8TAY; Y = A [a860]68PLA; Pop the new value from the stack. [a861]18CLC [a862]71 02ADC (Temp_Addr_L),Y; Add the value from the address to our argument value. [a864]91 02STA (Temp_Addr_L),Y; Store it as the new value.
; ; Jump to the next op and load it. ;
[a866]a9 04LDA #$04; A = 4 (number of bytes to skip) [a868]20 79 a8JSR Sprites_IncrementScriptAddr; Skip over those bytes. [a86b]4c bc a6JMP BScripts_LoadNextOp; Load the next op.
;============================================================================ ; Op $04: Finish Behavior ; ; Immediately finish a behavior. ; ; This will unset the behavior ID and continue on with the next operation. ; ; Arguments: None ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6e0] ;============================================================================
[a86e]BScript_Op_FinishBehavior: [a86e]a9 01LDA #$01; A = 1 (number of bytes to skip) [a870]20 79 a8JSR Sprites_IncrementScriptAddr; Skip over the byte. [a873]20 ac a8JSR Sprite_FinishBehavior; Finish the current behavior. [a876]4c bc a6JMP BScripts_LoadNextOp; Load the next op.
;============================================================================ ; Increment the address for a sprite's behavior info. ; ; INPUTS: ; A: ; The offset to increment by. ; ; Sprites_ReadInfoAddr: ; Sprites_ReadInfoAddr+1: ; The current address of behavior information. ; ; OUTPUTS: ; Sprites_ReadInfoAddr: ; The new address of the behavior information. ; ; XREFS: ; BScript_Op_AddToSpriteData ; BScript_Op_FinishBehavior ; BScript_Op_GoTo ; BScript_Op_SetPhase ; BScript_Op_SwitchBehavior ; SpriteBehavior_Hop ; SpriteBehavior_MoveTowardPlayer ; SpriteBehavior_MoveVertically ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_WalkForward ; SpriteBehavior__a8d7 ; SpriteOp_CheckDistanceToPlayer_X ; SpriteOp_CheckDistanceToPlayer_Y ; Sprites_MaybeDisableAndGoTo ; Sprites_Maybe_Skip2AndLoadNextAction ;============================================================================
[a879]Sprites_IncrementScriptAddr: [a879]18CLC; C = 0 [a87a]65 caADC Sprites_ReadInfoAddr; A = offset + lower byte of the behavior address If overflow, C = 1 [a87c]85 caSTA Sprites_ReadInfoAddr; Store it. [a87e]a5 cbLDA Sprites_ReadInfoAddr_U; A = upper byte of the behavior address [a880]69 00ADC #$00; Add carry, if set. [a882]85 cbSTA Sprites_ReadInfoAddr_U; Store it. [a884]60RTS
;============================================================================ ; Return whether or not a sprite's behavior is disabled. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Flags: ; Flags for the current sprites. ; ; OUTPUTS: ; Z: ; 1 if the behavior is disabled. ; 0 if it is enabled. ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_Bihoruda ; SpriteBehavior_BlackOnyxDropFromZoradohna ; SpriteBehavior_Borabohra ; SpriteBehavior_BossDeath ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_BuzzAround ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ; SpriteBehavior_EnemyDeath ; SpriteBehavior_EnemyMagic ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_EnemyUnused39 ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_Fall ; SpriteBehavior_FlashScreenHitPlayer ; SpriteBehavior_Fountain ; SpriteBehavior_Garbled3 ; SpriteBehavior_GiantBees ; SpriteBehavior_Glove ; SpriteBehavior_Hop ; SpriteBehavior_Ishiisu ; SpriteBehavior_KingGrieve ; SpriteBehavior_Lilith ; SpriteBehavior_Magman ; SpriteBehavior_MattockDroppedFromRipasheiku ; SpriteBehavior_MoveTowardPlayer ; SpriteBehavior_MoveVertically ; SpriteBehavior_Naga ; SpriteBehavior_Nash ; SpriteBehavior_NecronAides ; SpriteBehavior_Ointment ; SpriteBehavior_Pakukame ; SpriteBehavior_PendantDroppedFromRipasheiku ; SpriteBehavior_RandomlyShowItem_50 ; SpriteBehavior_RandomlyShowItem_51 ; SpriteBehavior_RandomlyShowItem_52 ; SpriteBehavior_RandomlyShowItem_53 ; SpriteBehavior_RandomlyShowItem_54 ; SpriteBehavior_RandomlyShowItem_55 ; SpriteBehavior_RandomlyShowItem_56 ; SpriteBehavior_Ripasheiku ; SpriteBehavior_ShadowEura ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_SpringOfFortress ; SpriteBehavior_SpringOfJoker ; SpriteBehavior_SpringOfSky ; SpriteBehavior_Tamazutsu ; SpriteBehavior_Unknown_29 ; SpriteBehavior_Wait ; SpriteBehavior_WalkForward ; SpriteBehavior_WingBootsDroppedByZorugeriru ; SpriteBehavior_Yareeka ; SpriteBehavior_Yuinaru ; SpriteBehavior_Zorugeriru ; SpriteBehavior__a8d7 ;============================================================================
[a885]Sprite_IsBehaviorNotReady: [a885]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a888]29 40AND #$40; Set Z = ready not set. [a88a]60RTS
;============================================================================ ; Disable a sprite's behavior. ; ; This is used once a sprite's behavior functionality needs ; to pause behavior. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Flags: ; Flags for the current sprites. ; ; OUTPUTS: ; CurrentSprites_Flags: ; The updated flags. ; ; XREFS: ; Sprite_FinishBehavior ; Sprite_ReplaceWithDroppedItem ; Sprite_ReplaceWithMattock ; Sprite_SetDeathEntity ;============================================================================
[a88b]Sprite_SetBehaviorNotReady: [a88b]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a88e]29 bfAND #$bf; Clear the Ready flag. [a890]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a893]60RTS
;============================================================================ ; Enable a sprite's behavior. ; ; This is used once a sprite is set up, or when the sprite's ; behavior handling wants to pause and then resume behavior. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Flags: ; Flags for the current sprites. ; ; OUTPUTS: ; CurrentSprites_Flags: ; The updated flags. ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_Bihoruda ; SpriteBehavior_BlackOnyxDropFromZoradohna ; SpriteBehavior_Borabohra ; SpriteBehavior_BossDeath ; SpriteBehavior_BounceAndExpire ; SpriteBehavior_BuzzAround ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ; SpriteBehavior_EnemyDeath ; SpriteBehavior_EnemyMagic ; SpriteBehavior_EnemyUnused36 ; SpriteBehavior_EnemyUnused39 ; SpriteBehavior_EnemyUnused43 ; SpriteBehavior_ExecutionHood ; SpriteBehavior_Fall ; SpriteBehavior_FlashScreenHitPlayer ; SpriteBehavior_Garbled3 ; SpriteBehavior_GiantBees ; SpriteBehavior_Hop ; SpriteBehavior_Ishiisu ; SpriteBehavior_KingGrieve ; SpriteBehavior_Lilith ; SpriteBehavior_Magman ; SpriteBehavior_MattockDroppedFromRipasheiku ; SpriteBehavior_MoveTowardPlayer ; SpriteBehavior_MoveVertically ; SpriteBehavior_Naga ; SpriteBehavior_Nash ; SpriteBehavior_NecronAides ; SpriteBehavior_Pakukame ; SpriteBehavior_PendantDroppedFromRipasheiku ; SpriteBehavior_Ripasheiku ; SpriteBehavior_ShadowEura ; SpriteBehavior_SirGawaineWolfman ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_SomethingZoradohna_18 ; SpriteBehavior_Tamazutsu ; SpriteBehavior_Unknown_29 ; SpriteBehavior_Wait ; SpriteBehavior_WalkForward ; SpriteBehavior_WingBootsDroppedByZorugeriru ; SpriteBehavior_Yareeka ; SpriteBehavior_Yuinaru ; SpriteBehavior_Zorugeriru ; SpriteBehavior__a8d7 ; Sprite_SetReadyAndFallIfNeeded ; Sprites_MaybeResetPhaseAndEnable ;============================================================================
[a894]Sprite_SetBehaviorReady: [a894]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a897]09 40ORA #$40; Set the Ready flag. [a899]9d dc 02STA a:CurrentSprites_Flags,X; Store it. [a89c]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[a89d]CurrentSpriteFlags_SetBit5: [a89d]bd dc 02LDA a:CurrentSprites_Flags,X [a8a0]09 20ORA #$20 [a8a2]9d dc 02STA a:CurrentSprites_Flags,X [a8a5]60RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[a8a6]Sprite_ClearFlags: [a8a6]a9 00LDA #$00 [a8a8]9d dc 02STA a:CurrentSprites_Flags,X [a8ab]60RTS
;============================================================================ ; TODO: Document Sprite_FinishBehavior ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BScript_Op_FinishBehavior ; BScript_Op_GoTo ; SpriteBehavior_FlashScreenHitPlayer ; SpriteBehavior_Hop ; Sprites_CountdownBehavior ; Sprites_MaybeDisableAndGoTo ; _thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7 ;============================================================================
[a8ac]Sprite_FinishBehavior: [a8ac]20 8b a8JSR Sprite_SetBehaviorNotReady [a8af]bd d4 02LDA a:CurrentSprites_Behaviors,X [a8b2]09 80ORA #$80 [a8b4]9d d4 02STA a:CurrentSprites_Behaviors,X [a8b7]60RTS
;============================================================================ ; Return the previous phase for the sprite. ; ; INPUTS: ; X: ; The sprite's index. ; ; CurrentSprites_Phases: ; The sprite phases. ; ; OUTPUTS: ; A: ; The previous phase. ; ; XREFS: ; SpriteUpdateHandler_Enemy_Ikeda ; SpriteUpdateHandler_Enemy_Monodron ; SpriteUpdateHandler_Enemy_Zombie ;============================================================================
[a8b8]Sprite_GetPreviousSpritePhase: [a8b8]bd e4 02LDA a:CurrentSprites_Phases,X; Load the current phase. [a8bb]38SEC [a8bc]e9 01SBC #$01; Subtract 1 [a8be]60RTS; Return the value.
;============================================================================ ; Set a sprite to be visible. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; OUTPUTS: ; CurrentSprites_Flags: ; The updated flags. ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_BlackOnyxDropFromZoradohna ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ; SpriteBehavior_Fountain ; SpriteBehavior_MattockDroppedFromRipasheiku ; SpriteBehavior_Nash ; SpriteBehavior_PendantDroppedFromRipasheiku ; SpriteBehavior_SpringOfFortress ; SpriteBehavior_SpringOfJoker ; SpriteBehavior_SpringOfSky ; SpriteBehavior_Tamazutsu ; SpriteBehavior_WingBootsDroppedByZorugeriru ; Sprite_ShowIfNoEnemies ;============================================================================
[a8bf]Sprite_SetVisible: [a8bf]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a8c2]09 10ORA #$10; Set the visibility flag. [a8c4]9d dc 02STA a:CurrentSprites_Flags,X; And save it. [a8c7]60RTS
;============================================================================ ; Return whether a sprite is hidden. ; ; INPUTS: ; X: ; The index of the sprite. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; OUTPUTS: ; Z: ; 1 if the sprite is hidden. ; 0 if the sprite is visible. ; ; XREFS: ; CurrentSprite_CheckHitPlayer ; CurrentSprite_UpdateState ; Player_HitSpriteWithWeapon ; Sprite_CheckHitByCastMagic ;============================================================================
[a8c8]Sprites_IsSpriteHidden: [a8c8]bd dc 02LDA a:CurrentSprites_Flags,X; Load the sprite's flags. [a8cb]29 10AND #$10; Check the visible flag. [a8cd]60RTS; And return Z.
;============================================================================ ; Set a sprite to be hidden. ; ; INPUTS: ; X: ; The index of the sprite to hide. ; ; CurrentSprites_Flags: ; The sprite's flags. ; ; OUTPUTS: ; CurrentSprites_Flags: ; The updated flags. ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_BlackOnyxDropFromZoradohna ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ; SpriteBehavior_Fountain ; SpriteBehavior_MattockDroppedFromRipasheiku ; SpriteBehavior_Nash ; SpriteBehavior_PendantDroppedFromRipasheiku ; SpriteBehavior_Springs_UpdateFlowing ; SpriteBehavior_Tamazutsu ; SpriteBehavior_WingBootsDroppedByZorugeriru ; Sprite_ShowIfNoEnemies ;============================================================================
[a8ce]Sprites_HideSprite: [a8ce]bd dc 02LDA a:CurrentSprites_Flags,X; Load the flags for the given sprite. [a8d1]29 efAND #$ef; Clear the visible flag. [a8d3]9d dc 02STA a:CurrentSprites_Flags,X; Set the new flags. [a8d6]60RTS
;============================================================================ ; TODO: Document SpriteBehavior__a8d7 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60f] ;============================================================================
[a8d7]SpriteBehavior__a8d7: [a8d7]20 85 a8JSR Sprite_IsBehaviorNotReady [a8da]d0 42BNE SpriteBehavior__a91e [a8dc]a0 00LDY #$00 [a8de]b1 caLDA (Sprites_ReadInfoAddr),Y [a8e0]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a8e3]c8INY [a8e4]b1 caLDA (Sprites_ReadInfoAddr),Y [a8e6]9d f4 02STA a:CurrentSprites_BehaviorData3,X [a8e9]a9 02LDA #$02 [a8eb]20 79 a8JSR Sprites_IncrementScriptAddr [a8ee]20 94 a8JSR Sprite_SetBehaviorReady [a8f1]bd dc 02LDA a:CurrentSprites_Flags,X [a8f4]09 02ORA #$02 [a8f6]9d dc 02STA a:CurrentSprites_Flags,X [a8f9]4c 1e a9JMP SpriteBehavior__a91e
;============================================================================ ; TODO: Document SpriteBehavior_MoveTowardPlayer ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5e7] ;============================================================================
[a8fc]SpriteBehavior_MoveTowardPlayer: [a8fc]20 85 a8JSR Sprite_IsBehaviorNotReady [a8ff]d0 1dBNE SpriteBehavior__a91e [a901]a0 00LDY #$00 [a903]b1 caLDA (Sprites_ReadInfoAddr),Y [a905]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a908]c8INY [a909]b1 caLDA (Sprites_ReadInfoAddr),Y [a90b]9d f4 02STA a:CurrentSprites_BehaviorData3,X [a90e]a9 02LDA #$02 [a910]20 79 a8JSR Sprites_IncrementScriptAddr [a913]20 94 a8JSR Sprite_SetBehaviorReady [a916]bd dc 02LDA a:CurrentSprites_Flags,X [a919]29 fdAND #$fd [a91b]9d dc 02STA a:CurrentSprites_Flags,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior__a91e ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_MoveTowardPlayer ; SpriteBehavior__a8d7 ;============================================================================
[a91e]SpriteBehavior__a91e: [a91e]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [a921]90 0bBCC @LAB_PRG14__a92e [a923]20 4a 86JSR CurrentSprite_HandleFall [a926]bd dc 02LDA a:CurrentSprites_Flags,X [a929]29 02AND #$02 [a92b]f0 01BEQ @LAB_PRG14__a92e [a92d]60RTS [a92e]@LAB_PRG14__a92e: [a92e]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [a931]8d 74 03STA a:Arg_DeltaX_Frac [a934]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [a937]8d 75 03STA a:Arg_DeltaX_Full [a93a]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [a93d]20 af a6JSR Sprites_CountdownBehavior [a940]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_WalkForward ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ef] ;============================================================================
[a941]SpriteBehavior_WalkForward: [a941]20 85 a8JSR Sprite_IsBehaviorNotReady [a944]d0 15BNE @LAB_PRG14__a95b [a946]a0 00LDY #$00 [a948]b1 caLDA (Sprites_ReadInfoAddr),Y [a94a]9d ec 02STA a:CurrentSprites_BehaviorData2,X [a94d]c8INY [a94e]b1 caLDA (Sprites_ReadInfoAddr),Y [a950]9d f4 02STA a:CurrentSprites_BehaviorData3,X [a953]a9 02LDA #$02 [a955]20 79 a8JSR Sprites_IncrementScriptAddr [a958]20 94 a8JSR Sprite_SetBehaviorReady [a95b]@LAB_PRG14__a95b: [a95b]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [a95e]90 06BCC @LAB_PRG14__a966 [a960]20 07 84JSR BScript_Action_FlipXDirection [a963]4c 4a 86JMP CurrentSprite_HandleFall [a966]@LAB_PRG14__a966: [a966]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [a969]8d 74 03STA a:Arg_DeltaX_Frac [a96c]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [a96f]8d 75 03STA a:Arg_DeltaX_Full [a972]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [a975]4c af a6JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Fall ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a611] ;============================================================================
[a978]SpriteBehavior_Fall: [a978]20 85 a8JSR Sprite_IsBehaviorNotReady [a97b]d0 03BNE @LAB_PRG14__a980 [a97d]20 94 a8JSR Sprite_SetBehaviorReady [a980]@LAB_PRG14__a980: [a980]20 1f 86JSR Sprites_SetCurrentSpriteCanMove [a983]90 0eBCC Call_Sprites_CountdownBehavior [a985]20 4a 86JSR CurrentSprite_HandleFall [a988]4c af a6JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Wait ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5e9] ;============================================================================
[a98b]SpriteBehavior_Wait: [a98b]20 85 a8JSR Sprite_IsBehaviorNotReady [a98e]d0 03BNE Call_Sprites_CountdownBehavior [a990]20 94 a8JSR Sprite_SetBehaviorReady
; ; XREFS: ; SpriteBehavior_Fall ; SpriteBehavior_Wait ;
[a993]Call_Sprites_CountdownBehavior: [a993]4c af a6JMP Sprites_CountdownBehavior [a996]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_SomethingEyeball_17 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a609] ;============================================================================
[a997]SpriteBehavior_SomethingEyeball_17: [a997]20 85 a8JSR Sprite_IsBehaviorNotReady [a99a]d0 21BNE @_ready [a99c]a0 00LDY #$00 [a99e]b1 caLDA (Sprites_ReadInfoAddr),Y [a9a0]9d 1c 03STA a:CurrentSprites_BehaviorState_XFrac,X [a9a3]c8INY [a9a4]b1 caLDA (Sprites_ReadInfoAddr),Y [a9a6]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [a9a9]c8INY [a9aa]b1 caLDA (Sprites_ReadInfoAddr),Y [a9ac]9d 24 03STA a:CurrentSprites_BehaviorState_YFrac,X [a9af]c8INY [a9b0]b1 caLDA (Sprites_ReadInfoAddr),Y [a9b2]9d 14 03STA a:CurrentSprites_BehaviorState_YFull,X [a9b5]a9 04LDA #$04 [a9b7]20 79 a8JSR Sprites_IncrementScriptAddr [a9ba]20 94 a8JSR Sprite_SetBehaviorReady [a9bd]@_ready: [a9bd]bd 1c 03LDA a:CurrentSprites_BehaviorState_XFrac,X [a9c0]8d 74 03STA a:Arg_DeltaX_Frac [a9c3]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [a9c6]8d 75 03STA a:Arg_DeltaX_Full [a9c9]20 27 84JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [a9cc]bd 24 03LDA a:CurrentSprites_BehaviorState_YFrac,X [a9cf]8d 76 03STA a:Arg_DeltaY_Frac [a9d2]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [a9d5]8d 77 03STA a:Arg_DeltaY_Full [a9d8]20 9c 85JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [a9db]4c af a6JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Hop ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f9] ;============================================================================
[a9de]SpriteBehavior_Hop: [a9de]20 85 a8JSR Sprite_IsBehaviorNotReady [a9e1]d0 31BNE @LAB_PRG14__aa14 [a9e3]a0 00LDY #$00 [a9e5]b1 caLDA (Sprites_ReadInfoAddr),Y [a9e7]9d 1c 03STA a:CurrentSprites_BehaviorState_XFrac,X [a9ea]c8INY [a9eb]b1 caLDA (Sprites_ReadInfoAddr),Y [a9ed]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [a9f0]c8INY [a9f1]b1 caLDA (Sprites_ReadInfoAddr),Y [a9f3]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [a9f6]a9 03LDA #$03 [a9f8]20 79 a8JSR Sprites_IncrementScriptAddr [a9fb]a9 00LDA #$00 [a9fd]9d 64 03STA a:CurrentSprites_BehaviorArg1,X [aa00]20 94 a8JSR Sprite_SetBehaviorReady [aa03]bd dc 02LDA a:CurrentSprites_Flags,X [aa06]29 7fAND #$7f [aa08]9d dc 02STA a:CurrentSprites_Flags,X [aa0b]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aa0e]b9 72 aaLDA a:SPRITE_BEHAVIOUR_HOP_START_TICKS,Y [aa11]9d f4 02STA a:CurrentSprites_BehaviorData3,X [aa14]@LAB_PRG14__aa14: [aa14]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [aa17]8d 75 03STA a:Arg_DeltaX_Full [aa1a]bd 1c 03LDA a:CurrentSprites_BehaviorState_XFrac,X [aa1d]8d 74 03STA a:Arg_DeltaX_Frac [aa20]20 94 84JSR Sprites_Something_SomethingAndMoveHoriz [aa23]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aa26]b9 77 aaLDA a:SPRITE_BEHAVIOR_HOP_GRAVITY,Y [aa29]a8TAY [aa2a]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [aa2d]20 e1 83JSR Sprites_CalcYFromGravity [aa30]48PHA [aa31]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aa34]b9 7c aaLDA a:SPRITE_BEHAVIOR_HOP_JUMP_STRENGTH,Y [aa37]a8TAY [aa38]68PLA [aa39]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [aa3c]20 c4 85JSR Sprite_MoveVertical [aa3f]90 08BCC @LAB_PRG14__aa49 [aa41]bd dc 02LDA a:CurrentSprites_Flags,X [aa44]10 03BPL @LAB_PRG14__aa49 [aa46]4c ac a8JMP Sprite_FinishBehavior [aa49]@LAB_PRG14__aa49: [aa49]fe f4 02INC a:CurrentSprites_BehaviorData3,X [aa4c]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aa4f]b9 77 aaLDA a:SPRITE_BEHAVIOR_HOP_GRAVITY,Y [aa52]a8TAY [aa53]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [aa56]39 f7 83AND a:SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [aa59]d0 16BNE @_return [aa5b]bd dc 02LDA a:CurrentSprites_Flags,X [aa5e]30 03BMI @LAB_PRG14__aa63
; ; Begin falling. ;
[aa60]4c 10 84JMP BScript_Action_FlipYDirection [aa63]@LAB_PRG14__aa63: [aa63]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aa66]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [aa69]d9 81 aaCMP a:SPRITE_BEHAVIOR_HOP_GROUND_TICKS,Y [aa6c]90 03BCC @_return [aa6e]de f4 02DEC a:CurrentSprites_BehaviorData3,X [aa71]@_return: [aa71]60RTS
; ; XREFS: ; SpriteBehavior_Hop ;
[aa72]SPRITE_BEHAVIOUR_HOP_START_TICKS: [aa72]40.byte $40; [0]: [aa73]20.byte $20; [1]: [aa74]10.byte $10; [2]: Monodron [aa75]08.byte $08; [3]: [aa76]10.byte $10; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa77]SPRITE_BEHAVIOR_HOP_GRAVITY: [aa77]02.byte $02; [0]: [aa78]03.byte $03; [1]: [aa79]04.byte $04; [2]: [aa7a]05.byte $05; [3]: [aa7b]04.byte $04; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa7c]SPRITE_BEHAVIOR_HOP_JUMP_STRENGTH: [aa7c]04.byte $04; [0]: [aa7d]05.byte $05; [1]: [aa7e]06.byte $06; [2]: [aa7f]07.byte $07; [3]: [aa80]07.byte $07; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa81]SPRITE_BEHAVIOR_HOP_GROUND_TICKS: [aa81]c0.byte $c0; [0]: [aa82]60.byte $60; [1]: [aa83]30.byte $30; [2]: [aa84]18.byte $18; [3]: [aa85]30.byte $30; [4]:
;============================================================================ ; TODO: Document SpriteBehavior_SomethingZoradohna_18 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60b] ;============================================================================
[aa86]SpriteBehavior_SomethingZoradohna_18: [aa86]20 85 a8JSR Sprite_IsBehaviorNotReady [aa89]d0 23BNE @LAB_PRG14__aaae [aa8b]a0 00LDY #$00 [aa8d]b1 caLDA (Sprites_ReadInfoAddr),Y [aa8f]9d 1c 03STA a:CurrentSprites_BehaviorState_XFrac,X [aa92]c8INY [aa93]b1 caLDA (Sprites_ReadInfoAddr),Y [aa95]9d 0c 03STA a:CurrentSprites_BehaviorState_XFull,X [aa98]c8INY [aa99]b1 caLDA (Sprites_ReadInfoAddr),Y [aa9b]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [aa9e]a9 03LDA #$03 [aaa0]20 79 a8JSR Sprites_IncrementScriptAddr [aaa3]20 94 a8JSR Sprite_SetBehaviorReady [aaa6]bd dc 02LDA a:CurrentSprites_Flags,X [aaa9]09 80ORA #$80 [aaab]9d dc 02STA a:CurrentSprites_Flags,X [aaae]@LAB_PRG14__aaae: [aaae]bd 0c 03LDA a:CurrentSprites_BehaviorState_XFull,X [aab1]8d 75 03STA a:Arg_DeltaX_Full [aab4]bd 1c 03LDA a:CurrentSprites_BehaviorState_XFrac,X [aab7]8d 74 03STA a:Arg_DeltaX_Frac [aaba]20 19 84JSR Sprite_MoveHorizAndTurnAroundIfNeeded [aabd]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aac0]b9 f2 aaLDA a:BYTE_ARRAY_PRG14__aaf2,Y [aac3]a8TAY [aac4]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [aac7]20 e1 83JSR Sprites_CalcYFromGravity [aaca]48PHA [aacb]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aace]b9 f6 aaLDA a:BYTE_ARRAY_PRG14__aaf6,Y [aad1]a8TAY [aad2]68PLA [aad3]20 d1 83JSR Sprites_CalcVerticalSpriteMovement [aad6]20 c4 85JSR Sprite_MoveVertical [aad9]fe f4 02INC a:CurrentSprites_BehaviorData3,X [aadc]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X [aadf]b9 f2 aaLDA a:BYTE_ARRAY_PRG14__aaf2,Y [aae2]a8TAY [aae3]88DEY [aae4]bd f4 02LDA a:CurrentSprites_BehaviorData3,X [aae7]39 f7 83AND a:SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [aaea]d0 03BNE @LAB_PRG14__aaef [aaec]4c 10 84JMP BScript_Action_FlipYDirection [aaef]@LAB_PRG14__aaef: [aaef]4c af a6JMP Sprites_CountdownBehavior
; ; XREFS: ; SpriteBehavior_SomethingZoradohna_18 ;
[aaf2]BYTE_ARRAY_PRG14__aaf2: [aaf2]03.byte $03; [0]: [aaf3]04.byte $04; [1]: [aaf4]05.byte $05; [2]: [aaf5]06.byte $06; [3]:
; ; XREFS: ; SpriteBehavior_SomethingZoradohna_18 ;
[aaf6]BYTE_ARRAY_PRG14__aaf6: [aaf6]03.byte $03; [0]: [aaf7]05.byte $05; [1]: [aaf8]05.byte $05; [2]: [aaf9]07.byte $07; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_MoveVertically ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60d] ;============================================================================
[aafa]SpriteBehavior_MoveVertically: [aafa]20 85 a8JSR Sprite_IsBehaviorNotReady [aafd]d0 15BNE @LAB_PRG14__ab14 [aaff]a0 00LDY #$00 [ab01]b1 caLDA (Sprites_ReadInfoAddr),Y [ab03]9d 24 03STA a:CurrentSprites_BehaviorState_YFrac,X [ab06]c8INY [ab07]b1 caLDA (Sprites_ReadInfoAddr),Y [ab09]9d 14 03STA a:CurrentSprites_BehaviorState_YFull,X [ab0c]a9 02LDA #$02 [ab0e]20 79 a8JSR Sprites_IncrementScriptAddr [ab11]20 94 a8JSR Sprite_SetBehaviorReady [ab14]@LAB_PRG14__ab14: [ab14]bd 24 03LDA a:CurrentSprites_BehaviorState_YFrac,X [ab17]8d 76 03STA a:Arg_DeltaY_Frac [ab1a]bd 14 03LDA a:CurrentSprites_BehaviorState_YFull,X [ab1d]8d 77 03STA a:Arg_DeltaY_Full [ab20]20 64 85JSR Sprite_MoveVertAndFlipIfNeeded [ab23]4c af a6JMP Sprites_CountdownBehavior
;============================================================================ ; Behavior $1F: Flashes the screen and hit player. ; ; This turns the screen greyscale for a frame and damages the player for ; 10HP. ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a625] ;============================================================================
[ab26]SpriteBehavior_FlashScreenHitPlayer: [ab26]20 85 a8JSR Sprite_IsBehaviorNotReady [ab29]d0 0eBNE @LAB_PRG14__ab39 [ab2b]a9 02LDA #$02 [ab2d]9d ec 02STA a:CurrentSprites_BehaviorData2,X [ab30]a5 0bLDA PPU_Mask [ab32]09 01ORA #$01 [ab34]85 0bSTA PPU_Mask [ab36]20 94 a8JSR Sprite_SetBehaviorReady [ab39]@LAB_PRG14__ab39: [ab39]de ec 02DEC a:CurrentSprites_BehaviorData2,X [ab3c]d0 28BNE @_return [ab3e]a5 0bLDA PPU_Mask [ab40]29 feAND #$fe [ab42]85 0bSTA PPU_Mask [ab44]a9 04LDA #$04 [ab46]20 e4 d0JSR Sound_PlayEffect [ab49]a9 3cLDA #$3c [ab4b]85 adSTA Player_InvincibilityPhase [ab4d]a5 a5LDA Player_StatusFlag [ab4f]09 02ORA #$02 [ab51]85 a5STA Player_StatusFlag [ab53]a9 00LDA #$00 [ab55]8d bc 04STA a:Arg_PlayerHealthDelta_L [ab58]a9 0aLDA #$0a [ab5a]8d bd 04STA a:Arg_PlayerHealthDelta_U [ab5d]20 8e c0JSR Player_ReduceHP [ab60]ae 78 03LDX a:CurrentSpriteIndex [ab63]4c ac a8JMP Sprite_FinishBehavior [ab66]@_return: [ab66]60RTS
;============================================================================ ; TODO: Document SpriteBehavior_BossDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a663] ;============================================================================
[ab67]SpriteBehavior_BossDeath: [ab67]20 85 a8JSR Sprite_IsBehaviorNotReady [ab6a]d0 0bBNE @LAB_PRG14__ab77 [ab6c]a9 00LDA #$00 [ab6e]9d ec 02STA a:CurrentSprites_BehaviorData2,X [ab71]9d e4 02STA a:CurrentSprites_Phases,X [ab74]20 94 a8JSR Sprite_SetBehaviorReady [ab77]@LAB_PRG14__ab77: [ab77]fe ec 02INC a:CurrentSprites_BehaviorData2,X [ab7a]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [ab7d]c9 08CMP #$08 [ab7f]90 2eBCC @_return [ab81]fe e4 02INC a:CurrentSprites_Phases,X [ab84]bc e4 02LDY a:CurrentSprites_Phases,X [ab87]c0 0aCPY #$0a [ab89]b0 25BCS @LAB_PRG14__abb0 [ab8b]b5 baLDA CurrentSprites_XPos_Full,X [ab8d]18CLC [ab8e]79 b6 abADC a:BYTE_ARRAY_PRG14__abb6,Y [ab91]95 baSTA CurrentSprites_XPos_Full,X [ab93]b5 c2LDA CurrentSprites_YPos,X [ab95]18CLC [ab96]79 c1 abADC a:BYTE_ARRAY_PRG14__abc1,Y [ab99]95 c2STA CurrentSprites_YPos,X [ab9b]a9 00LDA #$00 [ab9d]9d ec 02STA a:CurrentSprites_BehaviorData2,X [aba0]a9 03LDA #$03 [aba2]20 e4 d0JSR Sound_PlayEffect [aba5]bd e4 02LDA a:CurrentSprites_Phases,X [aba8]c9 05CMP #$05 [abaa]b0 03BCS @_return [abac]4c 21 acJMP Sprite_HandleDeathDropIfPossible [abaf]@_return: [abaf]60RTS [abb0]@LAB_PRG14__abb0: [abb0]a9 ffLDA #$ff [abb2]9d cc 02STA a:CurrentSprites_Entities,X [abb5]60RTS
; ; XREFS: ; SpriteBehavior_BossDeath ;
[abb6]BYTE_ARRAY_PRG14__abb6: [abb6]00.byte $00; [0]: [abb7]20.byte $20; [1]: [abb8]f0.byte $f0; [2]: [abb9]f0.byte $f0; [3]: [abba]20.byte $20; [4]: [abbb]e0.byte $e0; [5]: [abbc]20.byte $20; [6]: [abbd]f0.byte $f0; [7]: [abbe]f0.byte $f0; [8]: [abbf]20.byte $20; [9]: [abc0]e0.byte $e0; [10]:
; ; XREFS: ; SpriteBehavior_BossDeath ;
[abc1]BYTE_ARRAY_PRG14__abc1: [abc1]00.byte $00; [0]: [abc2]20.byte $20; [1]: [abc3]f0.byte $f0; [2]: [abc4]10.byte $10; [3]: [abc5]e0.byte $e0; [4]: [abc6]00.byte $00; [5]: [abc7]20.byte $20; [6]: [abc8]f0.byte $f0; [7]: [abc9]10.byte $10; [8]: [abca]e0.byte $e0; [9]: [abcb]00.byte $00; [10]:
;============================================================================ ; TODO: Document SpriteBehavior_EnemyDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f5] ; SPRITE_BEHAVIORS [$PRG14::a5f7] ;============================================================================
[abcc]SpriteBehavior_EnemyDeath: [abcc]20 85 a8JSR Sprite_IsBehaviorNotReady [abcf]d0 08BNE @LAB_PRG14__abd9 [abd1]a9 00LDA #$00 [abd3]9d ec 02STA a:CurrentSprites_BehaviorData2,X [abd6]20 94 a8JSR Sprite_SetBehaviorReady [abd9]@LAB_PRG14__abd9: [abd9]fe ec 02INC a:CurrentSprites_BehaviorData2,X [abdc]bd ec 02LDA a:CurrentSprites_BehaviorData2,X [abdf]c9 08CMP #$08 [abe1]90 08BCC @LAB_PRG14__abeb [abe3]20 21 acJSR Sprite_HandleDeathDropIfPossible [abe6]a9 ffLDA #$ff [abe8]9d cc 02STA a:CurrentSprites_Entities,X [abeb]@LAB_PRG14__abeb: [abeb]60RTS
;============================================================================ ; Show an effect for the death of a big enemy. ; ; This will replace the sprite with a big enemy death effect. ; ; INPUTS: ; X: ; The index of the enemy sprite. ; ; OUTPUTS: ; None ; ; XREFS: ; Player_HitEnemyWithMagic ; Player_HitSpriteWithWeapon ;============================================================================
[abec]Sprite_ShowBigEnemyDeathByMagicOrWeapon: [abec]a9 64LDA #$64; 0x64 == Boss death effect. [abee]4c f8 abJMP Sprite_SetDeathEntity; Replace the enemy with it.
;============================================================================ ; Show an effect for the death of a normal enemy by weapon. ; ; This will replace the sprite with an enemy death effect. ; ; INPUTS: ; X: ; The index of the enemy sprite. ; ; OUTPUTS: ; None ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
[abf1]Sprite_ShowNormalEnemyDeathByWeapon: [abf1]a9 13LDA #$13; 0x13 == Enemy death effect. [abf3]4c f8 abJMP Sprite_SetDeathEntity; Replace the enemy with it.
;============================================================================ ; Show an effect for the death of a normal enemy by magic. ; ; This will clear sprite state, stop the sprite behavior, ; and set an explosion animation. ; ; INPUTS: ; X: ; The index of the enemy sprite. ; ; OUTPUTS: ; None ; ; XREFS: ; Player_HitEnemyWithMagic ;============================================================================
[abf6]Sprite_ShowNormalEnemyDeathByMagic: [abf6]a9 14LDA #$14
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprite_SetDeathEntity ; ; INPUTS: ; A ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_ShowBigEnemyDeathByMagicOrWeapon ; Sprite_ShowNormalEnemyDeathByWeapon ;============================================================================
[abf8]Sprite_SetDeathEntity: [abf8]48PHA [abf9]bd cc 02LDA a:CurrentSprites_Entities,X [abfc]9d fc 02STA a:CurrentSprites_InternalBehaviorStates,X [abff]68PLA [ac00]9d cc 02STA a:CurrentSprites_Entities,X [ac03]0aASL A [ac04]a8TAY [ac05]b9 2d adLDA a:SPRITE_BSCRIPTS,Y [ac08]9d 54 03STA a:CurrentSprites_BehaviorAddrs_L,X [ac0b]b9 2e adLDA a:SPRITE_BSCRIPTS+1,Y [ac0e]9d 5c 03STA a:CurrentSprites_BehaviorAddrs_U,X [ac11]a9 ffLDA #$ff [ac13]9d d4 02STA a:CurrentSprites_Behaviors,X [ac16]9d 34 03STA a:CurrentSprites_HitByMagicBehavior,X [ac19]a9 00LDA #$00 [ac1b]9d ec 02STA a:CurrentSprites_BehaviorData2,X [ac1e]4c 8b a8JMP Sprite_SetBehaviorNotReady
;============================================================================ ; Check and handle dropping an item on an enemy's death. ; ; This will check if there's room on the screen for a ; drop and, if so, run the drop handler. That will then ; check if a drop should be spawned by the enemy and, if ; so, spawn one. ; ; INPUTS: ; ... ; ; OUTPUTS: ; CurrentSpriteIndex: ; The new current sprite index, reflecting the ; dropped item or dead sprite. ; ; CALLS: ; Sprites_HasMaxOnScreen ; Sprite_RunDeathDropHandler ; ; XREFS: ; SpriteBehavior_BossDeath ; SpriteBehavior_EnemyDeath ;============================================================================
[ac21]Sprite_HandleDeathDropIfPossible: [ac21]20 36 a2JSR Sprites_HasMaxOnScreen; Check if there's room for sprites on the screen. [ac24]b0 06BCS @_return; If not, return. [ac26]20 2d acJSR Sprite_RunDeathDropHandler; There's room, so run the drop handler to possibly spawn a drop. [ac29]ae 78 03LDX a:CurrentSpriteIndex; Restore the current sprite index to X. [ac2c]@_return: [ac2c]60RTS
;============================================================================ ; TODO: Document Sprite_RunDeathDropHandler ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_HandleDeathDropIfPossible ;============================================================================
[ac2d]Sprite_RunDeathDropHandler: [ac2d]84 00STY Temp_00; Store the new sprite entity temporarily. [ac2f]bc fc 02LDY a:CurrentSprites_InternalBehaviorStates,X; Load the internal behavior state of the dead sprite. [ac32]b9 72 b6LDA a:SPRITE_ENTITY_DROP_VALUES_INDEX,Y; Load the index of the drop value for this new sprite. [ac35]c9 ffCMP #$ff [ac37]f0 37BEQ @_return [ac39]c9 40CMP #$40 [ac3b]b0 33BCS @_return [ac3d]85 01STA Temp_01 [ac3f]a8TAY [ac40]b9 ed acLDA a:SPRITE_DROP_VALUES,Y [ac43]a4 00LDY Temp_00 [ac45]99 6c 03STA a:CurrentSprites_Values,Y [ac48]b5 baLDA CurrentSprites_XPos_Full,X [ac4a]99 ba 00STA a:CurrentSprites_XPos_Full,Y [ac4d]b5 c2LDA CurrentSprites_YPos,X [ac4f]99 c2 00STA a:CurrentSprites_YPos,Y [ac52]a9 00LDA #$00 [ac54]99 4c 03STA a:CurrentSprites_HitCounter,Y [ac57]a9 ffLDA #$ff [ac59]99 34 03STA a:CurrentSprites_HitByMagicBehavior,Y [ac5c]a0 00LDY #$00 [ac5e]a5 01LDA Temp_01 [ac60]c9 30CMP #$30 [ac62]90 02BCC @LAB_PRG14__ac66 [ac64]c8INY [ac65]c8INY [ac66]@LAB_PRG14__ac66: [ac66]b9 72 acLDA a:SPRITE_DROP_HANDLERS+1,Y [ac69]48PHA [ac6a]b9 71 acLDA a:SPRITE_DROP_HANDLERS,Y [ac6d]48PHA [ac6e]a4 00LDY Temp_00 [ac70]@_return: [ac70]60RTS
;============================================================================ ; XXX Address lookup table for next handlers ; ; ; XREFS: ; Sprite_RunDeathDropHandler ;============================================================================
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[ac71]SPRITE_DROP_HANDLERS: [ac71]74 acpointer Sprites_ReplaceWithCoinDrop-1; Sprites_ReplaceWithCoinDrop
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[ac73]SPRITE_DROP_HANDLERS_LAST: [ac73]9e acpointer Sprite_ReplaceWithBreadDrop-1; Sprite_ReplaceWithBreadDrop
;============================================================================ ; MAYBE: Replace a sprite with a coin. ; ; This is used when a sprite is killed and drops a coin. ; ; INPUTS: ; Y: ; The index of the sprite. ; ; OUTPUTS: ; CurrentSprites_Entities: ; CurrentSprites_BehaviorAddrs_L: ; CurrentSprites_BehaviorAddrs_U: ; CurrentSprites_Behaviors: ; CurrentSprites_HitBoxTypes: ; The new bread sprite state. ; ; CALLS: ; Sprite_SetBehaviorNotReady ; ; XREFS: ; SPRITE_DROP_HANDLERS [$PRG14::ac71] ;============================================================================
[ac75]Sprites_ReplaceWithCoinDrop: [ac75]a9 10LDA #$10 [ac77]20 e4 d0JSR Sound_PlayEffect [ac7a]98TYA [ac7b]aaTAX [ac7c]a9 02LDA #$02
; ; v-- Fall through --v ;
;============================================================================ ; Replace a sprite with a dropped item sprite. ; ; This will replace a sprite on the screen with a dropped ; item (bread or coin). The entity, sprite behavior, ; subtype, and hitbox type will all be set. ; ; INPUTS: ; SPRITE_BEHAVIOR_ADDRS: ; The lookup table of sprite behavior addresses. ; ; OUTPUTS: ; CurrentSprites_Entities: ; The updated sprite entities on the screen. ; ; CurrentSprites_BehaviorAddrs_L: ; CurrentSprites_BehaviorAddrs_U: ; The updated sprite behaviors. ; ; CurrentSprites_Behaviors: ; The updated subtypes. ; ; CurrentSprites_HitBoxTypes: ; The updated hitbox types. ; ; CALLS: ; Sprite_SetBehaviorNotReady ; ; XREFS: ; Sprite_ReplaceWithBreadDrop ;============================================================================
[ac7e]Sprite_ReplaceWithDroppedItem:
; ; Set the sprite entity. ;
[ac7e]9d cc 02STA a:CurrentSprites_Entities,X; Set the provided sprite entity at the given index.
; ; Set the sprite behavior address. ;
[ac81]0aASL A; Convert the sprite entity to a word boundary for the behavior addresses. [ac82]a8TAY; Y = A [ac83]b9 2d adLDA a:SPRITE_BSCRIPTS,Y; Load the lower byte of the sprite behavior for this entity. [ac86]9d 54 03STA a:CurrentSprites_BehaviorAddrs_L,X; Set it as the current behavior for this sprite. [ac89]b9 2e adLDA a:SPRITE_BSCRIPTS+1,Y; Load the upper byte. [ac8c]9d 5c 03STA a:CurrentSprites_BehaviorAddrs_U,X; And set that.
; ; Set the sprite subtype to 0xFF (unset). ;
[ac8f]a9 ffLDA #$ff; A = 0xFF [ac91]9d d4 02STA a:CurrentSprites_Behaviors,X; Set it as the subtype.
; ; Set the sprite hitbox. ;
[ac94]a0 02LDY #$02; Y = 2 [ac96]b9 df b4LDA a:SPRITE_ENTITIES_HITBOX_TYPES,Y; A = hitbox type for Y. [ac99]9d 04 03STA a:CurrentSprites_HitBoxTypes,X; Set as the hitbox.
; ; Disable sprite behaviors. ;
[ac9c]4c 8b a8JMP Sprite_SetBehaviorNotReady; Disable behaviors for this sprite.
;============================================================================ ; Replace a sprite with bread. ; ; This is used when a sprite is killed and drops bread. ; ; INPUTS: ; Y: ; The index of the sprite. ; ; OUTPUTS: ; CurrentSprites_Entities: ; CurrentSprites_BehaviorAddrs_L: ; CurrentSprites_BehaviorAddrs_U: ; CurrentSprites_Behaviors: ; CurrentSprites_HitBoxTypes: ; The new bread sprite state. ; ; CALLS: ; Sprite_SetBehaviorNotReady ; ; XREFS: ; SPRITE_DROP_HANDLERS_LAST [$PRG14::ac73] ;============================================================================
[ac9f]Sprite_ReplaceWithBreadDrop: [ac9f]98TYA; A = Y (sprite index) [aca0]aaTAX; X = A [aca1]a9 01LDA #$01; A = 1 [aca3]4c 7e acJMP Sprite_ReplaceWithDroppedItem
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[aca6]Sprite_ReplaceWithMattock: [aca6]20 dd acJSR @_Sprites_ReplaceWithMattock_HasMaxOnScreen; Check if all sprite slots are populated. [aca9]b0 31BCS @_return; If so, return.
; ; There are unpopulated slots. Populate at the given index. ;
[acab]a9 50LDA #$50; A = Mattock sprite ID. [acad]9d cc 02STA a:CurrentSprites_Entities,X; Store as the entity at this index. [acb0]0aASL A; Normalize to a word boundary. [acb1]a8TAY; Y = A
; ; Set the behavior address for the Mattock to ; BSCRIPTS_OBJ_MATTOCK. ;
[acb2]b9 2d adLDA a:SPRITE_BSCRIPTS,Y; A = 0x1B. [acb5]9d 54 03STA a:CurrentSprites_BehaviorAddrs_L,X; Set as lower byte. [acb8]b9 2e adLDA a:SPRITE_BSCRIPTS+1,Y; A = 0xB2. [acbb]9d 5c 03STA a:CurrentSprites_BehaviorAddrs_U,X; Set as upper byte.
; ; Set the subtype to 0xFF (unset). ;
[acbe]a9 ffLDA #$ff; A = 0xFF [acc0]9d d4 02STA a:CurrentSprites_Behaviors,X; Set subtype to A.
; ; Set the hitbox of the sprite. ;
[acc3]bc cc 02LDY a:CurrentSprites_Entities,X; Y = sprite entity. [acc6]b9 df b4LDA a:SPRITE_ENTITIES_HITBOX_TYPES,Y; A = hitbox type for Y. [acc9]9d 04 03STA a:CurrentSprites_HitBoxTypes,X; Store as the hitbox type.
; ; Set the Y position of the sprite to 32. ;
[accc]a9 20LDA #$20; A = 32 [acce]95 c2STA CurrentSprites_YPos,X; Set as X position.
; ; Set the X position of the sprite as 120. ;
[acd0]a9 78LDA #$78; A = 120 [acd2]95 baSTA CurrentSprites_XPos_Full,X; Set as X position.
; ; Set the PPU address for the sprite. ;
[acd4]a9 90LDA #$90; A = 0x90 [acd6]9d 2c 03STA a:CurrentSprites_PPUOffsets,X; Set as the PPU address. [acd9]4c 8b a8JMP Sprite_SetBehaviorNotReady; Disable behaviors for the sprite. [acdc]@_return: [acdc]60RTS
;============================================================================ ; Return whether all sprite slots are populated. ; ; This is similar to Sprites_HasMaxOnScreen, but ; is specific to Sprite_ReplaceWithMattock. ; ; It differs in that the counter variable is X instead of Y. ; ; INPUTS: ; CurrentSprites_Entities: ; All populated sprite entities on the screen. ; ; OUTPUTS: ; C: ; 1 if all sprite slot are populated. ; 0 if any are unpopulated. ; ; XREFS: ; Sprite_ReplaceWithMattock ;============================================================================
[acdd]@_Sprites_ReplaceWithMattock_HasMaxOnScreen: [acdd]a2 07LDX #$07; X = 7 (our loop counter) [acdf]@_loop: [acdf]bd cc 02LDA a:CurrentSprites_Entities,X; A = sprite entity at X [ace2]c9 ffCMP #$ff; Is it 0xFF (unpopulated)? [ace4]d0 02BNE @_isPopulated; If not, jump to prepare the next loop.
; ; There's an unpopulated sprite. Return a false result. ;
[ace6]18CLC; Set C = 0 [ace7]60RTS; And return it. [ace8]@_isPopulated: [ace8]caDEX; X-- [ace9]10 f4BPL @_loop; If >= 0, loop.
; ; All slots are populated. Return a true result. ;
[aceb]38SEC; Set C = 1 [acec]60RTS; And return it.
;============================================================================ ; XXX Seems related to SPRITE_ENTITY_DROP_VALUES_INDEX. ; ; That table's values are indexes into here. ; ; XREFS: ; Sprite_RunDeathDropHandler ;============================================================================
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[aced]SPRITE_DROP_VALUES: [aced]0a.byte $0a; [0]: [acee]0f.byte $0f; [1]: [acef]12.byte $12; [2]: [acf0]14.byte $14; [3]: [acf1]16.byte $16; [4]: [acf2]1a.byte $1a; [5]: [acf3]20.byte $20; [6]: [acf4]35.byte $35; [7]: [acf5]38.byte $38; [8]: [acf6]3b.byte $3b; [9]: [acf7]3f.byte $3f; [10]: [acf8]40.byte $40; [11]: [acf9]43.byte $43; [12]: [acfa]48.byte $48; [13]: [acfb]4a.byte $4a; [14]: [acfc]4e.byte $4e; [15]: [acfd]55.byte $55; [16]: [acfe]5a.byte $5a; [17]: [acff]62.byte $62; [18]: [ad00]64.byte $64; [19]: [ad01]73.byte $73; [20]: [ad02]78.byte $78; [21]: [ad03]80.byte $80; [22]: [ad04]88.byte $88; [23]: [ad05]96.byte $96; [24]: [ad06]b4.byte $b4; [25]: [ad07]be.byte $be; [26]: [ad08]c8.byte $c8; [27]: [ad09]dc.byte $dc; [28]: [ad0a]e6.byte $e6; [29]: [ad0b]f0.byte $f0; [30]: [ad0c]fa.byte $fa; [31]: [ad0d]00.byte $00; [32]: [ad0e]00.byte $00; [33]: [ad0f]00.byte $00; [34]: [ad10]00.byte $00; [35]: [ad11]00.byte $00; [36]: [ad12]00.byte $00; [37]: [ad13]00.byte $00; [38]: [ad14]00.byte $00; [39]: [ad15]00.byte $00; [40]: [ad16]00.byte $00; [41]: [ad17]00.byte $00; [42]: [ad18]00.byte $00; [43]: [ad19]00.byte $00; [44]: [ad1a]00.byte $00; [45]: [ad1b]00.byte $00; [46]: [ad1c]00.byte $00; [47]: [ad1d]02.byte $02; [48]: [ad1e]04.byte $04; [49]: [ad1f]08.byte $08; [50]: [ad20]10.byte $10; [51]: [ad21]0e.byte $0e; [52]: [ad22]14.byte $14; [53]: [ad23]19.byte $19; [54]: [ad24]1e.byte $1e; [55]: [ad25]1f.byte $1f; [56]: [ad26]28.byte $28; [57]: [ad27]32.byte $32; [58]: [ad28]37.byte $37; [59]: [ad29]3c.byte $3c; [60]: [ad2a]40.byte $40; [61]: [ad2b]46.byte $46; [62]: [ad2c]4c.byte $4c; [63]:
;============================================================================ ; A mapping of sprite entity IDs to behavior state addresses. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[ad2d]SPRITE_BSCRIPTS: [ad2d]f7 adpointer BSCRIPTS_NOOP; [0]:
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[ad2f]SPRITE_BSCRIPTS_1_: [ad2f]f8 adpointer BSCRIPTS_OBJ_BREAD; [1]: Dropped: Bread
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[ad31]SPRITE_BSCRIPTS_2_: [ad31]02 afpointer BSCRIPTS_OBJ_COIN; [2]: Dropped: Coin [ad33]02 aepointer SPRITE_BEHAVIORS_GARBLED_03; [3]: Enemy: ? [ad35]16 aepointer BSCRIPTS_ENEMY_RAIDEN; [4]: Enemy: Raiden [ad37]31 afpointer BSCRIPTS_ENEMY_NECRON_AIDES; [5]: Enemy: Necron Aides [ad39]06 afpointer BSCRIPTS_ENEMY_ZOMBIE; [6]: Enemy: Zombie [ad3b]0a aepointer BSCRIPTS_ENEMY_HORNET; [7]: Enemy: Hornet [ad3d]0e aepointer BSCRIPTS_ENEMY_BIHORUDA; [8]: Enemy: Bihoruda [ad3f]12 aepointer BSCRIPTS_ENEMY_LILITH; [9]: Enemy: Lilith [ad41]20 b1pointer BSCRIPTS_GARBLED_10; [10]: Magic: ? [ad43]35 afpointer BSCRIPTS_ENEMY_YUINARU; [11]: Enemy: Yuinaru [ad45]e5 aepointer BSCRIPTS_ENEMY_SNOWMAN; [12]: Enemy: Snowman [ad47]39 afpointer BSCRIPTS_ENEMY_NASH; [13]: Enemy: Nash [ad49]3d afpointer BSCRIPTS_ENEMY_FIRE_GIANT; [14]: Enemy: Fire Giant [ad4b]54 afpointer BSCRIPTS_ENEMY_ISHIISU; [15]: Enemy: Ishiisu [ad4d]58 afpointer BSCRIPTS_ENEMY_EXECUTION_HOOD; [16]: Enemy: Execution Hood [ad4f]ac b0pointer BSCRIPTS_BOSS_ROKUSUTAHN; [17]: Boss: Rokusutahn [ad51]d3 b0pointer BSCRIPTS_ENEMY_UNUSED_18; [18]: Boss: unused (round body of snake boss)
; ; XREFS: ; Sprite_SetDeathEntity ;
[ad53]SPRITE_BSCRIPTS_19_: [ad53]5c afpointer BSCRIPTS_LIGHTNING_BALL_19; [19]: Effect: Enemy death
; ; XREFS: ; Sprite_SetDeathEntity ;
[ad55]SPRITE_BSCRIPTS_20_: [ad55]60 afpointer BSCRIPTS_ENEMY_CHARRON; [20]: Effect: Lightning ball [ad57]68 afpointer BSCRIPTS_ENEMY_UNUSED_21; [21]: Enemy: Charron [ad59]f7 adpointer BSCRIPTS_NOOP; [22]: Enemy: ? (Unused) [ad5b]89 afpointer BSCRIPTS_ENEMY_GERIBUTA; [23]: Enemy: Geributa [ad5d]98 afpointer BSCRIPTS_ENEMY_SUGATA; [24]: Enemy: Sugata [ad5f]b5 afpointer BSCRIPTS_ENEMY_GRIMLOCK; [25]: Enemy: Grimlock [ad61]1b b0pointer BSCRIPTS_ENEMY_GIANT_BEES; [26]: Enemy: Giant Bees [ad63]1f b0pointer BSCRIPTS_ENEMY_MYCONID; [27]: Enemy: Myconid [ad65]44 b0pointer BSCRIPTS_ENEMY_NAGA; [28]: Enemy: Naga [ad67]a8 b0pointer BSCRIPTS_ENEMY_UNUSED_29; [29]: Enemy: Skeleton Knight (unused) [ad69]48 b0pointer BSCRIPTS_ENEMY_GIANT_STRIDER; [30]: Enemy: Giant Strider [ad6b]7a b0pointer BSCRIPTS_ENEMY_SIR_GAWAINE_WOLFMAN; [31]: Enemy: Sir Gawaine [ad6d]7e b0pointer BSCRIPTS_ENEMY_MASKMAN; [32]: Enemy: Maskman [ad6f]7a b0pointer BSCRIPTS_ENEMY_SIR_GAWAINE_WOLFMAN; [33]: Enemy: Wolfman [ad71]58 b0pointer BSCRIPTS_ENEMY_YAREEKA; [34]: Enemy: Yareeka [ad73]5c b0pointer BSCRIPTS_ENEMY_MAGMAN; [35]: Enemy: Magman [ad75]60 b0pointer BSCRIPTS_ENEMY_UNUSED_36; [36]: Enemy: Curly-tailed guy with spear (unused) [ad77]f7 adpointer BSCRIPTS_NOOP; [37]: Enemy: ? (unused) [ad79]8c aepointer BSCRIPTS_ENEMY_IKEDA; [38]: Enemy: Ikeda [ad7b]64 b0pointer BSCRIPTS_ENEMY_UNUSED_39; [39]: Enemy: Muppet guy (unused) [ad7d]68 b0pointer BSCRIPTS_ENEMY_LAMPREY; [40]: Enemy: Lamprey [ad7f]f7 adpointer BSCRIPTS_NOOP; [41]: Enemy: ? (unused) [ad81]cc aepointer BSCRIPTS_ENEMY_MONODRON; [42]: Enemy: Monodron [ad83]72 b0pointer BSCRIPTS_ENEMY_UNUSED_43; [43]: Enemy: Winged skeleton (unused) [ad85]76 b0pointer BSCRIPTS_ENEMY_TAMAZUTSU; [44]: Enemy: Tamazutsu [ad87]d7 b0pointer BSCRIPTS_BOSS_RIPASHEIKU; [45]: Boss: Ripasheiku [ad89]db b0pointer BSCRIPTS_BOSS_ZORADOHNA; [46]: Boss: Zoradohna [ad8b]08 b1pointer BSCRIPTS_BOSS_BORABOHRA; [47]: Boss: Borabohra [ad8d]0c b1pointer BSCRIPTS_BOSS_PAKUKAME; [48]: Boss: Pakukame [ad8f]10 b1pointer BSCRIPTS_BOSS_ZORUGERIRU; [49]: Boss: Zorugeriru [ad91]14 b1pointer BSCRIPTS_BOSS_KING_GRIEVE; [50]: Boss: King Grieve [ad93]18 b1pointer BSCRIPTS_BOSS_SHADOW_EURA; [51]: Boss: Shadow Eura [ad95]24 b1pointer BSCRIPTS_NPC_WALKING_MAN; [52]: NPC: Walking Man 1 [ad97]31 b1pointer BSCRIPTS_NPC_UNUSED_BLUE_LADY; [53]: NPC: Blue lady (unused) [ad99]49 b1pointer BSCRIPTS_NPC_UNUSED_CHILD; [54]: NPC: Child (unused) [ad9b]67 b1pointer BSCRIPTS_NPC_ARMOR_SALESMAN; [55]: NPC: Armor Salesman [ad9d]6b b1pointer BSCRIPTS_NPC_MARTIAL_ARTS; [56]: NPC: Martial Artist [ad9f]73 b1pointer BSCRIPTS_NPC_PRIEST; [57]: NPC: Priest [ada1]7d b1pointer BSCRIPTS_NPC_KING; [58]: NPC: King [ada3]9e b1pointer BSCRIPTS_NPC_MAGIC_TEACHER; [59]: NPC: Magic Teacher [ada5]ae b1pointer BSCRIPTS_NPC_KEY_SALESMAN; [60]: NPC: Key Salesman [ada7]b2 b1pointer BSCRIPTS_NPC_SMOKING_MAN; [61]: NPC: Smoking Man [ada9]ba b1pointer BSCRIPTS_NPC_MAN_IN_CHAIR; [62]: NPC: Man in Chair [adab]c2 b1pointer BSCRIPTS_NPC_SITTING_MAN; [63]: NPC: Sitting Man [adad]c6 b1pointer BSCRIPTS_NPC_MEAT_SALESMAN; [64]: NPC: Meat Salesman [adaf]cc b1pointer BSCRIPTS_NPC_LADY_BLUE_DRESS_WITH_CUP; [65]: NPC: Lady in Blue Dress with Cup [adb1]de b1pointer BSCRIPTS_NPC_KINGS_GUARD; [66]: NPC: Guard [adb3]a6 b1pointer BSCRIPTS_NPC_DOCTOR; [67]: NPC: Doctor [adb5]eb b1pointer BSCRIPTS_NPC_WALKING_WOMAN_01; [68]: NPC: Walking Woman 1 [adb7]fa b1pointer BSCRIPTS_NPC_WALKING_WOMAN_02; [69]: NPC: Walking Woman 2 [adb9]43 aepointer BSCRIPTS_ENEMY_UNUSED_EYEBALL; [70]: Enemy: Eyeball (unused) [adbb]b1 aepointer BSCRIPTS_ENEMY_ZOZURA; [71]: Enemy: Zozura [adbd]0f b2pointer BSCRIPTS_OBJ_GLOVE; [72]: Item: Glove [adbf]53 b2pointer BSCRIPTS_OBJ_BLACK_ONYX; [73]: Item: Black Onyx [adc1]57 b2pointer BSCRIPTS_OBJ_PENDANT; [74]: Item: Pendant [adc3]17 b2pointer BSCRIPTS_OBJ_POTIONLIKE; [75]: Item: Red Potion [adc5]17 b2pointer BSCRIPTS_OBJ_POTIONLIKE; [76]: Item: Poison [adc7]17 b2pointer BSCRIPTS_OBJ_POTIONLIKE; [77]: Item: Elixir [adc9]0b b2pointer BSCRIPTS_OBJ_OINTMENT; [78]: Item: Ointment [adcb]17 b2pointer BSCRIPTS_OBJ_POTIONLIKE; [79]: Trigger: Intro
; ; XREFS: ; Sprite_ReplaceWithMattock ;
[adcd]SPRITE_BSCRIPTS_80_: [adcd]1b b2pointer BSCRIPTS_OBJ_MATTOCK; [80]: Item: Mattock
; ; XREFS: ; Sprite_Maybe_ResetState ;
[adcf]SPRITE_BSCRIPTS_81_: [adcf]1c b1pointer BSCRIPTS_GARBLED_81; [81]: Magic: ? [add1]23 b2pointer BSCRIPTS_FOUNTAIN; [82]: Effect: Fountain [add3]06 aepointer SPRITE_BEHAVIORS_UNKNOWN_83; [83]: Magic: ? [add5]1c b1pointer BSCRIPTS_GARBLED_81; [84]: Magic: Enemy Fireball [add7]13 b2pointer BSCRIPTS_OBJ_WINGBOOTS; [85]: Item: Wing Boots [add9]1f b2pointer BSCRIPTS_OBJ_HOURGLASS; [86]: Item: Hour Glass [addb]4f b2pointer BSCRIPTS_OBJ_MAGICAL_ROD; [87]: Item: Magical Rod [addd]43 b2pointer BSCRIPTS_OBJ_BATTLE_SUIT; [88]: Item: Battle Suit [addf]47 b2pointer BSCRIPTS_OBJ_BATTLE_HELMET; [89]: Item: Battle Helmet [ade1]4b b2pointer BSCRIPTS_OBJ_DRAGON_SLAYER; [90]: Item: Dragon Slayer [ade3]5b b2pointer BSCRIPTS_OBJ_MATTOCK_QUEST; [91]: Item: Mattock [ade5]5f b2pointer BSCRIPTS_OBJ_WINGSBOOTS_QUEST; [92]: Item: Wing Boots (from quest) [ade7]63 b2pointer BSCRIPTS_OBJ_RED_POTION_RANDOM; [93]: Item: Red Potion [ade9]67 b2pointer BSCRIPTS_OBJ_POISON; [94]: Item: Poison [adeb]6b b2pointer BSCRIPTS_OBJ_GLOVE_RANDOM; [95]: Item: Glove [aded]6f b2pointer BSCRIPTS_OBJ_OINTMENT_RANDOM; [96]: Item: Ointment [adef]2b b2pointer BSCRIPTS_SPRING_OF_FORTRESS; [97]: Effect: Spring of Trunk [adf1]33 b2pointer BSCRIPTS_SPRING_OF_SKY; [98]: Effect: Spring of Sky [adf3]3b b2pointer BSCRIPTS_SPRING_OF_JOKER; [99]: Effect: Spring of Tower [adf5]64 afpointer BSCRIPTS_EFFECT_BOSS_DEATH; [100]: Effect: Boss Death
;============================================================================ ; No-op sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad2d] ; SPRITE_BSCRIPTS [$PRG14::ad59] ; SPRITE_BSCRIPTS [$PRG14::ad77] ; SPRITE_BSCRIPTS [$PRG14::ad7f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad2d] ; SPRITE_BSCRIPTS [$PRG14::ad59] ; SPRITE_BSCRIPTS [$PRG14::ad77] ; SPRITE_BSCRIPTS [$PRG14::ad7f] ;
[adf7]BSCRIPTS_NOOP: [adf7]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Bread drop sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad2f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad2f] ;
[adf8]BSCRIPTS_OBJ_BREAD: [adf8]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [adf9]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [adfa]00.byte $00; |- (unused) [adfb]00.byte $00; |- 0 pixels [adfc]00.byte $00; |- 3 blocks [adfd]03.byte $03; '- Hop mode 3 [adfe]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [adff]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [ae00]ff.byte $ff; |- For 255 ticks [ae01]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Garbled 3 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad33] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad33] ;
[ae02]SPRITE_BEHAVIORS_GARBLED_03: [ae02]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae03]03.byte SPRITE_BEHAVIOR_GARBLED_3; SpriteBehavior [ae04]00.byte $00; byte [ae05]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Unknown 83 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add3] ;
[ae06]SPRITE_BEHAVIORS_UNKNOWN_83: [ae06]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [ae07]1d.byte SPRITE_BEHAVIOR_UNKNOWN_29; SpriteBehavior [ae08]00.byte $00; byte [ae09]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Hornet enemy sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3b] ;
[ae0a]BSCRIPTS_ENEMY_HORNET: [ae0a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae0b]3f.byte SPRITE_BEHAVIOR_BUZZ_AROUND; |- Buzz around [ae0c]00.byte $00; '- (unused) [ae0d]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Bihoruda enemy sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3d] ;
[ae0e]BSCRIPTS_ENEMY_BIHORUDA: [ae0e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae0f]17.byte SPRITE_BEHAVIOR_BIHORUDA; SpriteBehavior [ae10]00.byte $00; byte [ae11]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Lilith enemy sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad3f] ;
[ae12]BSCRIPTS_ENEMY_LILITH: [ae12]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae13]18.byte SPRITE_BEHAVIOR_LILITH; SpriteBehavior [ae14]00.byte $00; byte [ae15]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Raiden enemy sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad35] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad35] ;
[ae16]BSCRIPTS_ENEMY_RAIDEN: [ae16]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae17]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [ae18]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae19]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae1a]14.byte $14; |- For 20 ticks [ae1b]00.byte $00; |- 0 pixels [ae1c]01.byte $01; '- 1 block [ae1d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae1e]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [ae1f]00.byte $00; |- (unused) [ae20]00.byte $00; |- 0 pixels X [ae21]02.byte $02; |- 2 pixels X [ae22]02.byte $02; '- Hop mode 2 [ae23]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae24]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae25]00.byte $00; |- For 0 ticks [ae26]00.byte $00; |- 0 pixels [ae27]01.byte $01; '- 1 block [ae28]@_checkDistanceLoop: [ae28]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance [ae29]00.byte $00; |- X direction [ae2a]30.byte $30; |- If < 48 [ae2b]2f aepointer @_isNearPlayer; |- Then @_isNearPlayer [ae2d]28 aepointer @_checkDistanceLoop; '- Else, @_checkDistanceLoop [ae2f]@_isNearPlayer: [ae2f]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae30]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae31]15.byte SPRITE_BEHAVIOR_FALL; |- Fall [ae32]07.byte $07; '- For 7 ticks [ae33]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae34]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae35]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae36]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [ae37]00.byte $00; |- (unused) [ae38]40.byte $40; |- 64 pixels X [ae39]00.byte $00; |- 0 blocks X [ae3a]00.byte $00; '- Hop mode 0 [ae3b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae3c]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae3d]14.byte $14; |- For 20 ticks [ae3e]e0.byte $e0; |- 224 pixels [ae3f]00.byte $00; '- 0 blocks [ae40]05.byte SPRITE_OP_GOTO; Op: Goto [ae41]16 aepointer BSCRIPTS_ENEMY_RAIDEN; '- BSCRIPTS_ENEMY_RAIDEN
;============================================================================ ; Unused eyeball enemy sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb9] ;
[ae43]BSCRIPTS_ENEMY_UNUSED_EYEBALL: [ae43]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae44]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [ae45]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae46]11.byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- TODO: Move X/Y [ae47]00.byte $00; |- For 0 ticks [ae48]00.byte $00; |- 0 pixels X [ae49]01.byte $01; |- 1 block X [ae4a]00.byte $00; |- 0 pixels Y [ae4b]00.byte $00; '- 0 blocks Y [ae4c]@_waitNearPlayerX: [ae4c]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae4d]00.byte $00; |- X direction [ae4e]30.byte $30; |- If < 48 [ae4f]53 aepointer @_isNearPlayerX; |- Then @_isNearPlayerX [ae51]4c aepointer @_waitNearPlayerX; '- Else @_waitNearPlayerX [ae53]@_isNearPlayerX: [ae53]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae54]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae55]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae56]0a.byte $0a; '- For 10 ticks [ae57]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae58]02.byte SPRITE_ACTION_FACE_PLAYER_Y; '- Face player (Y) [ae59]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae5a]11.byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae5b]00.byte $00; |- For 0 ticks [ae5c]00.byte $00; |- 0 pixels X [ae5d]00.byte $00; |- 0 blocks X [ae5e]00.byte $00; |- 0 pixels Y [ae5f]01.byte $01; '- 1 block Y [ae60]@_waitNearPlayerY: [ae60]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae61]01.byte $01; |- Y direction [ae62]08.byte $08; |- If < 8 [ae63]67 aepointer @_isNearPlayerY; |- Then @_isNearPlayerY [ae65]60 aepointer @_waitNearPlayerY; '- Then @_waitNearPlayerY [ae67]@_isNearPlayerY: [ae67]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae68]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae69]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae6a]0a.byte $0a; '- For 10 ticks [ae6b]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae6c]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae6d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae6e]11.byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae6f]32.byte $32; |- For 50 ticks [ae70]00.byte $00; |- 0 pixels X [ae71]01.byte $01; |- 1 block X [ae72]00.byte $00; |- 0 pixels Y [ae73]00.byte $00; '- 0 blocks Y [ae74]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae75]03.byte SPRITE_ACTION_FLIP_Y_DIRECTION; '- Flip Y direction [ae76]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae77]11.byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae78]32.byte $32; |- For 50 ticks [ae79]00.byte $00; |- 0 pixels X [ae7a]00.byte $00; |- 0 blocks X [ae7b]00.byte $00; |- 0 pixels Y [ae7c]01.byte $01; '- 1 block Y [ae7d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae7e]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae7f]0a.byte $0a; '- For 10 ticks [ae80]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae81]05.byte SPRITE_ACTION_RANDOMLY_FLIP_Y_DIRECTION; '- Randomly flip Y direction [ae82]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae83]11.byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae84]0a.byte $0a; |- For 10 ticks [ae85]00.byte $00; |- 0 pixels X [ae86]00.byte $00; |- 0 blocks X [ae87]00.byte $00; |- 0 pixels Y [ae88]01.byte $01; '- 1 block Y [ae89]05.byte SPRITE_OP_GOTO; Op: Goto [ae8a]43 aepointer BSCRIPTS_ENEMY_UNUSED_EYEBALL; '- BSCRIPTS_ENEMY_UNUSED_EYEBALL
;============================================================================ ; Ikedia sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad79] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad79] ;
[ae8c]BSCRIPTS_ENEMY_IKEDA: [ae8c]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [ae8d]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae8e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae8f]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae90]00.byte $00; |- For 0 ticks [ae91]00.byte $00; |- 0 pixels [ae92]01.byte $01; '- 1 block [ae93]@_waitNearPlayerX: [ae93]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae94]00.byte $00; |- X direction [ae95]40.byte $40; |- If < 64 pixels [ae96]9a aepointer @_isNearPlayerX; |- Then _isNearPlayerX [ae98]93 aepointer @_waitNearPlayerX; '- Else _waitNearPlayerX [ae9a]@_isNearPlayerX: [ae9a]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae9b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae9c]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [ae9d]00.byte $00; |- (unused) [ae9e]00.byte $00; |- 0 pixels X [ae9f]01.byte $01; |- 1 blocks X [aea0]01.byte $01; '- Hop mode 1 [aea1]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aea2]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [aea3]0a.byte $0a; |- For 10 ticks [aea4]08.byte $08; |- 8 pixels [aea5]00.byte $00; '- 0 blocks [aea6]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aea7]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aea8]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aea9]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [aeaa]00.byte $00; |- (unused) [aeab]c0.byte $c0; |- 192 pixels X [aeac]00.byte $00; |- 0 blocks X [aead]02.byte $02; '- Hop mode 2 [aeae]05.byte SPRITE_OP_GOTO; Op: Goto [aeaf]8c aepointer BSCRIPTS_ENEMY_IKEDA; '- BSCRIPTS_ENEMY_IKEDA
;============================================================================ ; Zozura sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbb] ;
[aeb1]BSCRIPTS_ENEMY_ZOZURA: [aeb1]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aeb2]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aeb3]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeb4]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aeb5]3c.byte $3c; |- For 60 ticks [aeb6]60.byte $60; |- 96 pixels [aeb7]00.byte $00; '- 0 blocks [aeb8]05.byte SPRITE_OP_GOTO; Op: Goto [aeb9]b1 aepointer BSCRIPTS_ENEMY_ZOZURA; '- BSCRIPTS_ENEMY_ZOZURA
; ; DEADCODE: Unused logic for Zozura. ; ; In this version, Zozura would still walk toward the player, ; but would randomly change the X direction and continue ; walking. ;
[aebb]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aebc]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aebd]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aebe]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aebf]3c.byte $3c; |- For 60 ticks [aec0]60.byte $60; |- 96 pixels [aec1]00.byte $00; '- 0 blocks [aec2]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aec3]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aec4]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aec5]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aec6]14.byte $14; |- For 20 ticks [aec7]60.byte $60; |- 96 pixels [aec8]00.byte $00; '- 0 blocks [aec9]05.byte SPRITE_OP_GOTO; Op: Goto [aeca]b1 aepointer BSCRIPTS_ENEMY_ZOZURA; '- BSCRIPTS_ENEMY_ZOZURA
;============================================================================ ; Monodron sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad81] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad81] ;
[aecc]BSCRIPTS_ENEMY_MONODRON: [aecc]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aecd]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly change X direction [aece]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aecf]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [aed0]05.byte $05; '- For 5 ticks [aed1]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aed2]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [aed3]00.byte $00; |- (unused) [aed4]00.byte $00; |- X fractional amount [aed5]01.byte $01; |- X full amount [aed6]02.byte $02; '- Hop mode 2 [aed7]02.byte SPRITE_OP_RUN_ACTION; Op: Run Action [aed8]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aed9]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeda]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [aedb]14.byte $14; '- For 20 ticks [aedc]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aedd]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [aede]00.byte $00; |- (unused) [aedf]80.byte $80; |- X fractional amount [aee0]01.byte $01; |- X full amount [aee1]02.byte $02; '- Hop mode 2 [aee2]05.byte SPRITE_OP_GOTO; Op: Goto [aee3]cc aepointer BSCRIPTS_ENEMY_MONODRON; '- BSCRIPTS_ENEMY_MONODRON
;============================================================================ ; Snowman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad45] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad45] ;
[aee5]BSCRIPTS_ENEMY_SNOWMAN: [aee5]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aee6]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aee7]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aee8]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/Wait [aee9]1e.byte $1e; '- For 30 ticks [aeea]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [aeeb]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aeec]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeed]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aeee]00.byte $00; |- For 0 ticks [aeef]00.byte $00; |- 0 pixels [aef0]02.byte $02; '- 2 blocks [aef1]@_waitNearPlayer: [aef1]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check player distance [aef2]00.byte $00; |- X direction [aef3]20.byte $20; |- If < 32 pixels [aef4]f8 aepointer @_isNearPlayer; |- Then _isNearPlayer [aef6]f1 aepointer @_waitNearPlayer; '- Else @_waitNearPlayer [aef8]@_isNearPlayer: [aef8]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [aef9]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aefa]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [aefb]00.byte $00; |- (unused) [aefc]00.byte $00; |- 0 pixels X [aefd]02.byte $02; |- 2 blocks X [aefe]04.byte $04; '- Hop mode 4 [aeff]05.byte SPRITE_OP_GOTO; Op: Goto [af00]e5 aepointer BSCRIPTS_ENEMY_SNOWMAN; '- BSCRIPTS_ENEMY_SNOWMAN
;============================================================================ ; Coin sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad31] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad31] ;
[af02]BSCRIPTS_OBJ_COIN: [af02]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af03]02.byte SPRITE_BEHAVIOR_BOUNCE_AND_EXPIRE; |- Bounce and expire [af04]00.byte $00; '- (unused) [af05]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Zombie sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad39] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad39] ;
[af06]BSCRIPTS_ENEMY_ZOMBIE: [af06]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af07]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af08]14.byte $14; |- For 20 ticks [af09]80.byte $80; |- 128 pixels X [af0a]00.byte $00; '- 0 blocks X [af0b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af0c]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af0d]0a.byte $0a; '- For 10 ticks [af0e]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af0f]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [af10]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af11]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af12]28.byte $28; |- For 40 ticks [af13]80.byte $80; |- 128 pixels X [af14]00.byte $00; '- 0 blocks X [af15]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af16]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af17]0a.byte $0a; '- For 10 ticks [af18]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af19]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af1a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af1b]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af1c]14.byte $14; |- For 20 ticks [af1d]80.byte $80; |- 128 pixels X [af1e]00.byte $00; '- 0 blocks X [af1f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af20]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af21]0a.byte $0a; '- For 10 ticks [af22]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af23]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [af24]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af25]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af26]28.byte $28; |- For 40 ticks [af27]80.byte $80; |- 128 pixels X [af28]00.byte $00; '- 0 blocks X [af29]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af2a]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af2b]3c.byte $3c; '- For 60 ticks [af2c]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af2d]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af2e]05.byte SPRITE_OP_GOTO; Op: Goto [af2f]06 afpointer BSCRIPTS_ENEMY_ZOMBIE; '- BSCRIPTS_ENEMY_ZOMBIE
;============================================================================ ; Necron Aides sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad37] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad37] ;
[af31]BSCRIPTS_ENEMY_NECRON_AIDES: [af31]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af32]16.byte SPRITE_BEHAVIOR_NECRON_AIDES; SpriteBehavior [af33]00.byte $00; byte [af34]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Yuinaru sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad43] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad43] ;
[af35]BSCRIPTS_ENEMY_YUINARU: [af35]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af36]19.byte SPRITE_BEHAVIOR_YUINARU; SpriteBehavior [af37]00.byte $00; byte [af38]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Nash sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad47] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad47] ;
[af39]BSCRIPTS_ENEMY_NASH: [af39]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af3a]1a.byte SPRITE_BEHAVIOR_NASH; SpriteBehavior [af3b]00.byte $00; byte [af3c]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Fire Giant sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad49] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad49] ;
[af3d]BSCRIPTS_ENEMY_FIRE_GIANT: [af3d]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af3e]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af3f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af40]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af41]00.byte $00; '- For 0 ticks [af42]@_waitNearPlayer: [af42]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [af43]00.byte $00; |- X direction [af44]20.byte $20; |- If < 32 pixels [af45]49 afpointer @_isNearPlayer; |- Then _isNearPlayer [af47]42 afpointer @_waitNearPlayer; '- Else _waitNearPlayer [af49]@_isNearPlayer: [af49]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [af4a]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af4b]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af4c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af4d]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [af4e]28.byte $28; |- For 40 ticks [af4f]80.byte $80; |- 128 pixels X [af50]01.byte $01; '- 1 block X [af51]05.byte SPRITE_OP_GOTO; Op: Goto [af52]3d afpointer BSCRIPTS_ENEMY_FIRE_GIANT; '- BSCRIPTS_ENEMY_FIRE_GIANT
;============================================================================ ; Ishiisu sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4b] ;
[af54]BSCRIPTS_ENEMY_ISHIISU: [af54]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af55]40.byte SPRITE_BEHAVIOR_ISHIISU; SpriteBehavior [af56]00.byte $00; byte [af57]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Execution Hood sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4d] ;
[af58]BSCRIPTS_ENEMY_EXECUTION_HOOD: [af58]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af59]41.byte SPRITE_BEHAVIOR_EXECUTION_HOOD; SpriteBehavior [af5a]00.byte $00; byte [af5b]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Lightning ball sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad53] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad53] ;
[af5c]BSCRIPTS_LIGHTNING_BALL_19: [af5c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af5d]07.byte SPRITE_BEHAVIOR_MAYBE_LIGHTNINGBALL; SpriteBehavior [af5e]00.byte $00; byte [af5f]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Charron sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad55] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad55] ;
[af60]BSCRIPTS_ENEMY_CHARRON: [af60]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af61]08.byte SPRITE_BEHAVIOR_LIGHTNINBALL_CHARRON; SpriteBehavior [af62]00.byte $00; byte [af63]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Boss death effect sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf5] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf5] ;
[af64]BSCRIPTS_EFFECT_BOSS_DEATH: [af64]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [af65]3e.byte SPRITE_BEHAVIOR_EFFECT_BOSS_DEATH; SpriteBehavior [af66]00.byte $00; byte [af67]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Unused 21 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad57] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad57] ;
[af68]BSCRIPTS_ENEMY_UNUSED_21: [af68]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af69]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af6a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af6b]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af6c]10.byte $10; '- For 16 ticks [af6d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af6e]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af6f]1e.byte $1e; |- For 30 ticks [af70]c0.byte $c0; |- 192 pixels X [af71]00.byte $00; '- 0 blocks X [af72]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af73]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af74]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af75]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af76]10.byte $10; '- For 16 ticks [af77]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af78]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af79]1e.byte $1e; |- For 30 ticks [af7a]00.byte $00; |- 0 pixels X [af7b]01.byte $01; '- 1 blocks X [af7c]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af7d]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af7e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af7f]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [af80]08.byte $08; '- For 8 ticks [af81]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af82]07.byte SPRITE_ACTION_CAST_MAGIC; '- Cast magic [af83]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af84]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [af85]08.byte $08; '- For 8 ticks [af86]05.byte SPRITE_OP_GOTO; Op: Goto [af87]68 afpointer BSCRIPTS_ENEMY_UNUSED_21; '- BSCRIPTS_ENEMY_UNUSED_21
;============================================================================ ; Geributa sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5b] ;
[af89]BSCRIPTS_ENEMY_GERIBUTA: [af89]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af8a]04.byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [af8b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af8c]1e.byte SPRITE_BEHAVIOR_CLEAR_READY_SET_BIT_7; SpriteBehavior [af8d]00.byte $00; byte [af8e]@_moveTowardPlayerLoop: [af8e]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af8f]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af90]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af91]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af92]1e.byte $1e; |- For 30 ticks [af93]00.byte $00; |- 0 pixels X [af94]02.byte $02; '- 2 blocks X [af95]05.byte SPRITE_OP_GOTO; Op: Goto [af96]8e afpointer @_moveTowardPlayerLoop; '- @_moveTowardPlayerLoop
;============================================================================ ; Sugata enemy behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5d] ;
[af98]BSCRIPTS_ENEMY_SUGATA: [af98]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [af99]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af9a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af9b]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [af9c]1e.byte $1e; |- For 30 ticks [af9d]00.byte $00; |- 0 pixels per tick [af9e]01.byte $01; '- 1 block per tick [af9f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa0]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afa1]1e.byte $1e; '- For 30 ticks [afa2]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa3]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [afa4]28.byte $28; |- For 40 ticks [afa5]00.byte $00; |- 0 pixels per tick [afa6]01.byte $01; '- 1 block per tick [afa7]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa8]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afa9]0a.byte $0a; '- For 10 ticks [afaa]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afab]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [afac]14.byte $14; |- For 20 ticks [afad]80.byte $80; |- 128 pixels per tick [afae]00.byte $00; '- 0 blocks per tick [afaf]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afb0]1f.byte SPRITE_BEHAVIOR_FLASH_DAMAGE_PLAYER; |- Flash screen, damage player [afb1]00.byte $00; '- (unused) [afb2]05.byte SPRITE_OP_GOTO; Op: Goto [afb3]98 afpointer BSCRIPTS_ENEMY_SUGATA; '- BSCRIPTS_ENEMY_SUGATA
;============================================================================ ; Grimlock enemy behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5f] ;
[afb5]BSCRIPTS_ENEMY_GRIMLOCK: [afb5]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afb6]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afb7]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afb8]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afb9]10.byte $10; '- For 16 ticks [afba]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afbb]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afbc]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afbd]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afbe]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afbf]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afc0]14.byte $14; '- For 20 ticks [afc1]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afc2]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afc3]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afc4]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afc5]0a.byte $0a; '- For 10 ticks [afc6]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afc7]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afc8]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afc9]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afca]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afcb]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afcc]0e.byte $0e; '- For 14 ticks [afcd]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afce]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afcf]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afd0]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afd1]10.byte $10; '- For 16 ticks [afd2]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afd3]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afd4]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afd5]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afd6]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afd7]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afd8]12.byte $12; '- For 18 ticks [afd9]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [afda]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afdb]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afdc]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afdd]00.byte $00; '- For 0 ticks [afde]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [afdf]01.byte $01; |- Y direction [afe0]10.byte $10; |- If < 16 pixels [afe1]ff afpointer @_nearPlayerY; |- Then @_nearPlayerY [afe3]e5 afpointer @_awayFromPlayerY; '- Else @_awayFromPlayerY [afe5]@_awayFromPlayerY: [afe5]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [afe6]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afe7]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [afe8]28.byte $28; |- For 40 ticks [afe9]80.byte $80; |- 128 pixels X [afea]00.byte $00; '- 0 blocks X [afeb]@_waitNearPlayerX: [afeb]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [afec]00.byte $00; |- X direction [afed]10.byte $10; |- If < 16 pixels [afee]f5 afpointer @_nearPlayerX; |- Then @_nearPlayerX [aff0]eb afpointer @_waitNearPlayerX; '- Else _waitNearPlayerX [aff2]05.byte SPRITE_OP_GOTO; Op: Goto [aff3]b5 afpointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [aff5]@_nearPlayerX: [aff5]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [aff6]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aff7]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [aff8]00.byte $00; |- (unused) [aff9]00.byte $00; |- 0 pixels X [affa]01.byte $01; |- 1 block X [affb]02.byte $02; '- Hop mode 2 [affc]05.byte SPRITE_OP_GOTO; Op: Goto [affd]b5 afpointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [afff]@_nearPlayerY: [afff]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b000]07.byte SPRITE_OP_SET_PHASE; Op: Set phase [b001]09.byte $09; '- 9 [b002]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b003]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b004]28.byte $28; |- For 40 ticks [b005]00.byte $00; |- 0 pixels X [b006]02.byte $02; '- 2 pixels X [b007]@_waitNearPlayerX2: [b007]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b008]00.byte $00; |- X direction [b009]10.byte $10; |- If < 16 pixels [b00a]11 b0pointer @_nearPlayerX2; |- Then @_nearPlayerX2 [b00c]07 b0pointer @_waitNearPlayerX2; '- Else @_waitNearPlayerX2 [b00e]05.byte SPRITE_OP_GOTO; Op: Goto [b00f]b5 afpointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [b011]@_nearPlayerX2: [b011]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b012]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b013]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b014]00.byte $00; |- (unused) [b015]00.byte $00; |- 0 pixels X [b016]02.byte $02; |- 2 blocks X [b017]02.byte $02; '- Hop mode 2 [b018]05.byte SPRITE_OP_GOTO; Op: Goto [b019]b5 afpointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK
;============================================================================ ; Giant Bees sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad61] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad61] ;
[b01b]BSCRIPTS_ENEMY_GIANT_BEES: [b01b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b01c]20.byte SPRITE_BEHAVIOR_GIANT_BEES; SpriteBehavior [b01d]00.byte $00; byte [b01e]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Myconid sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad63] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad63] ;
[b01f]BSCRIPTS_ENEMY_MYCONID: [b01f]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b020]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b021]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b022]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b023]3c.byte $3c; |- For 60 ticks [b024]40.byte $40; |- 64 pixels X [b025]00.byte $00; '- 0 blocks X [b026]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b027]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b028]1e.byte $1e; '- For 30 ticks [b029]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b02a]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b02b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b02c]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b02d]3c.byte $3c; |- For 60 ticks [b02e]40.byte $40; |- 64 pixels X [b02f]00.byte $00; '- 0 blocks X [b030]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b031]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b032]1e.byte $1e; '- For 30 ticks [b033]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b034]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b035]28.byte $28; |- For 40 ticks [b036]80.byte $80; |- 128 pixels X [b037]00.byte $00; '- 0 blocks X [b038]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b039]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b03a]00.byte $00; |- (unused) [b03b]80.byte $80; |- 128 pixels X [b03c]00.byte $00; |- 0 blocks X [b03d]02.byte $02; '- Hop mode 2 [b03e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b03f]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b040]1e.byte $1e; '- For 30 ticks [b041]05.byte SPRITE_OP_GOTO; Op: Goto [b042]1f b0pointer BSCRIPTS_ENEMY_MYCONID; '- BSCRIPTS_ENEMY_MYCONID
;============================================================================ ; Naga sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad65] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad65] ;
[b044]BSCRIPTS_ENEMY_NAGA: [b044]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b045]21.byte SPRITE_BEHAVIOR_NAGA; SpriteBehavior [b046]00.byte $00; byte [b047]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Giant Strider sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad69] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad69] ;
[b048]BSCRIPTS_ENEMY_GIANT_STRIDER: [b048]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b049]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b04a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b04b]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b04c]3c.byte $3c; |- For 60 ticks [b04d]00.byte $00; |- 0 pixels X [b04e]01.byte $01; '- 1 block X [b04f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b050]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b051]00.byte $00; |- (unused) [b052]00.byte $00; |- 0 pixels X [b053]01.byte $01; |- 1 block X [b054]02.byte $02; '- Hop mode 2 [b055]05.byte SPRITE_OP_GOTO; Op: Goto [b056]48 b0pointer BSCRIPTS_ENEMY_GIANT_STRIDER; '- BSCRIPTS_ENEMY_GIANT_STRIDER
;============================================================================ ; Yareeka sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad71] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad71] ;
[b058]BSCRIPTS_ENEMY_YAREEKA: [b058]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b059]22.byte SPRITE_BEHAVIOR_YAREEKA; SpriteBehavior [b05a]00.byte $00; byte [b05b]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Magman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad73] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad73] ;
[b05c]BSCRIPTS_ENEMY_MAGMAN: [b05c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b05d]23.byte SPRITE_BEHAVIOR_MAGMAN; SpriteBehavior [b05e]00.byte $00; byte [b05f]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Unused 36 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad75] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad75] ;
[b060]BSCRIPTS_ENEMY_UNUSED_36: [b060]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b061]24.byte SPRITE_BEHAVIOR_ENEMY_UNUSED_36; SpriteBehavior [b062]00.byte $00; byte [b063]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Unused 39 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7b] ;
[b064]BSCRIPTS_ENEMY_UNUSED_39: [b064]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b065]25.byte SPRITE_BEHAVIOR_ENEMY_UNUSED_39; SpriteBehavior [b066]00.byte $00; byte [b067]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Lamprey sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7d] ;
[b068]BSCRIPTS_ENEMY_LAMPREY: [b068]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b069]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b06a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b06b]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b06c]3c.byte $3c; |- For 60 ticks [b06d]50.byte $50; |- 80 pixels X [b06e]00.byte $00; '- 0 blocks X [b06f]05.byte SPRITE_OP_GOTO; Op: Goto [b070]68 b0pointer BSCRIPTS_ENEMY_LAMPREY; '- BSCRIPTS_ENEMY_LAMPREY
;============================================================================ ; Unused 43 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad83] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad83] ;
[b072]BSCRIPTS_ENEMY_UNUSED_43: [b072]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b073]26.byte SPRITE_BEHAVIOR_ENEMY_UNUSED_43; SpriteBehavior [b074]00.byte $00; byte [b075]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Tamazutsu sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad85] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad85] ;
[b076]BSCRIPTS_ENEMY_TAMAZUTSU: [b076]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b077]27.byte SPRITE_BEHAVIOR_TAMAZUTSU; SpriteBehavior [b078]00.byte $00; byte [b079]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Sir Gawaine/Wolfman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6b] ; SPRITE_BSCRIPTS [$PRG14::ad6f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6b] ; SPRITE_BSCRIPTS [$PRG14::ad6f] ;
[b07a]BSCRIPTS_ENEMY_SIR_GAWAINE_WOLFMAN: [b07a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b07b]28.byte SPRITE_BEHAVIOR_SIR_GAWAINE_WOLFMAN; SpriteBehavior [b07c]00.byte $00; byte [b07d]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Maskman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6d] ;
[b07e]BSCRIPTS_ENEMY_MASKMAN: [b07e]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b07f]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b080]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b081]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b082]14.byte $14; |- For 20 ticks [b083]00.byte $00; |- 0 pixels X [b084]01.byte $01; '- 1 block X [b085]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b086]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b087]00.byte $00; |- (unused) [b088]00.byte $00; |- 0 pixels X [b089]01.byte $01; |- 1 block X [b08a]02.byte $02; '- Hop mode 2 [b08b]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b08c]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b08d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b08e]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b08f]14.byte $14; |- For 20 ticks [b090]00.byte $00; |- 0 pixels X [b091]01.byte $01; '- 1 block X [b092]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b093]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b094]00.byte $00; |- (unused) [b095]00.byte $00; |- 0 pixels X [b096]01.byte $01; |- 1 block X [b097]02.byte $02; '- Hop mode 2 [b098]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b099]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b09a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b09b]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b09c]14.byte $14; |- For 20 ticks [b09d]00.byte $00; |- 0 pixels X [b09e]01.byte $01; '- 1 block X [b09f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0a0]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b0a1]00.byte $00; |- (unused) [b0a2]00.byte $00; |- 0 pixels X [b0a3]01.byte $01; |- 1 block X [b0a4]01.byte $01; '- Hop mode 1 [b0a5]05.byte SPRITE_OP_GOTO; Op: Goto [b0a6]7e b0pointer BSCRIPTS_ENEMY_MASKMAN; '- BSCRIPTS_ENEMY_MASKMAN
;============================================================================ ; Unused 29 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad67] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad67] ;
[b0a8]BSCRIPTS_ENEMY_UNUSED_29: [b0a8]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0a9]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b0aa]00.byte $00; '- For 0 ticks [b0ab]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Rokusutahn sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad4f] ;
[b0ac]BSCRIPTS_BOSS_ROKUSUTAHN: [b0ac]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0ad]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ae]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0af]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0b0]14.byte $14; |- For 20 ticks [b0b1]00.byte $00; |- 0 pixels X [b0b2]01.byte $01; '- 1 block X [b0b3]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0b4]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0b5]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0b6]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b0b7]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0b8]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0b9]14.byte $14; |- For 20 ticks [b0ba]80.byte $80; |- 128 pixels X [b0bb]00.byte $00; '- 0 blocks X [b0bc]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0bd]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0be]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0bf]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0c0]08.byte $08; |- For 8 ticks [b0c1]00.byte $00; |- 0 pixels X [b0c2]01.byte $01; '- 1 block X [b0c3]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance [b0c4]00.byte $00; |- Check X [b0c5]10.byte $10; |- If < 16 pixels [b0c6]ca b0pointer @_hop; |- Then hop [b0c8]d0 b0pointer @_loop; '- Else loop [b0ca]@_hop: [b0ca]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b0cb]09.byte SPRITE_BEHAVIOR_HOP; Op: Hop [b0cc]00.byte $00; |- (unused) [b0cd]00.byte $00; |- 0 pixels X [b0ce]00.byte $00; |- 0 blocks X [b0cf]02.byte $02; '- Hop mode 2 [b0d0]@_loop: [b0d0]05.byte SPRITE_OP_GOTO; Op: Goto [b0d1]ac b0pointer BSCRIPTS_BOSS_ROKUSUTAHN; '- BSCRIPTS_BOSS_ROKUSUTAHN
;============================================================================ ; Unused 18 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad51] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad51] ;
[b0d3]BSCRIPTS_ENEMY_UNUSED_18: [b0d3]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b0d4]06.byte SPRITE_BEHAVIOR_ENEMY_UNUSED_18; SpriteBehavior [b0d5]00.byte $00; byte [b0d6]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Ripasheiku sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad87] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad87] ;
[b0d7]BSCRIPTS_BOSS_RIPASHEIKU: [b0d7]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0d8]0a.byte SPRITE_BEHAVIOR_RIPASHEIKU; |- Ripasheiku boss [b0d9]00.byte $00; '- (unused) [b0da]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Zoradohna sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad89] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad89] ;
[b0db]BSCRIPTS_BOSS_ZORADOHNA: [b0db]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0dc]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0dd]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0de]01.byte SPRITE_BEHAVIOR_WAIT; |- Wait [b0df]3c.byte $3c; '- For 60 ticks [b0e0]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0e1]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b0e2]00.byte $00; |- (unused [b0e3]00.byte $00; |- 0 pixels X [b0e4]00.byte $00; |- 0 blocks X [b0e5]02.byte $02; '- Hop mode 2 [b0e6]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0e7]06.byte SPRITE_ACTION_FLY_UP; '- Rise up [b0e8]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0e9]13.byte SPRITE_BEHAVIOR_MOVE_VERT; |- Move vertically [b0ea]08.byte $08; |- For 8 ticks [b0eb]00.byte $00; |- 0 pixels Y [b0ec]02.byte $02; '- 2 blocks Y [b0ed]@_mainLoop: [b0ed]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0ee]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ef]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0f0]12.byte SPRITE_BEHAVIOR_SOMETHING_ZORADOHNA_18; |- TODO [b0f1]00.byte $00; |- For 0 ticks [b0f2]00.byte $00; |- 0 pixels X [b0f3]01.byte $01; |- 1 block X [b0f4]02.byte $02; '- TODO: Value 2 [b0f5]@_waitNearPlayer: [b0f5]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b0f6]00.byte $00; |- X direction [b0f7]20.byte $20; |- If < 32 pixels [b0f8]fc b0pointer @_isNearPlayer; |- Then @_isNearPlayer [b0fa]f5 b0pointer @_waitNearPlayer; '- Else @_waitNearPlayer [b0fc]@_isNearPlayer: [b0fc]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b0fd]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b0fe]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ff]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b100]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b101]00.byte $00; |- (unused) [b102]00.byte $00; |- 0 pixels X [b103]02.byte $02; |- 2 blocks X [b104]01.byte $01; '- Hop mode 1 [b105]05.byte SPRITE_OP_GOTO; Op: Goto [b106]ed b0pointer @_mainLoop; '- @_mainLoop
;============================================================================ ; Borabohra sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8b] ;
[b108]BSCRIPTS_BOSS_BORABOHRA: [b108]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b109]0c.byte SPRITE_BEHAVIOR_BORABOHRA; SpriteBehavior [b10a]00.byte $00; byte [b10b]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Pakukame sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8d] ;
[b10c]BSCRIPTS_BOSS_PAKUKAME: [b10c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b10d]0d.byte SPRITE_BEHAVIOR_PAKUKAME; SpriteBehavior [b10e]00.byte $00; byte [b10f]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Zorugeriru sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8f] ;
[b110]BSCRIPTS_BOSS_ZORUGERIRU: [b110]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b111]0e.byte SPRITE_BEHAVIOR_ZORUGERIRU; SpriteBehavior [b112]00.byte $00; byte [b113]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; King Grieve sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad91] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad91] ;
[b114]BSCRIPTS_BOSS_KING_GRIEVE: [b114]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b115]0f.byte SPRITE_BEHAVIOR_KING_GRIEVE; SpriteBehavior [b116]00.byte $00; byte [b117]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Shadow Eura sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad93] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad93] ;
[b118]BSCRIPTS_BOSS_SHADOW_EURA: [b118]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b119]10.byte SPRITE_BEHAVIOR_SHADOW_EURA; SpriteBehavior [b11a]00.byte $00; byte [b11b]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Enemy magic spell sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcf] ; SPRITE_BSCRIPTS [$PRG14::add5] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcf] ; SPRITE_BSCRIPTS [$PRG14::add5] ;
[b11c]BSCRIPTS_GARBLED_81: [b11c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b11d]1b.byte SPRITE_BEHAVIOR_SOMETHING_GARBLED_81; SpriteBehavior [b11e]00.byte $00; byte [b11f]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Unused garbled 10 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad41] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad41] ;
[b120]BSCRIPTS_GARBLED_10: [b120]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b121]1c.byte SPRITE_BEHAVIOR_SOMETHING_GARBLED_10; SpriteBehavior [b122]00.byte $00; byte [b123]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Walking Man NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad95] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad95] ;
[b124]BSCRIPTS_NPC_WALKING_MAN: [b124]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b125]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b126]3c.byte $3c; |- For 60 ticks [b127]c0.byte $c0; |- 192 pixels X [b128]00.byte $00; '- 0 blocks X [b129]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b12a]15.byte SPRITE_BEHAVIOR_FALL; |- Stand still [b12b]1e.byte $1e; '- For 30 ticks [b12c]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b12d]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b12e]05.byte SPRITE_OP_GOTO; Op: Goto [b12f]24 b1pointer BSCRIPTS_NPC_WALKING_MAN; '- BSCRIPTS_NPC_WALKING_MAN
;============================================================================ ; Unused blue day NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad97] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad97] ;
[b131]BSCRIPTS_NPC_UNUSED_BLUE_LADY: [b131]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b132]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b133]50.byte $50; |- For 80 ticks [b134]80.byte $80; |- 128 pixels X [b135]00.byte $00; '- 0 blocks X [b136]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b137]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b138]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b139]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b13a]14.byte $14; |- For 20 ticks [b13b]80.byte $80; |- 128 pixels X [b13c]00.byte $00; '- 0 blocks X [b13d]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b13e]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b13f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b140]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b141]50.byte $50; |- For 80 ticks [b142]80.byte $80; |- 128 pixels X [b143]00.byte $00; '- 0 blocks X [b144]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b145]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b146]05.byte SPRITE_OP_GOTO; Op: Goto [b147]31 b1pointer BSCRIPTS_NPC_UNUSED_BLUE_LADY; '- BSCRIPTS_NPC_UNUSED_BLUE_LADY
;============================================================================ ; Unused child NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad99] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad99] ;
[b149]BSCRIPTS_NPC_UNUSED_CHILD: [b149]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b14a]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b14b]3c.byte $3c; |- For 60 ticks [b14c]c0.byte $c0; |- 192 pixels X [b14d]00.byte $00; '- 0 blocks X [b14e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b14f]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b150]00.byte $00; |- (unused) [b151]00.byte $00; |- 0 pixels X [b152]01.byte $01; |- 1 block X [b153]03.byte $03; '- Hop mode 3 [b154]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b155]09.byte SPRITE_BEHAVIOR_HOP; |- Hop [b156]00.byte $00; |- (unused) [b157]00.byte $00; |- 0 pixels X [b158]01.byte $01; |- 1 block X [b159]03.byte $03; '- Hop mode 3 [b15a]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b15b]04.byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b15c]0a.byte $0a; |- For 10 ticks [b15d]c0.byte $c0; |- 192 pixels X [b15e]00.byte $00; '- 0 blocks X [b15f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b160]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b161]05.byte $05; '- For 5 ticks [b162]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b163]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b164]05.byte SPRITE_OP_GOTO; Op: Goto [b165]49 b1pointer BSCRIPTS_NPC_UNUSED_CHILD; '- BSCRIPTS_NPC_UNUSED_CHILD
;============================================================================ ; Armor salesman NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9b] ;
[b167]BSCRIPTS_NPC_ARMOR_SALESMAN: [b167]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b168]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b169]00.byte $00; '- 0 ticks [b16a]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Martial Artist NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9d] ;
[b16b]BSCRIPTS_NPC_MARTIAL_ARTS: [b16b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b16c]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b16d]01.byte $01; '- 1 tick [b16e]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b16f]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b170]05.byte SPRITE_OP_GOTO; Op: Goto [b171]6b b1pointer BSCRIPTS_NPC_MARTIAL_ARTS; '- BSCRIPTS_NPC_MARTIAL_ARTS
;============================================================================ ; Priest NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad9f] ;
[b173]BSCRIPTS_NPC_PRIEST: [b173]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b174]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b175]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Set sprite data [b176]ba 00pointer CurrentSprites_XPos_Full; |- X position [b178]04.byte $04; '- to 4 [b179]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b17a]15.byte SPRITE_BEHAVIOR_FALL; |- Stand still [b17b]00.byte $00; '- For 0 ticks [b17c]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; King NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada1] ;
[b17d]BSCRIPTS_NPC_KING: [b17d]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b17e]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b17f]00.byte $00; '- For 0 ticks
; ; Wait until the King and the player are within 64 pixels ; of each other. ;
[b180]@_waitNearPlayerLoop: [b180]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b181]00.byte $00; |- For 0 ticks [b182]40.byte $40; |- If < 64 pixels [b183]87 b1pointer @_nearPlayer; |- Then @_nearPlayer [b185]80 b1pointer @_waitNearPlayerLoop; '- Else @_waitNearPlayerLoop
; ; The player is now near the King. The King will step forward ; 8 pixels and stand on the ground. ;
[b187]@_nearPlayer: [b187]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b188]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add value to [b189]ba 00pointer CurrentSprites_XPos_Full; |- Sprite X position [b18b]08.byte $08; '- Plus 8 [b18c]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b18d]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b18e]00.byte $00; '- For 0 ticks
; ; Wait until the player has moved away from the King. ; ; This has a longer distance check, since the King's ; position incremented when standing up. ;
[b18f]@_waitAwayFromPlayerLoop: [b18f]03.byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b190]00.byte $00; |- For 0 ticks [b191]48.byte $48; |- If < 72 pixels [b192]8f b1pointer @_waitAwayFromPlayerLoop; |- Then @_waitAwayFromPlayerLoop [b194]96 b1pointer @_awayFromPlayer; '- Else @_awayFromPlayer
; ; The player is now far enough away from the King. ; The King can sit down. ;
[b196]@_awayFromPlayer: [b196]04.byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b197]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add value to [b198]ba 00pointer CurrentSprites_XPos_Full; |- Sprite X position [b19a]f8.byte $f8; '- Minus 8 [b19b]05.byte SPRITE_OP_GOTO; Op: Goto [b19c]7d b1pointer BSCRIPTS_NPC_KING; '- BSCRIPTS_NPC_KING
;============================================================================ ; Magic Teacher NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada3] ;
[b19e]BSCRIPTS_NPC_MAGIC_TEACHER: [b19e]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b19f]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1a0]01.byte $01; '- For 1 tick [b1a1]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1a2]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1a3]01.byte SPRITE_OP_MAYBE_DISABLE_AND_GOTO; Op: Maybe: Disable and Go To [b1a4]9e b1pointer BSCRIPTS_NPC_MAGIC_TEACHER; '- BSCRIPTS_NPC_MAGIC_TEACHER
;============================================================================ ; Doctor NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb3] ;
[b1a6]BSCRIPTS_NPC_DOCTOR: [b1a6]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add to sprite value [b1a7]ba 00pointer CurrentSprites_XPos_Full; |- Sprite X position [b1a9]08.byte $08; '- Add 8 [b1aa]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1ab]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1ac]00.byte $00; '- For 0 ticks [b1ad]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Key Salesman NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada5] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada5] ;
[b1ae]BSCRIPTS_NPC_KEY_SALESMAN: [b1ae]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1af]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1b0]00.byte $00; '- For 0 ticks [b1b1]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Smoking Man NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada7] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada7] ;
[b1b2]BSCRIPTS_NPC_SMOKING_MAN: [b1b2]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1b3]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1b4]05.byte $05; '- For 5 ticks [b1b5]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1b6]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1b7]05.byte SPRITE_OP_GOTO; Op: Goto [b1b8]b2 b1pointer BSCRIPTS_NPC_SMOKING_MAN; '- BSCRIPTS_NPC_SMOKING_MAN
;============================================================================ ; Man in chair NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ada9] ;
[b1ba]BSCRIPTS_NPC_MAN_IN_CHAIR: [b1ba]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1bb]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1bc]05.byte $05; '- For 5 ticks [b1bd]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1be]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1bf]05.byte SPRITE_OP_GOTO; Op: Goto [b1c0]ba b1pointer BSCRIPTS_NPC_MAN_IN_CHAIR; '- BSCRIPTS_NPC_MAN_IN_CHAIR
;============================================================================ ; Sitting man NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adab] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adab] ;
[b1c2]BSCRIPTS_NPC_SITTING_MAN: [b1c2]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1c3]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1c4]00.byte $00; '- For 0 ticks [b1c5]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Meat Salesman NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adad] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adad] ;
[b1c6]BSCRIPTS_NPC_MEAT_SALESMAN: [b1c6]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1c7]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1c8]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1c9]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1ca]00.byte $00; '- For 0 ticks [b1cb]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Blue lady in dress with cup NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adaf] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adaf] ;
[b1cc]BSCRIPTS_NPC_LADY_BLUE_DRESS_WITH_CUP: [b1cc]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1cd]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1ce]c0.byte $c0; |- For 192 ticks [b1cf]80.byte $80; |- 128 pixels X [b1d0]00.byte $00; '- 0 blocks X [b1d1]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1d2]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1d3]05.byte $05; '- For 5 ticks [b1d4]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1d5]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1d6]28.byte $28; |- For 40 ticks [b1d7]80.byte $80; |- 128 pixels X [b1d8]00.byte $00; '- 0 blocks X [b1d9]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1da]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1db]05.byte SPRITE_OP_GOTO; Op: Goto [b1dc]cc b1pointer BSCRIPTS_NPC_LADY_BLUE_DRESS_WITH_CUP; '- BSCRIPTS_NPC_LADY_BLUE_DRESS_WITH_CUP
;============================================================================ ; King's Guard NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb1] ;
[b1de]BSCRIPTS_NPC_KINGS_GUARD: [b1de]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1df]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1e0]50.byte $50; |- For 80 ticks [b1e1]c0.byte $c0; |- 192 pixels X [b1e2]00.byte $00; '- 0 blocks X [b1e3]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1e4]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1e5]05.byte $05; '- For 5 ticks [b1e6]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1e7]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1e8]05.byte SPRITE_OP_GOTO; Op: Goto [b1e9]de b1pointer BSCRIPTS_NPC_KINGS_GUARD; '- BSCRIPTS_NPC_KINGS_GUARD
;============================================================================ ; Walking woman 1 NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb5] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb5] ;
[b1eb]BSCRIPTS_NPC_WALKING_WOMAN_01: [b1eb]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1ec]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1ed]50.byte $50; |- For 80 ticks [b1ee]c0.byte $c0; |- 192 pixels X [b1ef]00.byte $00; '- 0 blocks X [b1f0]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1f1]15.byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1f2]0a.byte $0a; '- For 10 ticks [b1f3]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1f4]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1f5]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b1f6]00.byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1f7]05.byte SPRITE_OP_GOTO; Op: Goto [b1f8]eb b1pointer BSCRIPTS_NPC_WALKING_WOMAN_01; '- BSCRIPTS_NPC_WALKING_WOMAN_01
;============================================================================ ; Walking woman 2 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb7] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adb7] ;
[b1fa]BSCRIPTS_NPC_WALKING_WOMAN_02: [b1fa]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1fb]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1fc]3c.byte $3c; |- For 60 ticks [b1fd]80.byte $80; |- 128 pixels X [b1fe]00.byte $00; '- 0 blocks X [b1ff]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b200]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b201]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b202]00.byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b203]50.byte $50; |- For 80 ticks [b204]80.byte $80; |- 128 pixels X [b205]00.byte $00; '- 0 blocks X [b206]02.byte SPRITE_OP_RUN_ACTION; Op: Run action [b207]01.byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b208]05.byte SPRITE_OP_GOTO; Op: Goto [b209]fa b1pointer BSCRIPTS_NPC_WALKING_WOMAN_02; '- BSCRIPTS_NPC_WALKING_WOMAN_02
;============================================================================ ; Ointment item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc9] ;
[b20b]BSCRIPTS_OBJ_OINTMENT: [b20b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b20c]29.byte SPRITE_BEHAVIOR_ITEM_OINTMENT; SpriteBehavior [b20d]00.byte $00; byte [b20e]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Glove item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbd] ;
[b20f]BSCRIPTS_OBJ_GLOVE: [b20f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b210]2a.byte SPRITE_BEHAVIOR_ITEM_GLOVE; SpriteBehavior [b211]00.byte $00; byte [b212]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Wingboots item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add7] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add7] ;
[b213]BSCRIPTS_OBJ_WINGBOOTS: [b213]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b214]37.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_55; SpriteBehavior [b215]00.byte $00; byte [b216]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Potion-like item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc3] ; SPRITE_BSCRIPTS [$PRG14::adc5] ; SPRITE_BSCRIPTS [$PRG14::adc7] ; SPRITE_BSCRIPTS [$PRG14::adcb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc3] ; SPRITE_BSCRIPTS [$PRG14::adc5] ; SPRITE_BSCRIPTS [$PRG14::adc7] ; SPRITE_BSCRIPTS [$PRG14::adcb] ;
[b217]BSCRIPTS_OBJ_POTIONLIKE: [b217]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b218]15.byte SPRITE_BEHAVIOR_FALL; SpriteBehavior [b219]00.byte $00; byte [b21a]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Mattock item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcd] ;
[b21b]BSCRIPTS_OBJ_MATTOCK: [b21b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b21c]32.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_50; SpriteBehavior [b21d]00.byte $00; byte [b21e]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Hour Glass item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add9] ;
[b21f]BSCRIPTS_OBJ_HOURGLASS: [b21f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b220]33.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_51; SpriteBehavior [b221]00.byte $00; byte [b222]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Fountain sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add1] ;
[b223]BSCRIPTS_FOUNTAIN: [b223]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add to sprite value [b224]ba 00pointer CurrentSprites_XPos_Full; |- Sprite X position [b226]08.byte $08; '- Plus 8 [b227]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b228]39.byte SPRITE_BEHAVIOR_FOUNTAIN; SpriteBehavior [b229]00.byte $00; byte [b22a]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Spring of Trunk sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adef] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adef] ;
[b22b]BSCRIPTS_SPRING_OF_FORTRESS: [b22b]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; SpriteOp [b22c]ba 00pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [b22e]08.byte $08; byte [b22f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b230]3a.byte SPRITE_BEHAVIOR_SPRING_OF_FORTRESS; SpriteBehavior [b231]00.byte $00; byte [b232]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Spring of Sky sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf1] ;
[b233]BSCRIPTS_SPRING_OF_SKY: [b233]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; SpriteOp [b234]ba 00pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [b236]08.byte $08; byte [b237]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b238]3b.byte SPRITE_BEHAVIOR_SPRING_OF_SKY; SpriteBehavior [b239]00.byte $00; byte [b23a]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Spring of Joker sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf3] ;
[b23b]BSCRIPTS_SPRING_OF_JOKER: [b23b]06.byte SPRITE_OP_ADD_TO_SPRITE_DATA; SpriteOp [b23c]ba 00pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [b23e]08.byte $08; byte [b23f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b240]3c.byte SPRITE_BEHAVIOR_SPRING_OF_JOKER; SpriteBehavior [b241]00.byte $00; byte [b242]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Battle Suit item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addd] ;
[b243]BSCRIPTS_OBJ_BATTLE_SUIT: [b243]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b244]2b.byte SPRITE_BEHAVIOR_BATTLE_SUIT_DROPPED_BY_ZORADOHNA; SpriteBehavior [b245]00.byte $00; byte [b246]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Battle Helmet item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addf] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addf] ;
[b247]BSCRIPTS_OBJ_BATTLE_HELMET: [b247]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b248]2c.byte SPRITE_BEHAVIOR_BATTLE_HELMET_DROPPED_BY_ZORADOHNA; SpriteBehavior [b249]00.byte $00; byte [b24a]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Dragon Slayer item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade1] ;
[b24b]BSCRIPTS_OBJ_DRAGON_SLAYER: [b24b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b24c]2d.byte SPRITE_BEHAVIOR_DRAGON_SLAYER_DROPPED_BY_KING_GRIEVE; SpriteBehavior [b24d]00.byte $00; byte [b24e]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Magical Rod item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addb] ;
[b24f]BSCRIPTS_OBJ_MAGICAL_ROD: [b24f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b250]3d.byte SPRITE_BEHAVIOR_SHOW_MAGICAL_ROD; SpriteBehavior [b251]00.byte $00; byte [b252]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Black Onyx dropped by Zoradohna sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbf] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbf] ;
[b253]BSCRIPTS_OBJ_BLACK_ONYX: [b253]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b254]30.byte SPRITE_BEHAVIOR_BLACK_ONYX_DROPPED_FROM_ZORADOHNA; |- Black Onyx drops from Zoradohna [b255]00.byte $00; '- (unused) [b256]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Pendant dropped from Ripasheiku sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adc1] ;
[b257]BSCRIPTS_OBJ_PENDANT: [b257]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b258]31.byte SPRITE_BEHAVIOR_PENDANT_DROPPED_FROM_RIPASHEIKU; |- Pendant drops from Ripasheiku [b259]00.byte $00; '- (unused) [b25a]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Mattock dropped by Ripasheiku sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade3] ;
[b25b]BSCRIPTS_OBJ_MATTOCK_QUEST: [b25b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b25c]2e.byte SPRITE_BEHAVIOR_MATTOCK_DROPPED_BY_RPIASHEIKU; |- Mattock drops from Ripasheiku [b25d]00.byte $00; '- (unused) [b25e]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Wing Boots dropped by Zorugeriru sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade5] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade5] ;
[b25f]BSCRIPTS_OBJ_WINGSBOOTS_QUEST: [b25f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b260]2f.byte SPRITE_BEHAVIOR_WING_BOOTS_DROPPED_BY_ZORUGERIRU; |- Wing Boots drops by Zorugeriru [b261]00.byte $00; '- (unused) [b262]ff.byte SPRITE_OP_END_SCRIPT; Op: End script
;============================================================================ ; Red Potion 2 item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade7] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade7] ;
[b263]BSCRIPTS_OBJ_RED_POTION_RANDOM: [b263]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b264]34.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_52; SpriteBehavior [b265]00.byte $00; byte [b266]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Poison item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade9] ;
[b267]BSCRIPTS_OBJ_POISON: [b267]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b268]35.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_53; SpriteBehavior [b269]00.byte $00; byte [b26a]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Glove 2 item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adeb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adeb] ;
[b26b]BSCRIPTS_OBJ_GLOVE_RANDOM: [b26b]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b26c]36.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_54; SpriteBehavior [b26d]00.byte $00; byte [b26e]ff.byte SPRITE_OP_END_SCRIPT; SpriteOp
;============================================================================ ; Ointment 2 item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::aded] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::aded] ;
[b26f]BSCRIPTS_OBJ_OINTMENT_RANDOM: [b26f]00.byte SPRITE_OP_SWITCH_BEHAVIOR; SpriteOp [b270]38.byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_56; SpriteBehavior [b271]00 ff.byte $00,$ff; byte [b273]00 00 10 20 00 08 10 08.byte $00,$00,$10,$20,$00,$08,$10,$08; undefined [b27b]04 08 08 08 00 00 10 10.byte $04,$08,$08,$08,$00,$00,$10,$10; undefined [b283]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b28b]00 00 10 20 00 00 10 10.byte $00,$00,$10,$20,$00,$00,$10,$10; undefined [b293]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b29b]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b2a3]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2ab]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2b3]00 00 10 20 04 00 18 30.byte $00,$00,$10,$20,$04,$00,$18,$30; undefined [b2bb]00 00 10 20 00 00 00 00.byte $00,$00,$10,$20,$00,$00,$00,$00; undefined [b2c3]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2cb]00 00 10 10 00 00 10 20.byte $00,$00,$10,$10,$00,$00,$10,$20; undefined [b2d3]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2db]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2e3]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2eb]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2f3]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b2fb]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b303]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b30b]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b313]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b31b]00 00 10 20 00 00 10 20.byte $00,$00,$10,$20,$00,$00,$10,$20; undefined [b323]00 00 10 20 00 00 20 40.byte $00,$00,$10,$20,$00,$00,$20,$40; undefined [b32b]00 00 20 30 04 00 18 30.byte $00,$00,$20,$30,$04,$00,$18,$30; undefined [b333]00 00 20 20 00 00 10 20.byte $00,$00,$20,$20,$00,$00,$10,$20; undefined [b33b]00 00 40 18 08 00 28 50.byte $00,$00,$40,$18,$08,$00,$28,$50; undefined [b343]f8 00 20 20 f8 00 20 20.byte $f8,$00,$20,$20,$f8,$00,$20,$20; undefined [b34b]f8 00 20 20 00 00 28 30.byte $f8,$00,$20,$20,$00,$00,$28,$30; undefined [b353]f0 00 30 20 00 00 30 20.byte $f0,$00,$30,$20,$00,$00,$30,$20; undefined [b35b]00 00 30 20 f0 00 30 20.byte $00,$00,$30,$20,$f0,$00,$30,$20; undefined [b363]00 00 20 20 f8 00 20 20.byte $00,$00,$20,$20,$f8,$00,$20,$20; undefined [b36b]00 00 20 30 f8 00 20 20.byte $00,$00,$20,$30,$f8,$00,$20,$20; undefined [b373]f8 00 20 20 f8 00 20 20.byte $f8,$00,$20,$20,$f8,$00,$20,$20; undefined [b37b]f8 00 20 20 f8 00 20 20.byte $f8,$00,$20,$20,$f8,$00,$20,$20; undefined [b383]f8 00 20 20 f8 00 20 20.byte $f8,$00,$20,$20,$f8,$00,$20,$20; undefined [b38b]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b393]00 00 08 10 00 00 08 10.byte $00,$00,$08,$10,$00,$00,$08,$10; undefined [b39b]00 00 08 10 00 00 08 10.byte $00,$00,$08,$10,$00,$00,$08,$10; undefined [b3a3]00 00 08 10 00 00 10 10.byte $00,$00,$08,$10,$00,$00,$10,$10; undefined [b3ab]00 00 10 10 00 00 10 c0.byte $00,$00,$10,$10,$00,$00,$10,$c0; undefined [b3b3]00 00 10 10 04 04 08 08.byte $00,$00,$10,$10,$04,$04,$08,$08; undefined [b3bb]00 00 20 20 00 00 10 10.byte $00,$00,$20,$20,$00,$00,$10,$10; undefined [b3c3]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3cb]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3d3]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3db]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3e3]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3eb]00 00 10 10 00 00 10 10.byte $00,$00,$10,$10,$00,$00,$10,$10; undefined [b3f3]00 00 10 10 00 00 20 20.byte $00,$00,$10,$10,$00,$00,$20,$20; undefined [b3fb]00 00 20 20 00 00 20 20.byte $00,$00,$20,$20,$00,$00,$20,$20; undefined [b403]00 00 20 20.byte $00,$00,$20,$20; undefined
; ; XREFS: ; Sprites_IsSpriteOutOfWeaponRange ;
[b407]MAYBE_SPRITE_EXTENTS: [b407]SPRITE_ENTITY_WEAPON_RANGES: [b407]10.byte $10; [0]:
; ; XREFS: ; Sprites_IsSpriteOutOfWeaponRange ;
[b408]MAYBE_SPRITE_EXTENTS_1_: [b408]20.byte $20; [1]: [b409]10.byte $10; [2]: [b40a]08.byte $08; [3]: [b40b]08.byte $08; [4]: [b40c]08.byte $08; [5]: [b40d]10.byte $10; [6]: [b40e]10.byte $10; [7]: [b40f]10.byte $10; [8]: [b410]20.byte $20; [9]: [b411]10.byte $10; [10]: [b412]20.byte $20; [11]: [b413]10.byte $10; [12]: [b414]20.byte $20; [13]: [b415]10.byte $10; [14]: [b416]10.byte $10; [15]: [b417]10.byte $10; [16]: [b418]10.byte $10; [17]: [b419]10.byte $10; [18]: [b41a]10.byte $10; [19]: [b41b]10.byte $10; [20]: [b41c]10.byte $10; [21]: [b41d]10.byte $10; [22]: [b41e]10.byte $10; [23]: [b41f]10.byte $10; [24]: [b420]20.byte $20; [25]: [b421]10.byte $10; [26]: [b422]20.byte $20; [27]: [b423]10.byte $10; [28]: [b424]10.byte $10; [29]: [b425]10.byte $10; [30]: [b426]20.byte $20; [31]: [b427]10.byte $10; [32]: [b428]20.byte $20; [33]: [b429]20.byte $20; [34]: [b42a]10.byte $10; [35]: [b42b]10.byte $10; [36]: [b42c]20.byte $20; [37]: [b42d]00.byte $00; [38]: [b42e]00.byte $00; [39]: [b42f]10.byte $10; [40]: [b430]20.byte $20; [41]: [b431]10.byte $10; [42]: [b432]20.byte $20; [43]: [b433]10.byte $10; [44]: [b434]10.byte $10; [45]: [b435]10.byte $10; [46]: [b436]20.byte $20; [47]: [b437]10.byte $10; [48]: [b438]20.byte $20; [49]: [b439]10.byte $10; [50]: [b43a]20.byte $20; [51]: [b43b]10.byte $10; [52]: [b43c]20.byte $20; [53]: [b43d]10.byte $10; [54]: [b43e]20.byte $20; [55]: [b43f]10.byte $10; [56]: [b440]20.byte $20; [57]: [b441]10.byte $10; [58]: [b442]20.byte $20; [59]: [b443]10.byte $10; [60]: [b444]20.byte $20; [61]: [b445]10.byte $10; [62]: [b446]20.byte $20; [63]: [b447]10.byte $10; [64]: [b448]20.byte $20; [65]: [b449]10.byte $10; [66]: [b44a]20.byte $20; [67]: [b44b]10.byte $10; [68]: [b44c]20.byte $20; [69]: [b44d]10.byte $10; [70]: [b44e]20.byte $20; [71]: [b44f]10.byte $10; [72]: [b450]20.byte $20; [73]: [b451]10.byte $10; [74]: [b452]20.byte $20; [75]: [b453]10.byte $10; [76]: [b454]20.byte $20; [77]: [b455]10.byte $10; [78]: [b456]20.byte $20; [79]: [b457]10.byte $10; [80]: [b458]20.byte $20; [81]: [b459]10.byte $10; [82]: [b45a]20.byte $20; [83]: [b45b]10.byte $10; [84]: [b45c]20.byte $20; [85]: [b45d]10.byte $10; [86]: [b45e]20.byte $20; [87]: [b45f]10.byte $10; [88]: [b460]20.byte $20; [89]: [b461]20.byte $20; [90]: [b462]20.byte $20; [91]: [b463]20.byte $20; [92]: [b464]18.byte $18; [93]: [b465]20.byte $20; [94]: [b466]10.byte $10; [95]: [b467]20.byte $20; [96]: [b468]18.byte $18; [97]: [b469]10.byte $10; [98]: [b46a]20.byte $20; [99]: [b46b]40.byte $40; [100]: [b46c]10.byte $10; [101]: [b46d]30.byte $30; [102]: [b46e]20.byte $20; [103]: [b46f]10.byte $10; [104]: [b470]20.byte $20; [105]: [b471]10.byte $10; [106]: [b472]20.byte $20; [107]: [b473]10.byte $10; [108]: [b474]20.byte $20; [109]: [b475]28.byte $28; [110]: [b476]30.byte $30; [111]: [b477]20.byte $20; [112]: [b478]20.byte $20; [113]: [b479]30.byte $30; [114]: [b47a]20.byte $20; [115]: [b47b]30.byte $30; [116]: [b47c]20.byte $20; [117]: [b47d]20.byte $20; [118]: [b47e]20.byte $20; [119]: [b47f]10.byte $10; [120]: [b480]20.byte $20; [121]: [b481]10.byte $10; [122]: [b482]20.byte $20; [123]: [b483]10.byte $10; [124]: [b484]20.byte $20; [125]: [b485]10.byte $10; [126]: [b486]20.byte $20; [127]: [b487]10.byte $10; [128]: [b488]20.byte $20; [129]: [b489]10.byte $10; [130]: [b48a]20.byte $20; [131]: [b48b]10.byte $10; [132]: [b48c]20.byte $20; [133]: [b48d]10.byte $10; [134]: [b48e]20.byte $20; [135]: [b48f]10.byte $10; [136]: [b490]20.byte $20; [137]: [b491]10.byte $10; [138]: [b492]20.byte $20; [139]: [b493]10.byte $10; [140]: [b494]10.byte $10; [141]: [b495]10.byte $10; [142]: [b496]10.byte $10; [143]: [b497]08.byte $08; [144]: [b498]10.byte $10; [145]: [b499]08.byte $08; [146]: [b49a]10.byte $10; [147]: [b49b]08.byte $08; [148]: [b49c]10.byte $10; [149]: [b49d]08.byte $08; [150]: [b49e]10.byte $10; [151]: [b49f]08.byte $08; [152]: [b4a0]10.byte $10; [153]: [b4a1]10.byte $10; [154]: [b4a2]10.byte $10; [155]: [b4a3]10.byte $10; [156]: [b4a4]10.byte $10; [157]: [b4a5]10.byte $10; [158]: [b4a6]c0.byte $c0; [159]: [b4a7]10.byte $10; [160]: [b4a8]10.byte $10; [161]: [b4a9]08.byte $08; [162]: [b4aa]08.byte $08; [163]: [b4ab]20.byte $20; [164]: [b4ac]20.byte $20; [165]: [b4ad]10.byte $10; [166]: [b4ae]10.byte $10; [167]: [b4af]10.byte $10; [168]: [b4b0]10.byte $10; [169]: [b4b1]10.byte $10; [170]: [b4b2]10.byte $10; [171]: [b4b3]10.byte $10; [172]: [b4b4]10.byte $10; [173]: [b4b5]10.byte $10; [174]: [b4b6]10.byte $10; [175]: [b4b7]10.byte $10; [176]: [b4b8]10.byte $10; [177]: [b4b9]10.byte $10; [178]: [b4ba]10.byte $10; [179]: [b4bb]10.byte $10; [180]: [b4bc]10.byte $10; [181]: [b4bd]10.byte $10; [182]: [b4be]10.byte $10; [183]: [b4bf]10.byte $10; [184]: [b4c0]10.byte $10; [185]: [b4c1]10.byte $10; [186]: [b4c2]10.byte $10; [187]: [b4c3]10.byte $10; [188]: [b4c4]10.byte $10; [189]: [b4c5]10.byte $10; [190]: [b4c6]10.byte $10; [191]: [b4c7]10.byte $10; [192]: [b4c8]10.byte $10; [193]: [b4c9]10.byte $10; [194]: [b4ca]10.byte $10; [195]: [b4cb]10.byte $10; [196]: [b4cc]10.byte $10; [197]: [b4cd]10.byte $10; [198]: [b4ce]10.byte $10; [199]: [b4cf]10.byte $10; [200]: [b4d0]10.byte $10; [201]:
; ; XREFS: ; CurrentSprite_CanMoveInDirection ; Sprite_CalcDistanceXToPlayer ; Sprite_CheckHitByCastMagic ; Sprites_MoveRight ;
[b4d1]SPRITE_HITBOX_WIDTHS: [b4d1]0f.byte $0f; [0]: [b4d2]0f.byte $0f; [1]: [b4d3]1f.byte $1f; [2]: [b4d4]1f.byte $1f; [3]: [b4d5]1f.byte $1f; [4]: [b4d6]3f.byte $3f; [5]: [b4d7]2f.byte $2f; [6]:
; ; XREFS: ; CurrentSprite_CanMoveInDirection ; DEADCODE_Sprites_CanMoveDownBelowHitbox ; Sprite_CheckHitByCastMagic ; Sprites_CanMoveDownByHitbox ; Sprites_MoveRight__86c6 ;
[b4d8]SPRITE_HITBOX_HEIGHTS: [b4d8]0f.byte $0f; [0]: [b4d9]1f.byte $1f; [1]: [b4da]2f.byte $2f; [2]: [b4db]3f.byte $3f; [3]: [b4dc]1f.byte $1f; [4]: [b4dd]1f.byte $1f; [5]: [b4de]4f.byte $4f; [6]:
;============================================================================ ; A mapping of sprite entity IDs to hitbox types. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[b4df]SPRITE_ENTITIES_HITBOX_TYPES: [b4df]01.byte SPRITE_HITBOX_1; [0]: [b4e0]01.byte SPRITE_HITBOX_1; [1]: Dropped: Bread
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[b4e1]SPRITE_ENTITIES_HITBOX_TYPES_2_: [b4e1]00.byte SPRITE_HITBOX_0; [2]: Dropped: Coin [b4e2]01.byte SPRITE_HITBOX_1; [3]: Enemy: ? [b4e3]01.byte SPRITE_HITBOX_1; [4]: Enemy: Raiden [b4e4]01.byte SPRITE_HITBOX_1; [5]: Enemy: Necron Aides [b4e5]01.byte SPRITE_HITBOX_1; [6]: Enemy: Zombie [b4e6]00.byte SPRITE_HITBOX_0; [7]: Enemy: Hornet [b4e7]00.byte SPRITE_HITBOX_0; [8]: Enemy: Bihoruda [b4e8]00.byte SPRITE_HITBOX_0; [9]: Enemy: Lilith [b4e9]00.byte SPRITE_HITBOX_0; [10]: Magic: ? [b4ea]00.byte SPRITE_HITBOX_0; [11]: Enemy: Yuinaru [b4eb]01.byte SPRITE_HITBOX_1; [12]: Enemy: Snowman [b4ec]01.byte SPRITE_HITBOX_1; [13]: Enemy: Nash [b4ed]01.byte SPRITE_HITBOX_1; [14]: Enemy: Fire Giant [b4ee]01.byte SPRITE_HITBOX_1; [15]: Enemy: Ishiisu [b4ef]01.byte SPRITE_HITBOX_1; [16]: Enemy: Execution Hood [b4f0]02.byte SPRITE_HITBOX_2; [17]: Boss: Rokusutahn [b4f1]01.byte SPRITE_HITBOX_1; [18]: Boss: unused (round body of snake boss) [b4f2]01.byte SPRITE_HITBOX_1; [19]: Effect: Enemy death [b4f3]01.byte SPRITE_HITBOX_1; [20]: Effect: Lightning ball [b4f4]01.byte SPRITE_HITBOX_1; [21]: Enemy: Charron [b4f5]01.byte SPRITE_HITBOX_1; [22]: Enemy: ? (Unused) [b4f6]01.byte SPRITE_HITBOX_1; [23]: Enemy: Geributa [b4f7]01.byte SPRITE_HITBOX_1; [24]: Enemy: Sugata [b4f8]01.byte SPRITE_HITBOX_1; [25]: Enemy: Grimlock [b4f9]01.byte SPRITE_HITBOX_1; [26]: Enemy: Giant Bees [b4fa]01.byte SPRITE_HITBOX_1; [27]: Enemy: Myconid [b4fb]01.byte SPRITE_HITBOX_1; [28]: Enemy: Naga [b4fc]01.byte SPRITE_HITBOX_1; [29]: Enemy: Skeleton Knight (unused) [b4fd]01.byte SPRITE_HITBOX_1; [30]: Enemy: Giant Strider [b4fe]01.byte SPRITE_HITBOX_1; [31]: Enemy: Sir Gawaine [b4ff]01.byte SPRITE_HITBOX_1; [32]: Enemy: Maskman [b500]01.byte SPRITE_HITBOX_1; [33]: Enemy: Wolfman [b501]01.byte SPRITE_HITBOX_1; [34]: Enemy: Yareeka [b502]01.byte SPRITE_HITBOX_1; [35]: Enemy: Magman [b503]01.byte SPRITE_HITBOX_1; [36]: Enemy: Curly-tailed guy with spear (unused) [b504]01.byte SPRITE_HITBOX_1; [37]: Enemy: ? (unused) [b505]01.byte SPRITE_HITBOX_1; [38]: Enemy: Ikeda [b506]01.byte SPRITE_HITBOX_1; [39]: Enemy: Muppet guy (unused) [b507]01.byte SPRITE_HITBOX_1; [40]: Enemy: Lamprey [b508]01.byte SPRITE_HITBOX_1; [41]: Enemy: ? (unused) [b509]01.byte SPRITE_HITBOX_1; [42]: Enemy: Monodron [b50a]01.byte SPRITE_HITBOX_1; [43]: Enemy: Winged skeleton (unused) [b50b]01.byte SPRITE_HITBOX_1; [44]: Enemy: Tamazutsu [b50c]03.byte SPRITE_HITBOX_3; [45]: Boss: Ripasheiku [b50d]02.byte SPRITE_HITBOX_2; [46]: Boss: Zoradohna [b50e]02.byte SPRITE_HITBOX_2; [47]: Boss: Borabohra [b50f]01.byte SPRITE_HITBOX_1; [48]: Boss: Pakukame [b510]01.byte SPRITE_HITBOX_1; [49]: Boss: King Grieve [b511]01.byte SPRITE_HITBOX_1; [50]: Boss: Shadow Eura [b512]01.byte SPRITE_HITBOX_1; [51]: NPC: Walking Man 1 [b513]01.byte SPRITE_HITBOX_1; [52]: NPC: Blue lady (unused) [b514]01.byte SPRITE_HITBOX_1; [53]: NPC: Child (unused) [b515]01.byte SPRITE_HITBOX_1; [54]: NPC: Armor Salesman [b516]01.byte SPRITE_HITBOX_1; [55]: NPC: Martial Artist [b517]01.byte SPRITE_HITBOX_1; [56]: NPC: Priest [b518]01.byte SPRITE_HITBOX_1; [57]: NPC: King [b519]01.byte SPRITE_HITBOX_1; [58]: NPC: Magic Teacher [b51a]01.byte SPRITE_HITBOX_1; [59]: NPC: Key Salesman [b51b]01.byte SPRITE_HITBOX_1; [60]: NPC: Smoking Man [b51c]01.byte SPRITE_HITBOX_1; [61]: NPC: Man in Chair [b51d]01.byte SPRITE_HITBOX_1; [62]: NPC: Sitting Man [b51e]01.byte SPRITE_HITBOX_1; [63]: NPC: Meat Salesman [b51f]01.byte SPRITE_HITBOX_1; [64]: NPC: Lady in Blue Dress with Cup [b520]01.byte SPRITE_HITBOX_1; [65]: NPC: Guard [b521]01.byte SPRITE_HITBOX_1; [66]: NPC: Doctor [b522]01.byte SPRITE_HITBOX_1; [67]: NPC: Walking Woman 1 [b523]01.byte SPRITE_HITBOX_1; [68]: NPC: Walking Woman 2 [b524]01.byte SPRITE_HITBOX_1; [69]: Enemy: Eyeball (unused) [b525]00.byte SPRITE_HITBOX_0; [70]: Enemy: Zozura [b526]00.byte SPRITE_HITBOX_0; [71]: Item: Glove [b527]00.byte SPRITE_HITBOX_0; [72]: Item: Black Onyx [b528]00.byte SPRITE_HITBOX_0; [73]: Item: Pendant [b529]00.byte SPRITE_HITBOX_0; [74]: Item: Red Potion [b52a]00.byte SPRITE_HITBOX_0; [75]: Item: Poison [b52b]00.byte SPRITE_HITBOX_0; [76]: Item: Elixir [b52c]00.byte SPRITE_HITBOX_0; [77]: Item: Ointment [b52d]00.byte SPRITE_HITBOX_0; [78]: Trigger: Intro [b52e]01.byte SPRITE_HITBOX_1; [79]: Item: Mattock
; ; XREFS: ; Sprite_ReplaceWithMattock ;
[b52f]SPRITE_ENTITIES_HITBOX_TYPES_80_: [b52f]00.byte SPRITE_HITBOX_0; [80]: Magic: ?
; ; XREFS: ; Sprite_Maybe_ResetState ;
[b530]SPRITE_ENTITIES_HITBOX_TYPES_81_: [b530]00.byte SPRITE_HITBOX_0; [81]: Effect: Fountain [b531]04.byte SPRITE_HITBOX_4; [82]: Magic: ? [b532]00.byte SPRITE_HITBOX_0; [83]: Magic: ? [b533]00.byte SPRITE_HITBOX_0; [84]: Item: Wing Boots [b534]00.byte SPRITE_HITBOX_0; [85]: Item: Hour Glass [b535]00.byte SPRITE_HITBOX_0; [86]: Item: Magical Rod [b536]00.byte SPRITE_HITBOX_0; [87]: Item: Battle Suit [b537]00.byte SPRITE_HITBOX_0; [88]: Item: Battle Helmet [b538]00.byte SPRITE_HITBOX_0; [89]: Item: Dragon Slayer [b539]00.byte SPRITE_HITBOX_0; [90]: Item: Mattock [b53a]00.byte SPRITE_HITBOX_0; [91]: Item: Wing Boots (from quest) [b53b]00.byte SPRITE_HITBOX_0; [92]: Item: Red Potion [b53c]00.byte SPRITE_HITBOX_0; [93]: Item: Poison [b53d]00.byte SPRITE_HITBOX_0; [94]: Item: Glove [b53e]00.byte SPRITE_HITBOX_0; [95]: Item: Ointment [b53f]00.byte SPRITE_HITBOX_0; [96]: Effect: Spring of Trunk [b540]04.byte SPRITE_HITBOX_4; [97]: Effect: Spring of Sky [b541]04.byte SPRITE_HITBOX_4; [98]: Effect: Spring of Tower [b542]04.byte SPRITE_HITBOX_4; [99]: Effect: Boss Death [b543]01.byte SPRITE_HITBOX_1; [100]:
;============================================================================ ; The category of a sprite entity. ; ; This is used to categorize a sprite entity into the following: ; ; 0 = Enemy ; 1 = Dropped item ; 2 = NPC ; 3 = Special effect ; 4 = Game trigger ; 5 = Item ; 6 = Magic effect ; 7 = Boss ; ; XREFS: ; CurrentSprite_CheckHitPlayer ; Player_CheckShieldHitByMagic ; Player_HitEnemyWithMagic ; Player_HitSpriteWithWeapon ; Sprite_CheckHitByCastMagic ; Sprites_HasAnyEnemyOnScreen ; Sprites_UpdateBehavior ; Sprites_HasBoss ;============================================================================
; ; XREFS: ; CurrentSprite_CheckHitPlayer ; Player_CheckShieldHitByMagic ; Player_HitEnemyWithMagic ; Player_HitSpriteWithWeapon ; Sprite_CheckHitByCastMagic ; Sprites_HasAnyEnemyOnScreen ; Sprites_UpdateBehavior ; Sprites_HasBoss ;
[b544]SPRITE_CATEGORIES_BY_ENTITY: [b544]00.byte SPRITE_ENEMY; [0]: [b545]01.byte SPRITE_DROPPED; [1]: Dropped: Bread [b546]01.byte SPRITE_DROPPED; [2]: Dropped: Coin [b547]00.byte SPRITE_ENEMY; [3]: Enemy: ? [b548]00.byte SPRITE_ENEMY; [4]: Enemy: Raiden [b549]00.byte SPRITE_ENEMY; [5]: Enemy: Necron Aides [b54a]00.byte SPRITE_ENEMY; [6]: Enemy: Zombie [b54b]00.byte SPRITE_ENEMY; [7]: Enemy: Hornet [b54c]00.byte SPRITE_ENEMY; [8]: Enemy: Bihoruda [b54d]00.byte SPRITE_ENEMY; [9]: Enemy: Lilith [b54e]06.byte SPRITE_MAGIC; [10]: Magic: ? [b54f]00.byte SPRITE_ENEMY; [11]: Enemy: Yuinaru [b550]00.byte SPRITE_ENEMY; [12]: Enemy: Snowman [b551]00.byte SPRITE_ENEMY; [13]: Enemy: Nash [b552]00.byte SPRITE_ENEMY; [14]: Enemy: Fire Giant [b553]00.byte SPRITE_ENEMY; [15]: Enemy: Ishiisu [b554]00.byte SPRITE_ENEMY; [16]: Enemy: Execution Hood [b555]07.byte SPRITE_BOSS; [17]: Boss: Rokusutahn [b556]07.byte SPRITE_BOSS; [18]: Boss: unused (round body of snake boss) [b557]03.byte SPRITE_EFFECT; [19]: Effect: Enemy death [b558]03.byte SPRITE_EFFECT; [20]: Effect: Lightning ball [b559]00.byte SPRITE_ENEMY; [21]: Enemy: Charron [b55a]00.byte SPRITE_ENEMY; [22]: Enemy: ? (Unused) [b55b]00.byte SPRITE_ENEMY; [23]: Enemy: Geributa [b55c]00.byte SPRITE_ENEMY; [24]: Enemy: Sugata [b55d]00.byte SPRITE_ENEMY; [25]: Enemy: Grimlock [b55e]00.byte SPRITE_ENEMY; [26]: Enemy: Giant Bees [b55f]00.byte SPRITE_ENEMY; [27]: Enemy: Myconid [b560]00.byte SPRITE_ENEMY; [28]: Enemy: Naga [b561]00.byte SPRITE_ENEMY; [29]: Enemy: Skeleton Knight (unused) [b562]00.byte SPRITE_ENEMY; [30]: Enemy: Giant Strider [b563]00.byte SPRITE_ENEMY; [31]: Enemy: Sir Gawaine [b564]00.byte SPRITE_ENEMY; [32]: Enemy: Maskman [b565]00.byte SPRITE_ENEMY; [33]: Enemy: Wolfman [b566]00.byte SPRITE_ENEMY; [34]: Enemy: Yareeka [b567]00.byte SPRITE_ENEMY; [35]: Enemy: Magman [b568]00.byte SPRITE_ENEMY; [36]: Enemy: Curly-tailed guy with spear (unused) [b569]00.byte SPRITE_ENEMY; [37]: Enemy: ? (unused) [b56a]00.byte SPRITE_ENEMY; [38]: Enemy: Ikeda [b56b]00.byte SPRITE_ENEMY; [39]: Enemy: Muppet guy (unused) [b56c]00.byte SPRITE_ENEMY; [40]: Enemy: Lamprey [b56d]00.byte SPRITE_ENEMY; [41]: Enemy: ? (unused) [b56e]00.byte SPRITE_ENEMY; [42]: Enemy: Monodron [b56f]00.byte SPRITE_ENEMY; [43]: Enemy: Winged skeleton (unused) [b570]00.byte SPRITE_ENEMY; [44]: Enemy: Tamazutsu [b571]07.byte SPRITE_BOSS; [45]: Boss: Ripasheiku [b572]07.byte SPRITE_BOSS; [46]: Boss: Zoradohna [b573]07.byte SPRITE_BOSS; [47]: Boss: Borabohra [b574]07.byte SPRITE_BOSS; [48]: Boss: Pakukame [b575]07.byte SPRITE_BOSS; [49]: Boss: King Grieve [b576]07.byte SPRITE_BOSS; [50]: Boss: Shadow Eura [b577]07.byte SPRITE_BOSS; [51]: NPC: Walking Man 1 [b578]02.byte SPRITE_NPC; [52]: NPC: Blue lady (unused) [b579]02.byte SPRITE_NPC; [53]: NPC: Child (unused) [b57a]02.byte SPRITE_NPC; [54]: NPC: Armor Salesman [b57b]02.byte SPRITE_NPC; [55]: NPC: Martial Artist [b57c]02.byte SPRITE_NPC; [56]: NPC: Priest [b57d]02.byte SPRITE_NPC; [57]: NPC: King [b57e]02.byte SPRITE_NPC; [58]: NPC: Magic Teacher [b57f]02.byte SPRITE_NPC; [59]: NPC: Key Salesman [b580]02.byte SPRITE_NPC; [60]: NPC: Smoking Man [b581]02.byte SPRITE_NPC; [61]: NPC: Man in Chair [b582]02.byte SPRITE_NPC; [62]: NPC: Sitting Man [b583]02.byte SPRITE_NPC; [63]: NPC: Meat Salesman [b584]02.byte SPRITE_NPC; [64]: NPC: Lady in Blue Dress with Cup [b585]02.byte SPRITE_NPC; [65]: NPC: Guard [b586]02.byte SPRITE_NPC; [66]: NPC: Doctor [b587]02.byte SPRITE_NPC; [67]: NPC: Walking Woman 1 [b588]02.byte SPRITE_NPC; [68]: NPC: Walking Woman 2 [b589]02.byte SPRITE_NPC; [69]: Enemy: Eyeball (unused) [b58a]00.byte SPRITE_ENEMY; [70]: Enemy: Zozura [b58b]00.byte SPRITE_ENEMY; [71]: Item: Glove [b58c]05.byte SPRITE_ITEM; [72]: Item: Black Onyx [b58d]05.byte SPRITE_ITEM; [73]: Item: Pendant [b58e]05.byte SPRITE_ITEM; [74]: Item: Red Potion [b58f]05.byte SPRITE_ITEM; [75]: Item: Poison [b590]05.byte SPRITE_ITEM; [76]: Item: Elixir [b591]05.byte SPRITE_ITEM; [77]: Item: Ointment [b592]05.byte SPRITE_ITEM; [78]: Trigger: Intro [b593]04.byte SPRITE_TRIGGER; [79]: Item: Mattock [b594]05.byte SPRITE_ITEM; [80]: Magic: ? [b595]06.byte SPRITE_MAGIC; [81]: Effect: Fountain [b596]03.byte SPRITE_EFFECT; [82]: Magic: ? [b597]06.byte SPRITE_MAGIC; [83]: Magic: ? [b598]06.byte SPRITE_MAGIC; [84]: Item: Wing Boots [b599]05.byte SPRITE_ITEM; [85]: Item: Hour Glass [b59a]05.byte SPRITE_ITEM; [86]: Item: Magical Rod [b59b]05.byte SPRITE_ITEM; [87]: Item: Battle Suit [b59c]05.byte SPRITE_ITEM; [88]: Item: Battle Helmet [b59d]05.byte SPRITE_ITEM; [89]: Item: Dragon Slayer [b59e]05.byte SPRITE_ITEM; [90]: Item: Mattock [b59f]05.byte SPRITE_ITEM; [91]: Item: Wing Boots (from quest) [b5a0]05.byte SPRITE_ITEM; [92]: Item: Red Potion [b5a1]05.byte SPRITE_ITEM; [93]: Item: Poison [b5a2]05.byte SPRITE_ITEM; [94]: Item: Glove [b5a3]05.byte SPRITE_ITEM; [95]: Item: Ointment [b5a4]05.byte SPRITE_ITEM; [96]: Effect: Spring of Trunk [b5a5]03.byte SPRITE_EFFECT; [97]: Effect: Spring of Sky [b5a6]03.byte SPRITE_EFFECT; [98]: Effect: Spring of Tower [b5a7]03.byte SPRITE_EFFECT; [99]: Effect: Boss Death [b5a8]03.byte SPRITE_EFFECT; [100]:
;============================================================================ ; Starting HP for each entity type. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[b5a9]SPRITE_ENTITIES_HP: [b5a9]00.byte $00; [0]: [b5aa]00.byte $00; [1]: Dropped: Bread [b5ab]00.byte $00; [2]: Dropped: Coin [b5ac]00.byte $00; [3]: Enemy: ? [b5ad]12.byte $12; [4]: Enemy: Raiden [b5ae]18.byte $18; [5]: Enemy: Necron Aides [b5af]0e.byte $0e; [6]: Enemy: Zombie [b5b0]03.byte $03; [7]: Enemy: Hornet [b5b1]05.byte $05; [8]: Enemy: Bihoruda
; ; XREFS: ; SpriteBehavior_Pakukame ;
[b5b2]SPRITE_ENTITIES_HP_9_: [b5b2]07.byte $07; [9]: Enemy: Lilith [b5b3]08.byte $08; [10]: Magic: ? [b5b4]03.byte $03; [11]: Enemy: Yuinaru [b5b5]10.byte $10; [12]: Enemy: Snowman [b5b6]0c.byte $0c; [13]: Enemy: Nash [b5b7]14.byte $14; [14]: Enemy: Fire Giant [b5b8]18.byte $18; [15]: Enemy: Ishiisu [b5b9]64.byte $64; [16]: Enemy: Execution Hood [b5ba]46.byte $46; [17]: Boss: Rokusutahn [b5bb]24.byte $24; [18]: Boss: unused (round body of snake boss) [b5bc]00.byte $00; [19]: Effect: Enemy death [b5bd]00.byte $00; [20]: Effect: Lightning ball [b5be]1a.byte $1a; [21]: Enemy: Charron [b5bf]08.byte $08; [22]: Enemy: ? (Unused) [b5c0]12.byte $12; [23]: Enemy: Geributa [b5c1]16.byte $16; [24]: Enemy: Sugata [b5c2]1d.byte $1d; [25]: Enemy: Grimlock [b5c3]13.byte $13; [26]: Enemy: Giant Bees [b5c4]16.byte $16; [27]: Enemy: Myconid [b5c5]17.byte $17; [28]: Enemy: Naga [b5c6]00.byte $00; [29]: Enemy: Skeleton Knight (unused) [b5c7]1d.byte $1d; [30]: Enemy: Giant Strider [b5c8]23.byte $23; [31]: Enemy: Sir Gawaine [b5c9]20.byte $20; [32]: Enemy: Maskman [b5ca]26.byte $26; [33]: Enemy: Wolfman [b5cb]30.byte $30; [34]: Enemy: Yareeka [b5cc]17.byte $17; [35]: Enemy: Magman [b5cd]24.byte $24; [36]: Enemy: Curly-tailed guy with spear (unused) [b5ce]1f.byte $1f; [37]: Enemy: ? (unused) [b5cf]11.byte $11; [38]: Enemy: Ikeda [b5d0]20.byte $20; [39]: Enemy: Muppet guy (unused) [b5d1]38.byte $38; [40]: Enemy: Lamprey [b5d2]24.byte $24; [41]: Enemy: ? (unused) [b5d3]0a.byte $0a; [42]: Enemy: Monodron [b5d4]0b.byte $0b; [43]: Enemy: Winged skeleton (unused) [b5d5]1a.byte $1a; [44]: Enemy: Tamazutsu [b5d6]4b.byte $4b; [45]: Boss: Ripasheiku [b5d7]73.byte $73; [46]: Boss: Zoradohna [b5d8]69.byte $69; [47]: Boss: Borabohra [b5d9]28.byte $28; [48]: Boss: Pakukame [b5da]18.byte $18; [49]: Boss: King Grieve [b5db]fa.byte $fa; [50]: Boss: Shadow Eura [b5dc]fa.byte $fa; [51]: NPC: Walking Man 1 [b5dd]00.byte $00; [52]: NPC: Blue lady (unused) [b5de]00.byte $00; [53]: NPC: Child (unused) [b5df]00.byte $00; [54]: NPC: Armor Salesman [b5e0]00.byte $00; [55]: NPC: Martial Artist [b5e1]00.byte $00; [56]: NPC: Priest [b5e2]00.byte $00; [57]: NPC: King [b5e3]00.byte $00; [58]: NPC: Magic Teacher [b5e4]00.byte $00; [59]: NPC: Key Salesman [b5e5]00.byte $00; [60]: NPC: Smoking Man [b5e6]00.byte $00; [61]: NPC: Man in Chair [b5e7]00.byte $00; [62]: NPC: Sitting Man [b5e8]00.byte $00; [63]: NPC: Meat Salesman [b5e9]00.byte $00; [64]: NPC: Lady in Blue Dress with Cup [b5ea]00.byte $00; [65]: NPC: Guard [b5eb]00.byte $00; [66]: NPC: Doctor [b5ec]00.byte $00; [67]: NPC: Walking Woman 1 [b5ed]00.byte $00; [68]: NPC: Walking Woman 2 [b5ee]00.byte $00; [69]: Enemy: Eyeball (unused) [b5ef]10.byte $10; [70]: Enemy: Zozura [b5f0]09.byte $09; [71]: Item: Glove [b5f1]00.byte $00; [72]: Item: Black Onyx [b5f2]00.byte $00; [73]: Item: Pendant [b5f3]00.byte $00; [74]: Item: Red Potion [b5f4]00.byte $00; [75]: Item: Poison [b5f5]00.byte $00; [76]: Item: Elixir [b5f6]00.byte $00; [77]: Item: Ointment [b5f7]00.byte $00; [78]: Trigger: Intro [b5f8]00.byte $00; [79]: Item: Mattock [b5f9]00.byte $00; [80]: Magic: ? [b5fa]08.byte $08; [81]: Effect: Fountain [b5fb]00.byte $00; [82]: Magic: ? [b5fc]08.byte $08; [83]: Magic: ? [b5fd]08.byte $08; [84]: Item: Wing Boots [b5fe]00.byte $00; [85]: Item: Hour Glass [b5ff]00.byte $00; [86]: Item: Magical Rod [b600]00.byte $00; [87]: Item: Battle Suit [b601]00.byte $00; [88]: Item: Battle Helmet [b602]00.byte $00; [89]: Item: Dragon Slayer [b603]00.byte $00; [90]: Item: Mattock [b604]00.byte $00; [91]: Item: Wing Boots (from quest) [b605]00.byte $00; [92]: Item: Red Potion [b606]00.byte $00; [93]: Item: Poison [b607]00.byte $00; [94]: Item: Glove [b608]00.byte $00; [95]: Item: Ointment [b609]00.byte $00; [96]: Effect: Spring of Trunk [b60a]00.byte $00; [97]: Effect: Spring of Sky [b60b]00.byte $00; [98]: Effect: Spring of Tower [b60c]00.byte $00; [99]: Effect: Boss Death [b60d]00.byte $00; [100]:
;============================================================================ ; Experience gained from defeating each entity type. ; ; XREFS: ; Player_AddExperienceFromSprite ;============================================================================
; ; XREFS: ; Player_AddExperienceFromSprite ;
[b60e]ENEMY_EXPERIENCE: [b60e]00.byte $00; [0]: [b60f]00.byte $00; [1]: Dropped: Bread [b610]00.byte $00; [2]: Dropped: Coin [b611]00.byte $00; [3]: Enemy: ? [b612]23.byte $23; [4]: Enemy: Raiden [b613]37.byte $37; [5]: Enemy: Necron Aides [b614]19.byte $19; [6]: Enemy: Zombie [b615]19.byte $19; [7]: Enemy: Hornet [b616]23.byte $23; [8]: Enemy: Bihoruda [b617]19.byte $19; [9]: Enemy: Lilith [b618]00.byte $00; [10]: Magic: ? [b619]19.byte $19; [11]: Enemy: Yuinaru [b61a]37.byte $37; [12]: Enemy: Snowman [b61b]3c.byte $3c; [13]: Enemy: Nash [b61c]2d.byte $2d; [14]: Enemy: Fire Giant [b61d]0a.byte $0a; [15]: Enemy: Ishiisu [b61e]32.byte $32; [16]: Enemy: Execution Hood [b61f]78.byte $78; [17]: Boss: Rokusutahn [b620]5a.byte $5a; [18]: Boss: unused (round body of snake boss) [b621]00.byte $00; [19]: Effect: Enemy death [b622]00.byte $00; [20]: Effect: Lightning ball [b623]41.byte $41; [21]: Enemy: Charron [b624]00.byte $00; [22]: Enemy: ? (Unused) [b625]28.byte $28; [23]: Enemy: Geributa [b626]0d.byte $0d; [24]: Enemy: Sugata [b627]3a.byte $3a; [25]: Enemy: Grimlock [b628]1d.byte $1d; [26]: Enemy: Giant Bees [b629]1a.byte $1a; [27]: Enemy: Myconid [b62a]23.byte $23; [28]: Enemy: Naga [b62b]00.byte $00; [29]: Enemy: Skeleton Knight (unused) [b62c]30.byte $30; [30]: Enemy: Giant Strider [b62d]3a.byte $3a; [31]: Enemy: Sir Gawaine [b62e]36.byte $36; [32]: Enemy: Maskman [b62f]31.byte $31; [33]: Enemy: Wolfman [b630]1e.byte $1e; [34]: Enemy: Yareeka [b631]3e.byte $3e; [35]: Enemy: Magman [b632]26.byte $26; [36]: Enemy: Curly-tailed guy with spear (unused) [b633]19.byte $19; [37]: Enemy: ? (unused) [b634]21.byte $21; [38]: Enemy: Ikeda [b635]1d.byte $1d; [39]: Enemy: Muppet guy (unused) [b636]1e.byte $1e; [40]: Enemy: Lamprey [b637]18.byte $18; [41]: Enemy: ? (unused) [b638]14.byte $14; [42]: Enemy: Monodron [b639]12.byte $12; [43]: Enemy: Winged skeleton (unused) [b63a]0f.byte $0f; [44]: Enemy: Tamazutsu [b63b]5a.byte $5a; [45]: Boss: Ripasheiku [b63c]9e.byte $9e; [46]: Boss: Zoradohna [b63d]4b.byte $4b; [47]: Boss: Borabohra [b63e]55.byte $55; [48]: Boss: Pakukame [b63f]50.byte $50; [49]: Boss: King Grieve [b640]00.byte $00; [50]: Boss: Shadow Eura [b641]00.byte $00; [51]: NPC: Walking Man 1 [b642]00.byte $00; [52]: NPC: Blue lady (unused) [b643]00.byte $00; [53]: NPC: Child (unused) [b644]00.byte $00; [54]: NPC: Armor Salesman [b645]00.byte $00; [55]: NPC: Martial Artist [b646]00.byte $00; [56]: NPC: Priest [b647]00.byte $00; [57]: NPC: King [b648]00.byte $00; [58]: NPC: Magic Teacher [b649]00.byte $00; [59]: NPC: Key Salesman [b64a]00.byte $00; [60]: NPC: Smoking Man [b64b]00.byte $00; [61]: NPC: Man in Chair [b64c]00.byte $00; [62]: NPC: Sitting Man [b64d]00.byte $00; [63]: NPC: Meat Salesman [b64e]00.byte $00; [64]: NPC: Lady in Blue Dress with Cup [b64f]00.byte $00; [65]: NPC: Guard [b650]00.byte $00; [66]: NPC: Doctor [b651]00.byte $00; [67]: NPC: Walking Woman 1 [b652]00.byte $00; [68]: NPC: Walking Woman 2 [b653]00.byte $00; [69]: Enemy: Eyeball (unused) [b654]19.byte $19; [70]: Enemy: Zozura [b655]1e.byte $1e; [71]: Item: Glove [b656]00.byte $00; [72]: Item: Black Onyx [b657]00.byte $00; [73]: Item: Pendant [b658]00.byte $00; [74]: Item: Red Potion [b659]00.byte $00; [75]: Item: Poison [b65a]00.byte $00; [76]: Item: Elixir [b65b]00.byte $00; [77]: Item: Ointment [b65c]00.byte $00; [78]: Trigger: Intro [b65d]00.byte $00; [79]: Item: Mattock [b65e]00.byte $00; [80]: Magic: ? [b65f]08.byte $08; [81]: Effect: Fountain [b660]00.byte $00; [82]: Magic: ? [b661]08.byte $08; [83]: Magic: ? [b662]08.byte $08; [84]: Item: Wing Boots [b663]00.byte $00; [85]: Item: Hour Glass [b664]00.byte $00; [86]: Item: Magical Rod [b665]00.byte $00; [87]: Item: Battle Suit [b666]00.byte $00; [88]: Item: Battle Helmet [b667]00.byte $00; [89]: Item: Dragon Slayer [b668]00.byte $00; [90]: Item: Mattock [b669]00.byte $00; [91]: Item: Wing Boots (from quest) [b66a]00.byte $00; [92]: Item: Red Potion [b66b]00.byte $00; [93]: Item: Poison [b66c]00.byte $00; [94]: Item: Glove [b66d]00.byte $00; [95]: Item: Ointment [b66e]00.byte $00; [96]: Effect: Spring of Trunk [b66f]00.byte $00; [97]: Effect: Spring of Sky [b670]00.byte $00; [98]: Effect: Spring of Tower [b671]00.byte $00; [99]: Effect: Boss Death
;============================================================================ ; Per-entity indexes into the SPRITE_DROP_VALUES table. ; ; This maps entities that may drop gold or bread to an index ; into a drop values table, which determines how much gold ; or how much HP the drop will be worth. ; ; If the value is 0xFF, the entity will not drop anything. ; ; XREFS: ; Sprite_RunDeathDropHandler ;============================================================================
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[b672]SPRITE_ENTITY_DROP_VALUES_INDEX: [b672]ff.byte $ff; [0]: [b673]ff.byte $ff; [1]: Dropped: Bread [b674]ff.byte $ff; [2]: Dropped: Coin [b675]00.byte $00; [3]: Enemy: ? [b676]08.byte $08; [4]: Enemy: Raiden [b677]11.byte $11; [5]: Enemy: Necron Aides [b678]ff.byte $ff; [6]: Enemy: Zombie [b679]07.byte $07; [7]: Enemy: Hornet [b67a]08.byte $08; [8]: Enemy: Bihoruda [b67b]ff.byte $ff; [9]: Enemy: Lilith [b67c]00.byte $00; [10]: Magic: ? [b67d]32.byte $32; [11]: Enemy: Yuinaru [b67e]13.byte $13; [12]: Enemy: Snowman [b67f]12.byte $12; [13]: Enemy: Nash [b680]11.byte $11; [14]: Enemy: Fire Giant [b681]15.byte $15; [15]: Enemy: Ishiisu [b682]1d.byte $1d; [16]: Enemy: Execution Hood [b683]15.byte $15; [17]: Boss: Rokusutahn [b684]06.byte $06; [18]: Boss: unused (round body of snake boss) [b685]ff.byte $ff; [19]: Effect: Enemy death [b686]ff.byte $ff; [20]: Effect: Lightning ball [b687]14.byte $14; [21]: Enemy: Charron [b688]00.byte $00; [22]: Enemy: ? (Unused) [b689]0f.byte $0f; [23]: Enemy: Geributa [b68a]13.byte $13; [24]: Enemy: Sugata [b68b]12.byte $12; [25]: Enemy: Grimlock [b68c]14.byte $14; [26]: Enemy: Giant Bees [b68d]32.byte $32; [27]: Enemy: Myconid [b68e]38.byte $38; [28]: Enemy: Naga [b68f]ff.byte $ff; [29]: Enemy: Skeleton Knight (unused) [b690]16.byte $16; [30]: Enemy: Giant Strider [b691]18.byte $18; [31]: Enemy: Sir Gawaine [b692]19.byte $19; [32]: Enemy: Maskman [b693]1a.byte $1a; [33]: Enemy: Wolfman [b694]33.byte $33; [34]: Enemy: Yareeka [b695]1b.byte $1b; [35]: Enemy: Magman [b696]17.byte $17; [36]: Enemy: Curly-tailed guy with spear (unused) [b697]18.byte $18; [37]: Enemy: ? (unused) [b698]13.byte $13; [38]: Enemy: Ikeda [b699]33.byte $33; [39]: Enemy: Muppet guy (unused) [b69a]34.byte $34; [40]: Enemy: Lamprey [b69b]33.byte $33; [41]: Enemy: ? (unused) [b69c]09.byte $09; [42]: Enemy: Monodron [b69d]34.byte $34; [43]: Enemy: Winged skeleton (unused) [b69e]15.byte $15; [44]: Enemy: Tamazutsu [b69f]19.byte $19; [45]: Boss: Ripasheiku [b6a0]1c.byte $1c; [46]: Boss: Zoradohna [b6a1]08.byte $08; [47]: Boss: Borabohra [b6a2]16.byte $16; [48]: Boss: Pakukame [b6a3]03.byte $03; [49]: Boss: King Grieve [b6a4]ff.byte $ff; [50]: Boss: Shadow Eura [b6a5]ff.byte $ff; [51]: NPC: Walking Man 1 [b6a6]ff.byte $ff; [52]: NPC: Blue lady (unused) [b6a7]ff.byte $ff; [53]: NPC: Child (unused) [b6a8]ff.byte $ff; [54]: NPC: Armor Salesman [b6a9]ff.byte $ff; [55]: NPC: Martial Artist [b6aa]ff.byte $ff; [56]: NPC: Priest [b6ab]ff.byte $ff; [57]: NPC: King [b6ac]ff.byte $ff; [58]: NPC: Magic Teacher [b6ad]ff.byte $ff; [59]: NPC: Key Salesman [b6ae]ff.byte $ff; [60]: NPC: Smoking Man [b6af]ff.byte $ff; [61]: NPC: Man in Chair [b6b0]ff.byte $ff; [62]: NPC: Sitting Man [b6b1]ff.byte $ff; [63]: NPC: Meat Salesman [b6b2]ff.byte $ff; [64]: NPC: Lady in Blue Dress with Cup [b6b3]ff.byte $ff; [65]: NPC: Guard [b6b4]ff.byte $ff; [66]: NPC: Doctor [b6b5]ff.byte $ff; [67]: NPC: Walking Woman 1 [b6b6]ff.byte $ff; [68]: NPC: Walking Woman 2 [b6b7]ff.byte $ff; [69]: Enemy: Eyeball (unused) [b6b8]0f.byte $0f; [70]: Enemy: Zozura [b6b9]32.byte $32; [71]: Item: Glove [b6ba]ff.byte $ff; [72]: Item: Black Onyx [b6bb]ff.byte $ff; [73]: Item: Pendant [b6bc]ff.byte $ff; [74]: Item: Red Potion [b6bd]ff.byte $ff; [75]: Item: Poison [b6be]ff.byte $ff; [76]: Item: Elixir [b6bf]ff.byte $ff; [77]: Item: Ointment [b6c0]ff.byte $ff; [78]: Trigger: Intro [b6c1]ff.byte $ff; [79]: Item: Mattock [b6c2]ff.byte $ff; [80]: Magic: ? [b6c3]00.byte $00; [81]: Effect: Fountain [b6c4]ff.byte $ff; [82]: Magic: ? [b6c5]00.byte $00; [83]: Magic: ? [b6c6]00.byte $00; [84]: Item: Wing Boots [b6c7]ff.byte $ff; [85]: Item: Hour Glass [b6c8]ff.byte $ff; [86]: Item: Magical Rod [b6c9]ff.byte $ff; [87]: Item: Battle Suit [b6ca]ff.byte $ff; [88]: Item: Battle Helmet [b6cb]ff.byte $ff; [89]: Item: Dragon Slayer [b6cc]ff.byte $ff; [90]: Item: Mattock [b6cd]ff.byte $ff; [91]: Item: Wing Boots (from quest) [b6ce]ff.byte $ff; [92]: Item: Red Potion [b6cf]ff.byte $ff; [93]: Item: Poison [b6d0]ff.byte $ff; [94]: Item: Glove [b6d1]ff.byte $ff; [95]: Item: Ointment [b6d2]ff.byte $ff; [96]: Effect: Spring of Trunk [b6d3]ff.byte $ff; [97]: Effect: Spring of Sky [b6d4]ff.byte $ff; [98]: Effect: Spring of Tower [b6d5]ff.byte $ff; [99]: Effect: Boss Death [b6d6]ff.byte $ff; [100]:
;============================================================================ ; Attack damage from each sprite entity type. ; ; XREFS: ; Player_ApplyDamage ; Player_HandleHitByMagic ;============================================================================
; ; XREFS: ; Player_ApplyDamage ; Player_HandleHitByMagic ;
[b6d7]SPRITE_ENTITY_DAMAGES: [b6d7]00.byte $00; [0]: [b6d8]00.byte $00; [1]: Dropped: Bread [b6d9]00.byte $00; [2]: Dropped: Coin [b6da]1f.byte $1f; [3]: Enemy: ? [b6db]07.byte $07; [4]: Enemy: Raiden [b6dc]09.byte $09; [5]: Enemy: Necron Aides [b6dd]06.byte $06; [6]: Enemy: Zombie [b6de]03.byte $03; [7]: Enemy: Hornet [b6df]04.byte $04; [8]: Enemy: Bihoruda [b6e0]06.byte $06; [9]: Enemy: Lilith [b6e1]1c.byte $1c; [10]: Magic: ? [b6e2]03.byte $03; [11]: Enemy: Yuinaru [b6e3]04.byte $04; [12]: Enemy: Snowman [b6e4]05.byte $05; [13]: Enemy: Nash [b6e5]07.byte $07; [14]: Enemy: Fire Giant [b6e6]0d.byte $0d; [15]: Enemy: Ishiisu [b6e7]0f.byte $0f; [16]: Enemy: Execution Hood [b6e8]14.byte $14; [17]: Boss: Rokusutahn [b6e9]14.byte $14; [18]: Boss: unused (round body of snake boss) [b6ea]00.byte $00; [19]: Effect: Enemy death [b6eb]00.byte $00; [20]: Effect: Lightning ball [b6ec]07.byte $07; [21]: Enemy: Charron [b6ed]0a.byte $0a; [22]: Enemy: ? (Unused) [b6ee]0a.byte $0a; [23]: Enemy: Geributa [b6ef]04.byte $04; [24]: Enemy: Sugata [b6f0]0d.byte $0d; [25]: Enemy: Grimlock [b6f1]05.byte $05; [26]: Enemy: Giant Bees [b6f2]0e.byte $0e; [27]: Enemy: Myconid [b6f3]17.byte $17; [28]: Enemy: Naga [b6f4]00.byte $00; [29]: Enemy: Skeleton Knight (unused) [b6f5]0f.byte $0f; [30]: Enemy: Giant Strider [b6f6]0c.byte $0c; [31]: Enemy: Sir Gawaine [b6f7]0b.byte $0b; [32]: Enemy: Maskman [b6f8]11.byte $11; [33]: Enemy: Wolfman [b6f9]12.byte $12; [34]: Enemy: Yareeka [b6fa]09.byte $09; [35]: Enemy: Magman [b6fb]10.byte $10; [36]: Enemy: Curly-tailed guy with spear (unused) [b6fc]0b.byte $0b; [37]: Enemy: ? (unused) [b6fd]07.byte $07; [38]: Enemy: Ikeda [b6fe]0a.byte $0a; [39]: Enemy: Muppet guy (unused) [b6ff]10.byte $10; [40]: Enemy: Lamprey [b700]0c.byte $0c; [41]: Enemy: ? (unused) [b701]05.byte $05; [42]: Enemy: Monodron [b702]06.byte $06; [43]: Enemy: Winged skeleton (unused) [b703]0f.byte $0f; [44]: Enemy: Tamazutsu [b704]12.byte $12; [45]: Boss: Ripasheiku [b705]1c.byte $1c; [46]: Boss: Zoradohna [b706]18.byte $18; [47]: Boss: Borabohra [b707]0d.byte $0d; [48]: Boss: Pakukame [b708]0b.byte $0b; [49]: Boss: King Grieve [b709]28.byte $28; [50]: Boss: Shadow Eura [b70a]29.byte $29; [51]: NPC: Walking Man 1 [b70b]00.byte $00; [52]: NPC: Blue lady (unused) [b70c]00.byte $00; [53]: NPC: Child (unused) [b70d]00.byte $00; [54]: NPC: Armor Salesman [b70e]00.byte $00; [55]: NPC: Martial Artist [b70f]00.byte $00; [56]: NPC: Priest [b710]00.byte $00; [57]: NPC: King [b711]00.byte $00; [58]: NPC: Magic Teacher [b712]00.byte $00; [59]: NPC: Key Salesman [b713]00.byte $00; [60]: NPC: Smoking Man [b714]00.byte $00; [61]: NPC: Man in Chair [b715]00.byte $00; [62]: NPC: Sitting Man [b716]00.byte $00; [63]: NPC: Meat Salesman [b717]00.byte $00; [64]: NPC: Lady in Blue Dress with Cup [b718]00.byte $00; [65]: NPC: Guard [b719]00.byte $00; [66]: NPC: Doctor [b71a]00.byte $00; [67]: NPC: Walking Woman 1 [b71b]00.byte $00; [68]: NPC: Walking Woman 2 [b71c]00.byte $00; [69]: Enemy: Eyeball (unused) [b71d]08.byte $08; [70]: Enemy: Zozura [b71e]07.byte $07; [71]: Item: Glove [b71f]00.byte $00; [72]: Item: Black Onyx [b720]00.byte $00; [73]: Item: Pendant [b721]00.byte $00; [74]: Item: Red Potion [b722]00.byte $00; [75]: Item: Poison [b723]00.byte $00; [76]: Item: Elixir [b724]00.byte $00; [77]: Item: Ointment [b725]00.byte $00; [78]: Trigger: Intro [b726]00.byte $00; [79]: Item: Mattock [b727]00.byte $00; [80]: Magic: ? [b728]08.byte $08; [81]: Effect: Fountain [b729]00.byte $00; [82]: Magic: ? [b72a]1c.byte $1c; [83]: Magic: ? [b72b]08.byte $08; [84]: Item: Wing Boots [b72c]00.byte $00; [85]: Item: Hour Glass [b72d]00.byte $00; [86]: Item: Magical Rod [b72e]00.byte $00; [87]: Item: Battle Suit [b72f]00.byte $00; [88]: Item: Battle Helmet [b730]00.byte $00; [89]: Item: Dragon Slayer [b731]00.byte $00; [90]: Item: Mattock [b732]00.byte $00; [91]: Item: Wing Boots (from quest) [b733]00.byte $00; [92]: Item: Red Potion [b734]00.byte $00; [93]: Item: Poison [b735]00.byte $00; [94]: Item: Glove [b736]00.byte $00; [95]: Item: Ointment [b737]00.byte $00; [96]: Effect: Spring of Trunk [b738]00.byte $00; [97]: Effect: Spring of Sky [b739]00.byte $00; [98]: Effect: Spring of Tower [b73a]00.byte $00; [99]: Effect: Boss Death
;============================================================================ ; A mapping of entity types to magic defense values. ; ; Each value defines the magic reduction for each spell as pairs ; of 2 bits in the following order: ; ; 00 00 00 00 ; | | | '- Tilte ; | | '- Death ; | '- Fire ; '- Thunder ; ; Each pair can have the following values: ; ; 00 = 0% reduction ; 01 = 50% reduction ; 10 = 100% reduction ; 11 = 100% reduction ; ; Note that the Deluge spell is always set at 0% reduction. ; ; XREFS: ; Player_HitEnemyWithMagic ;============================================================================
; ; XREFS: ; Player_HitEnemyWithMagic ;
[b73b]SPRITE_ENTITY_MAGIC_DEFENSE: [b73b]fc.byte $fc; [0]: <unused> [b73c]fc.byte $fc; [1]: Dropped: Bread [b73d]fc.byte $fc; [2]: Dropped: Coin [b73e]fc.byte $fc; [3]: Enemy: ? [b73f]10.byte $10; [4]: Enemy: Raiden [b740]50.byte $50; [5]: Enemy: Necron Aides [b741]0c.byte $0c; [6]: Enemy: Zombie [b742]00.byte $00; [7]: Enemy: Hornet [b743]00.byte $00; [8]: Enemy: Bihoruda [b744]00.byte $00; [9]: Enemy: Lilith [b745]fc.byte $fc; [10]: Magic: ? [b746]00.byte $00; [11]: Enemy: Yuinaru [b747]04.byte $04; [12]: Enemy: Snowman [b748]fc.byte $fc; [13]: Enemy: Nash [b749]40.byte $40; [14]: Enemy: Fire Giant [b74a]14.byte $14; [15]: Enemy: Ishiisu [b74b]c0.byte $c0; [16]: Enemy: Execution Hood [b74c]00.byte $00; [17]: Boss: Rokusutahn [b74d]d0.byte $d0; [18]: Boss: unused (round body of snake boss) [b74e]fc.byte $fc; [19]: Effect: Enemy death [b74f]fc.byte $fc; [20]: Effect: Lightning ball [b750]00.byte $00; [21]: Enemy: Charron [b751]fc.byte $fc; [22]: Enemy: ? (Unused) [b752]00.byte $00; [23]: Enemy: Geributa [b753]3c.byte $3c; [24]: Enemy: Sugata [b754]00.byte $00; [25]: Enemy: Grimlock [b755]0c.byte $0c; [26]: Enemy: Giant Bees [b756]14.byte $14; [27]: Enemy: Myconid [b757]00.byte $00; [28]: Enemy: Naga [b758]00.byte $00; [29]: Enemy: Skeleton Knight (unused) [b759]00.byte $00; [30]: Enemy: Giant Strider [b75a]00.byte $00; [31]: Enemy: Sir Gawaine [b75b]00.byte $00; [32]: Enemy: Maskman [b75c]00.byte $00; [33]: Enemy: Wolfman [b75d]00.byte $00; [34]: Enemy: Yareeka [b75e]00.byte $00; [35]: Enemy: Magman [b75f]00.byte $00; [36]: Enemy: Curly-tailed guy with spear (unused) [b760]54.byte $54; [37]: Enemy: ? (unused) [b761]00.byte $00; [38]: Enemy: Ikeda [b762]40.byte $40; [39]: Enemy: Muppet guy (unused) [b763]00.byte $00; [40]: Enemy: Lamprey [b764]00.byte $00; [41]: Enemy: ? (unused) [b765]00.byte $00; [42]: Enemy: Monodron [b766]00.byte $00; [43]: Enemy: Winged skeleton (unused) [b767]14.byte $14; [44]: Enemy: Tamazutsu [b768]40.byte $40; [45]: Boss: Ripasheiku [b769]f4.byte $f4; [46]: Boss: Zoradohna [b76a]e0.byte $e0; [47]: Boss: Borabohra [b76b]44.byte $44; [48]: Boss: Pakukame [b76c]00.byte $00; [49]: Boss: King Grieve [b76d]fc.byte $fc; [50]: Boss: Shadow Eura [b76e]fc.byte $fc; [51]: NPC: Walking Man 1 [b76f]fc.byte $fc; [52]: NPC: Blue lady (unused) [b770]fc.byte $fc; [53]: NPC: Child (unused) [b771]fc.byte $fc; [54]: NPC: Armor Salesman [b772]fc.byte $fc; [55]: NPC: Martial Artist [b773]fc.byte $fc; [56]: NPC: Priest [b774]fc.byte $fc; [57]: NPC: King [b775]fc.byte $fc; [58]: NPC: Magic Teacher [b776]fc.byte $fc; [59]: NPC: Key Salesman [b777]fc.byte $fc; [60]: NPC: Smoking Man [b778]fc.byte $fc; [61]: NPC: Man in Chair [b779]fc.byte $fc; [62]: NPC: Sitting Man [b77a]fc.byte $fc; [63]: NPC: Meat Salesman [b77b]fc.byte $fc; [64]: NPC: Lady in Blue Dress with Cup [b77c]fc.byte $fc; [65]: NPC: Guard [b77d]fc.byte $fc; [66]: NPC: Doctor [b77e]fc.byte $fc; [67]: NPC: Walking Woman 1 [b77f]fc.byte $fc; [68]: NPC: Walking Woman 2 [b780]fc.byte $fc; [69]: Enemy: Eyeball (unused) [b781]00.byte $00; [70]: Enemy: Zozura [b782]00.byte $00; [71]: Item: Glove [b783]00.byte $00; [72]: Item: Black Onyx [b784]fc.byte $fc; [73]: Item: Pendant [b785]fc.byte $fc; [74]: Item: Red Potion [b786]00.byte $00; [75]: Item: Poison [b787]fc.byte $fc; [76]: Item: Elixir [b788]00.byte $00; [77]: Item: Ointment [b789]fc.byte $fc; [78]: Trigger: Intro [b78a]fc.byte $fc; [79]: Item: Mattock [b78b]00.byte $00; [80]: Magic: ? [b78c]fc.byte $fc; [81]: Effect: Fountain [b78d]fc.byte $fc; [82]: Magic: ? [b78e]fc.byte $fc; [83]: Magic: ? [b78f]fc.byte $fc; [84]: Item: Wing Boots [b790]fc.byte $fc; [85]: Item: Hour Glass [b791]fc.byte $fc; [86]: Item: Magical Rod [b792]fc.byte $fc; [87]: Item: Battle Suit [b793]fc.byte $fc; [88]: Item: Battle Helmet [b794]fc.byte $fc; [89]: Item: Dragon Slayer [b795]fc.byte $fc; [90]: Item: Mattock [b796]fc.byte $fc; [91]: Item: Wing Boots (from quest) [b797]fc.byte $fc; [92]: Item: Red Potion [b798]fc.byte $fc; [93]: Item: Poison [b799]fc.byte $fc; [94]: Item: Glove [b79a]fc.byte $fc; [95]: Item: Ointment [b79b]fc.byte $fc; [96]: Effect: Spring of Trunk [b79c]fc.byte $fc; [97]: Effect: Spring of Sky [b79d]fc.byte $fc; [98]: Effect: Spring of Tower [b79e]fc.byte $fc; [99]: Effect: Boss Death [b79f]fc.byte $fc; [100]: <unused>
;============================================================================ ; Magic damage. ; ; XREFS: ; Player_HitEnemyWithMagic ;============================================================================
; ; XREFS: ; Player_HitEnemyWithMagic ;
[b7a0]MAGIC_DAMAGE: [b7a0]06.byte $06; [0]: Deluge -- 6HP [b7a1]09.byte $09; [1]: Thunder -- 9HP [b7a2]18.byte $18; [2]: Fire -- 12HP [b7a3]22.byte $22; [3]: Death -- 34HP [b7a4]26.byte $26; [4]: Tilte -- 38HP
;============================================================================ ; Weapon damage. ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
; ; XREFS: ; Player_HitSpriteWithWeapon ;
[b7a5]WEAPON_STRENGTHS: [b7a5]04.byte $04; [0]: Hand Dagger -- 4HP [b7a6]08.byte $08; [1]: Long Sword -- 8HP [b7a7]0c.byte $0c; [2]: Giant Blade -- 12HP [b7a8]10.byte $10; [3]: Dragon Slayer -- 16HP
;============================================================================ ; MP costs for magic spells. ; ; XREFS: ; Player_ReduceMP ;============================================================================
; ; XREFS: ; Player_ReduceMP ;
[b7a9]MAGIC_COSTS: [b7a9]02.byte $02; [0]: Deluge [b7aa]04.byte $04; [1]: Thunder [b7ab]06.byte $06; [2]: Fire [b7ac]0a.byte $0a; [3]: Death [b7ad]10.byte $10; [4]: Tilte
;============================================================================ ; Initialize the player's inventory state. ; ; This will clear all selected/current items and empty all ; the inventories. ; ; INPUTS: ; None. ; ; OUTPUTS: ; NumberOfArmors: ; NumberOfItems: ; NumberOfMagicSpells: ; NumberOfShields: ; NumberOfWeapons: ; SelectedArmor: ; SelectedItem: ; SelectedMagic: ; SelectedShield: ; SelectedWeapon: ; Player_CurWeapon: ; Cleared. ; ; XREFS: ; Game_InitStateForStartScreen ;============================================================================
[b7ae]Player_InitInventoryState: [b7ae]a9 00LDA #$00 [b7b0]8d c2 03STA a:NumberOfWeapons; Set the number of weapons to 0. [b7b3]8d c4 03STA a:NumberOfShields; Set the number of shields to 0. [b7b6]8d c5 03STA a:NumberOfMagicSpells; Set the number of magic spells to 0. [b7b9]8d c6 03STA a:NumberOfItems; Set the number of items to 0. [b7bc]8d c3 03STA a:NumberOfArmors; Set the number of armors to 0.
; ; v-- Fall through --v ;
;============================================================================ ; Resets the player's current/selected inventory items. ; ; INPUTS: ; None. ; ; OUTPUTS: ; SelectedArmor: ; SelectedItem: ; SelectedMagic: ; SelectedShield: ; SelectedWeapon: ; Player_CurWeapon: ; Cleared. ; ; XREFS: ; Player_HandleDeath ;============================================================================
[b7bf]PlayerDeath_ResetSelectedItemState: [b7bf]a9 00LDA #$00 [b7c1]8d be 03STA a:SelectedArmor; Set armor to Leather. [b7c4]a9 ffLDA #$ff [b7c6]8d bd 03STA a:SelectedWeapon; Set weapon to None. [b7c9]8d c8 03STA a:Player_CurWeapon; Set current weapon to None. [b7cc]8d bf 03STA a:SelectedShield; Set shield to None. [b7cf]8d c0 03STA a:SelectedMagic; Set magic to None. [b7d2]8d c1 03STA a:SelectedItem; Set item to None.
; ; XREFS: ; Player_DrawWeapon ;
[b7d5]RETURN_B7D5: [b7d5]60RTS
;============================================================================ ; TODO: Document Player_DrawWeapon ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; EndGame_MainLoop ; Game_DrawScreenInFrozenState ; Game_MainLoop ;============================================================================
[b7d6]Player_DrawWeapon: [b7d6]ad c7 03LDA a:IScript_PortraitID [b7d9]10 faBPL RETURN_B7D5 [b7db]ad c8 03LDA a:Player_CurWeapon [b7de]30 f5BMI RETURN_B7D5 [b7e0]a5 a7LDA Player_ArmorLookupIndex [b7e2]29 01AND #$01 [b7e4]85 00STA Temp_00 [b7e6]20 4b baJSR Player_GetNormalizedWeaponID [b7e9]0aASL A [b7ea]05 00ORA Temp_00 [b7ec]0aASL A [b7ed]aaTAX [b7ee]bd 9f b8LDA a:PTR_ARRAY_PRG14__b89f,X [b7f1]85 02STA Temp_Addr_L [b7f3]bd a0 b8LDA a:PTR_ARRAY_PRG14__b89f+1,X [b7f6]85 03STA Temp_Addr_U [b7f8]20 27 b9JSR Maybe_Player_CalcAnimFrame [b7fb]85 00STA Temp_00 [b7fd]0aASL A [b7fe]a8TAY [b7ff]a5 a4LDA Player_Flags [b801]29 40AND #$40 [b803]f0 01BEQ @LAB_PRG14__b806 [b805]c8INY [b806]@LAB_PRG14__b806: [b806]b1 02LDA (Temp_Addr_L),Y [b808]20 80 b8JSR Player_CalcValueAndFFForNeg [b80b]a5 9eLDA Player_PosX_Block [b80d]18CLC [b80e]65 04ADC Temp_04 [b810]85 ceSTA PlayerPosXPlus10 [b812]a5 9fLDA Screen_Maybe_ScrollXCounter [b814]65 05ADC Temp_05 [b816]85 cfSTA Maybe_Something_WeaponPosX [b818]c5 9fCMP Screen_Maybe_ScrollXCounter [b81a]d0 b9BNE RETURN_B7D5 [b81c]ad c8 03LDA a:Player_CurWeapon [b81f]0aASL A [b820]aaTAX [b821]bd 0f b9LDA a:PTR_ARRAY_PRG14__b90f,X [b824]85 02STA Temp_Addr_L [b826]bd 10 b9LDA a:PTR_ARRAY_PRG14__b90f+1,X [b829]85 03STA Temp_Addr_U [b82b]a4 00LDY Temp_00 [b82d]a5 a1LDA Player_PosY [b82f]18CLC [b830]71 02ADC (Temp_Addr_L),Y [b832]85 d0STA Maybe_Something_WeaponPosY [b834]a5 a2LDA Player_Something_ScrollPosY [b836]69 00ADC #$00 [b838]85 d1STA DrawWeapon_Unused_00D1 [b83a]ad c8 03LDA a:Player_CurWeapon [b83d]0aASL A [b83e]aaTAX [b83f]bd 97 b8LDA a:MAYBE_WEAPON_RANGES,X [b842]85 d2STA Maybe_WeaponRange_X [b844]bd 98 b8LDA a:MAYBE_WEAPON_RANGES+1,X [b847]85 d3STA Maybe_WeaponRange_Y [b849]a5 cfLDA Maybe_Something_WeaponPosX [b84b]c5 9fCMP Screen_Maybe_ScrollXCounter [b84d]f0 01BEQ @LAB_PRG14__b850 [b84f]60RTS [b850]@LAB_PRG14__b850: [b850]a5 a4LDA Player_Flags [b852]29 40AND #$40 [b854]85 29STA CurrentSprite_FlipMask [b856]a5 ceLDA PlayerPosXPlus10 [b858]85 27STA Arg_DrawSprite_PosX [b85a]a5 d0LDA Maybe_Something_WeaponPosY [b85c]85 28STA Arg_DrawSprite_PosY [b85e]a5 00LDA Temp_00 [b860]48PHA [b861]20 ed b9JSR Player_CalculateVisibility [b864]68PLA [b865]85 00STA Temp_00 [b867]ae c8 03LDX a:Player_CurWeapon [b86a]bd 7c b8LDA a:WEAPONS_SPRITE_U,X [b86d]85 33STA Sprites_PPUOffset [b86f]a5 00LDA Temp_00 [b871]18CLC [b872]7d 78 b8ADC a:WEAPONS_SPRITE_L,X [b875]4c 39 f0JMP Sprite_SetPlayerAppearanceAddr
;============================================================================ ; Sprite addresses for each weapon type. ; ; XREFS: ; Player_DrawWeapon ;============================================================================
; ; XREFS: ; Player_DrawWeapon ;
[b878]WEAPONS_SPRITE_L: [b878]40.byte $40; [0]: [b879]48.byte $48; [1]: [b87a]50.byte $50; [2]: [b87b]58.byte $58; [3]:
; ; XREFS: ; Player_DrawWeapon ;
[b87c]WEAPONS_SPRITE_U: [b87c]38.byte $38; [0]: [b87d]38.byte $38; [1]: [b87e]38.byte $38; [2]: [b87f]34.byte $34; [3]:
;============================================================================ ; TODO: Document Player_CalcValueAndFFForNeg ; ; INPUTS: ; A ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_DrawWeapon ; FUN_PRG15_MIRROR__ec58 ;============================================================================
[b880]Player_CalcValueAndFFForNeg: [b880]85 04STA Temp_04 [b882]a9 00LDA #$00 [b884]85 05STA Temp_05 [b886]a5 04LDA Temp_04 [b888]10 04BPL @_return [b88a]a9 ffLDA #$ff [b88c]85 05STA Temp_05 [b88e]@_return: [b88e]60RTS [b88f]18 10 18 18 18 18 20 00.byte $18,$10,$18,$18,$18,$18,$20,$00; undefined
; ; XREFS: ; Player_DrawWeapon ;
[b897]MAYBE_WEAPON_RANGES: [b897]08 04 10 08 10 08 10 08.word $0408,$0810,$0810,$0810; ushort
; ; XREFS: ; Player_DrawWeapon ;
[b89f]PTR_ARRAY_PRG14__b89f: [b89f]af b8pointer DAT_PRG14__b8af; [0]: Dagger [b8a1]bf b8pointer DAT_PRG14__b8bf; [1]: Dagger + shield [b8a3]cf b8pointer DAT_PRG14__b8cf; [2]: Long Sword [b8a5]df b8pointer DAT_PRG14__b8df; [3]: Long Sword + shield [b8a7]ef b8pointer DAT_PRG14__b8ef; [4]: Giant Blade [b8a9]ff b8pointer DAT_PRG14__b8ff; [5]: Giant Blade + shield [b8ab]ff b8pointer DAT_PRG14__b8ff; [6]: Dragon Slayer [b8ad]ff b8pointer DAT_PRG14__b8ff; [7]: Dragon Slayer + shield
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b89f] ;
[b8af]DAT_PRG14__b8af: [b8af]f8 10 fc 0c f8 10 f8 10.byte $f8,$10,$fc,$0c,$f8,$10,$f8,$10; undefined [b8b7]f8 10 f8 0e f0 18 00 00.byte $f8,$10,$f8,$0e,$f0,$18,$00,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a1] ;
[b8bf]DAT_PRG14__b8bf: [b8bf]f8 10 f8 10 f8 10 f8 10.byte $f8,$10,$f8,$10,$f8,$10,$f8,$10; undefined [b8c7]f8 10 f8 10 f0 18 00 00.byte $f8,$10,$f8,$10,$f0,$18,$00,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a3] ;
[b8cf]DAT_PRG14__b8cf: [b8cf]f8 10 fc 0c f8 10 f8 10.byte $f8,$10,$fc,$0c,$f8,$10,$f8,$10; undefined [b8d7]f8 10 f0 10 e8 18 00 00.byte $f8,$10,$f0,$10,$e8,$18,$00,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a5] ;
[b8df]DAT_PRG14__b8df: [b8df]f8 10 f8 10 f8 10 f8 10.byte $f8,$10,$f8,$10,$f8,$10,$f8,$10; undefined [b8e7]f8 10 f0 10 e8 18 00 00.byte $f8,$10,$f0,$10,$e8,$18,$00,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a7] ;
[b8ef]DAT_PRG14__b8ef: [b8ef]f0 10 fc 0c f8 10 f0 10.byte $f0,$10,$fc,$0c,$f8,$10,$f0,$10; undefined [b8f7]f8 10 f0 10 e8 18 00 00.byte $f8,$10,$f0,$10,$e8,$18,$00,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a9] ; PTR_ARRAY_PRG14__b89f [$PRG14::b8ab] ; PTR_ARRAY_PRG14__b89f [$PRG14::b8ad] ;
[b8ff]DAT_PRG14__b8ff: [b8ff]f0 10 f8 10 f8 10 f0 10.byte $f0,$10,$f8,$10,$f8,$10,$f0,$10; undefined [b907]f8 10 f0 10 e8 18 00 00.byte $f8,$10,$f0,$10,$e8,$18,$00,$00; undefined
; ; XREFS: ; Player_DrawWeapon ;
[b90f]PTR_ARRAY_PRG14__b90f: [b90f]17 b9pointer DAT_PRG14__b917; [0]: Hand dagger [b911]1f b9pointer DAT_PRG14__b91f; [1]: Long sword [b913]1f b9pointer DAT_PRG14__b91f; [2]: Giant blade [b915]1f b9pointer DAT_PRG14__b91f; [3]: Dragon slayer
; ; XREFS: ; PTR_ARRAY_PRG14__b90f [$PRG14::b90f] ;
[b917]DAT_PRG14__b917: [b917]08 08 08 08 08 08 06 00.byte $08,$08,$08,$08,$08,$08,$06,$00; undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b90f [$PRG14::b911] ; PTR_ARRAY_PRG14__b90f [$PRG14::b913] ; PTR_ARRAY_PRG14__b90f [$PRG14::b915] ;
[b91f]DAT_PRG14__b91f: [b91f]00 08 08 00 08 08 06 00.byte $00,$08,$08,$00,$08,$08,$06,$00; undefined
;============================================================================ ; TODO: Document Maybe_Player_CalcAnimFrame ; ; INPUTS: ; None. ; ; OUTPUTS: ; A ; ; XREFS: ; Player_CheckShieldHitByMagic ; Player_DrawShield ; Player_DrawWeapon ;============================================================================
[b927]Maybe_Player_CalcAnimFrame: [b927]a5 a4LDA Player_Flags [b929]4aLSR A [b92a]90 07BCC @LAB_PRG14__b933 [b92c]a5 a4LDA Player_Flags [b92e]30 28BMI @LAB_PRG14__b958 [b930]a9 03LDA #$03 [b932]60RTS [b933]@LAB_PRG14__b933: [b933]29 04AND #$04 [b935]f0 1dBEQ @LAB_PRG14__b954 [b937]a5 9eLDA Player_PosX_Block [b939]29 0fAND #$0f [b93b]f0 06BEQ @LAB_PRG14__b943 [b93d]a5 a4LDA Player_Flags [b93f]29 04AND #$04 [b941]d0 11BNE @LAB_PRG14__b954 [b943]@LAB_PRG14__b943: [b943]a5 a4LDA Player_Flags [b945]29 10AND #$10 [b947]f0 0bBEQ @LAB_PRG14__b954 [b949]a5 a3LDA Player_MovementTick [b94b]29 10AND #$10 [b94d]0aASL A [b94e]0aASL A [b94f]85 29STA CurrentSprite_FlipMask [b951]a9 07LDA #$07 [b953]60RTS [b954]@LAB_PRG14__b954: [b954]a5 a4LDA Player_Flags [b956]10 06BPL @LAB_PRG14__b95e [b958]@LAB_PRG14__b958: [b958]a6 aeLDX Player_AttackPhaseAnimFrame [b95a]bd 7b b9LDA a:BYTE_ARRAY_PRG14__b97b,X [b95d]60RTS [b95e]@LAB_PRG14__b95e: [b95e]a5 a5LDA Player_StatusFlag [b960]10 07BPL @LAB_PRG14__b969 [b962]a5 16LDA Joy1_ButtonMask [b964]10 03BPL @LAB_PRG14__b969 [b966]a9 03LDA #$03 [b968]60RTS [b969]@LAB_PRG14__b969: [b969]a5 a4LDA Player_Flags [b96b]29 20AND #$20 [b96d]f0 07BEQ @LAB_PRG14__b976 [b96f]a5 a3LDA Player_MovementTick [b971]4aLSR A [b972]4aLSR A [b973]4aLSR A [b974]29 03AND #$03 [b976]@LAB_PRG14__b976: [b976]aaTAX [b977]bd 7e b9LDA a:BYTE_ARRAY_PRG14__b97e,X [b97a]60RTS
; ; XREFS: ; Maybe_Player_CalcAnimFrame ;
[b97b]BYTE_ARRAY_PRG14__b97b: [b97b]04.byte $04; [0]: [b97c]05.byte $05; [1]: [b97d]06.byte $06; [2]:
; ; XREFS: ; Maybe_Player_CalcAnimFrame ;
[b97e]BYTE_ARRAY_PRG14__b97e: [b97e]00.byte $00; [0]: [b97f]01.byte $01; [1]: [b980]02.byte $02; [2]: [b981]01.byte $01; [3]:
;============================================================================ ; TODO: Document Player_DrawShield ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; EndGame_MainLoop ; Game_DrawScreenInFrozenState ; Game_MainLoop ;============================================================================
[b982]Player_DrawShield: [b982]ad c7 03LDA a:IScript_PortraitID [b985]10 4dBPL @_return [b987]ad bf 03LDA a:SelectedShield [b98a]30 48BMI @_return [b98c]c9 03CMP #$03 [b98e]f0 44BEQ @_return [b990]20 27 b9JSR Maybe_Player_CalcAnimFrame [b993]85 00STA Temp_00 [b995]0aASL A [b996]a8TAY [b997]a5 a4LDA Player_Flags [b999]29 40AND #$40 [b99b]f0 01BEQ @LAB_PRG14__b99e [b99d]c8INY [b99e]@LAB_PRG14__b99e: [b99e]a5 9eLDA Player_PosX_Block [b9a0]18CLC [b9a1]79 dd b9ADC a:SHIELD_SPRITE_OFFSETS_X,Y [b9a4]8d 9b 03STA a:Player_ShieldPositionX [b9a7]a5 a1LDA Player_PosY [b9a9]18CLC [b9aa]69 08ADC #$08 [b9ac]8d 9c 03STA a:Player_ShieldPositionY [b9af]a5 a4LDA Player_Flags [b9b1]29 40AND #$40 [b9b3]85 29STA CurrentSprite_FlipMask [b9b5]a9 30LDA #$30 [b9b7]85 33STA Sprites_PPUOffset [b9b9]ad 9b 03LDA a:Player_ShieldPositionX [b9bc]85 27STA Arg_DrawSprite_PosX [b9be]ad 9c 03LDA a:Player_ShieldPositionY [b9c1]85 28STA Arg_DrawSprite_PosY [b9c3]a5 00LDA Temp_00 [b9c5]48PHA [b9c6]20 ed b9JSR Player_CalculateVisibility [b9c9]68PLA [b9ca]85 00STA Temp_00 [b9cc]a4 00LDY Temp_00 [b9ce]b9 d5 b9LDA a:MAYBE_SHIELD_SPRITE_PPU_OFFSETS,Y [b9d1]4c 39 f0JMP Sprite_SetPlayerAppearanceAddr [b9d4]@_return: [b9d4]60RTS
; ; XREFS: ; Player_DrawShield ;
[b9d5]MAYBE_SHIELD_SPRITE_PPU_OFFSETS: [b9d5]60.byte $60; [0]: [b9d6]60.byte $60; [1]: [b9d7]60.byte $60; [2]: [b9d8]60.byte $60; [3]: [b9d9]61.byte $61; [4]: [b9da]60.byte $60; [5]: [b9db]62.byte $62; [6]: [b9dc]42.byte $42; [7]:
; ; XREFS: ; Player_DrawShield ;
[b9dd]SHIELD_SPRITE_OFFSETS_X: [b9dd]00.byte $00; [0]: [b9de]08.byte $08; [1]: [b9df]00.byte $00; [2]: [b9e0]08.byte $08; [3]: [b9e1]00.byte $00; [4]: [b9e2]08.byte $08; [5]: [b9e3]00.byte $00; [6]: [b9e4]08.byte $08; [7]: [b9e5]00.byte $00; [8]: [b9e6]08.byte $08; [9]: [b9e7]00.byte $00; [10]: [b9e8]08.byte $08; [11]: [b9e9]08.byte $08; [12]: [b9ea]00.byte $00; [13]: [b9eb]00.byte $00; [14]: [b9ec]00.byte $00; [15]:
;============================================================================ ; TODO: Document Player_CalculateVisibility ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_DrawShield ; Player_DrawWeapon ; FUN_PRG15_MIRROR__ec58 ; Player_DrawBody ;============================================================================
[b9ed]Player_CalculateVisibility: [b9ed]a9 00LDA #$00 [b9ef]85 b8STA Temp_MovingSpriteVisibility [b9f1]a5 28LDA Arg_DrawSprite_PosY [b9f3]85 b6STA Arg_PixelPosY [b9f5]a5 27LDA Arg_DrawSprite_PosX [b9f7]18CLC [b9f8]69 04ADC #$04 [b9fa]85 b5STA Arg_PixelPosX [b9fc]20 6c e8JSR Area_ConvertPixelsToBlockPos [b9ff]20 c3 e8JSR ScreenBuffer_LoadBlockProperty [ba02]c9 04CMP #$04 [ba04]f0 08BEQ @LAB_PRG14__ba0e [ba06]c9 0dCMP #$0d [ba08]f0 04BEQ @LAB_PRG14__ba0e [ba0a]c9 09CMP #$09 [ba0c]d0 06BNE @LAB_PRG14__ba14 [ba0e]@LAB_PRG14__ba0e: [ba0e]a5 b8LDA Temp_MovingSpriteVisibility [ba10]09 01ORA #$01 [ba12]85 b8STA Temp_MovingSpriteVisibility [ba14]@LAB_PRG14__ba14: [ba14]a5 27LDA Arg_DrawSprite_PosX [ba16]18CLC [ba17]69 0cADC #$0c [ba19]85 b5STA Arg_PixelPosX [ba1b]20 6c e8JSR Area_ConvertPixelsToBlockPos [ba1e]20 c3 e8JSR ScreenBuffer_LoadBlockProperty [ba21]c9 04CMP #$04 [ba23]f0 08BEQ @LAB_PRG14__ba2d [ba25]c9 0dCMP #$0d [ba27]f0 04BEQ @LAB_PRG14__ba2d [ba29]c9 09CMP #$09 [ba2b]d0 06BNE @LAB_PRG14__ba33 [ba2d]@LAB_PRG14__ba2d: [ba2d]a5 b8LDA Temp_MovingSpriteVisibility [ba2f]09 02ORA #$02 [ba31]85 b8STA Temp_MovingSpriteVisibility [ba33]@LAB_PRG14__ba33: [ba33]a5 a4LDA Player_Flags [ba35]29 40AND #$40 [ba37]f0 0dBEQ @LAB_PRG14__ba46 [ba39]a5 b8LDA Temp_MovingSpriteVisibility [ba3b]f0 0bBEQ SUB_PRG14__ba48 [ba3d]c9 03CMP #$03 [ba3f]f0 07BEQ SUB_PRG14__ba48 [ba41]49 03EOR #$03 [ba43]4c 48 baJMP SUB_PRG14__ba48 [ba46]@LAB_PRG14__ba46: [ba46]a5 b8LDA Temp_MovingSpriteVisibility
; ; XREFS: ; Player_CalculateVisibility ;
[ba48]SUB_PRG14__ba48: [ba48]85 26STA MovingSpriteVisibility [ba4a]60RTS
;============================================================================ ; Return the player's current weapon. ; ; If the weapon is unset, it will be normalized to a ; hand dagger. ; ; INPUTS: ; Player_CurWeapon: ; The current weapon. ; ; OUTPUTS: ; A: ; The normalized weapon. ; ; XREFS: ; Player_DrawWeapon ;============================================================================
[ba4b]Player_GetNormalizedWeaponID: [ba4b]ad c8 03LDA a:Player_CurWeapon; Load the player's current weapon. [ba4e]c9 ffCMP #$ff; Is it unset? [ba50]d0 02BNE @_return; If not, return. [ba52]a9 00LDA #$00; Else, return the Hand Dagger. [ba54]@_return: [ba54]60RTS
;============================================================================ ; Clear the visible magic on the screen. ; ; INPUTS: ; None. ; ; OUTPUTS: ; CastMagic_Type: ; The magic, unset. ; ; XREFS: ; Game_InitStateForSpawn ;============================================================================
[ba55]Player_ClearVisibleMagic: [ba55]a9 ffLDA #$ff [ba57]8d b3 02STA a:CastMagic_Type; Unset the cast magic type. [ba5a]60RTS
;============================================================================ ; Draw the magic effect on the screen. ; ; INPUTS: ; CastMagic_Type: ; Any current visible magic on the screen. ; ; Joy1_ButtonMask: ; The current button mask. ; ; Joy1_ChangedButtonMask: ; The newly-pressed buttons. ; ; SelectedMagic: ; The selected magic spell. ; ; Player_PosX_Block: ; The player's X position. ; ; Player_PosY: ; The player's Y position. ; ; Player_Flags: ; The player's current flags. ; ; CAST_MAGIC_START_X: ; The X offsets for each magic type. ; ; CAST_MAGIC_START_Y: ; The Y offsets for each magic type. ; ; OUTPUTS: ; CastMagic_Type: ; The newly-cast magic spell. ; ; CastMagic_XPos_Full: ; CastMagic_XPos_Frac: ; The starting X position of the new magic. ; ; CastMagic_YPos_Full: ; CastMagic_YPos_Frac: ; The starting Y position of the new magic. ; ; CastMagic_Phase: ; The magic spell's current phase. This is ; dependent on the magic spell. ; ; CastMagic_Counter: ; The cast magic's counter. ; ; This is 0 for Tilte and 33 for all others. ; ; CastMagic_Flags: ; The flags for the magic spell. ; ; This will match the facing direction of the ; player. For Tilte, it will also start falling. ; ; CALLS: ; Player_IsClimbing ; Player_ReduceMP ; Sound_PlayEffect ; @_placeMagic ; CastMagic_RunSpellHandler ; ; XREFS: ; EndGame_MainLoop ; Game_MainLoop ;============================================================================
[ba5b]Player_CastMagic:
; ; Check if there's any visible magic on the screen. ; ; If so, run its handler and return. ;
[ba5b]ad b3 02LDA a:CastMagic_Type; Load the visible magic. [ba5e]10 79BPL CastMagic_RunSpellHandler; If unset, jump to the next function in the spell cast logic.
; ; Check if the player is climbing a ladder. ;
[ba60]20 f6 ecJSR Player_IsClimbing; Check if the player can cast magic. [ba63]b0 73BCS @_return2; If not, we're done.
; ; Check if the player has pressed Up-B to cast magic. ;
[ba65]a5 16LDA Joy1_ButtonMask; Load the current button mask. [ba67]29 08AND #$08; Has Up been pressed? [ba69]f0 0dBEQ @_return1; If not, return. [ba6b]a5 19LDA Joy1_ChangedButtonMask; Load the newly-changed button mask. [ba6d]29 40AND #$40; Has B been pressed? [ba6f]f0 07BEQ @_return1; If not, return.
; ; Load the currently-selected magic spell. ; ; Only the primary spells (not extra stages of the spells) ; are supported. ;
[ba71]ad c0 03LDA a:SelectedMagic; Load the magic spell. [ba74]c9 05CMP #$05; Compare against 5 (Tilte -- last spell). [ba76]90 01BCC @LAB_PRG14__ba79; If a valid spell, then jump. [ba78]@_return1: [ba78]60RTS; We're done.
; ; If the player has enough MP for the spell, reduce the MP ; for the spell cost. ;
[ba79]@LAB_PRG14__ba79: [ba79]20 c3 c0JSR Player_ReduceMP; Reduce the MP. [ba7c]b0 faBCS @_return1; If there's not enough, we're done.
; ; Load the magic spell again. ;
[ba7e]ad c0 03LDA a:SelectedMagic; Load the magic spell. [ba81]c9 04CMP #$04; Compare it to 4 (Fire). [ba83]f0 08BEQ @_playTilteSound
; ; This is any magic spell other than Tilte, which ; has its own sound. ;
[ba85]a9 05LDA #$05 [ba87]20 e4 d0JSR Sound_PlayEffect; Play the standard magic sound effect. [ba8a]4c 92 baJMP @_placeMagic
; ; This is Tilte magic. Play its sound effect. ;
[ba8d]@_playTilteSound: [ba8d]a9 14LDA #$14 [ba8f]20 e4 d0JSR Sound_PlayEffect; Play the Tilte magic sound effect.
; ; Begin placing the magic spell on the screen. ;
[ba92]@_placeMagic: [ba92]ad c0 03LDA a:SelectedMagic; Load the magic spell. [ba95]8d b3 02STA a:CastMagic_Type; Set it as the visible magic.
; ; Calculate the direction the player is facing in order ; to know which direction to send the spell. ;
[ba98]a5 a4LDA Player_Flags; Load the player's flags. [ba9a]29 40AND #$40; Pull out the Facing Right bit. [ba9c]8d b4 02STA a:CastMagic_Flags; Store as the direction.
; ; Set the initial X position of the magic. ;
[ba9f]ac b3 02LDY a:CastMagic_Type; Y = visible magic [baa2]a5 9eLDA Player_PosX_Block; A = player X position [baa4]79 f2 baADC a:CAST_MAGIC_START_X,Y; Load the relative starting X position for the spell. [baa7]8d b6 02STA a:CastMagic_XPos_Full; Set it as the full X start position. [baaa]a5 a1LDA Player_PosY; A = player Y position [baac]18CLC
; ; Set the initial Y position of the magic. ;
[baad]79 ed baADC a:CAST_MAGIC_START_Y,Y; Load the relative starting Y position for the spell. [bab0]8d b8 02STA a:CastMagic_YPos_Full; Set it as the full Y start position.
; ; Clear the rest of the default state. ;
[bab3]a9 00LDA #$00 [bab5]8d b5 02STA a:CastMagic_XPos_Frac; Fractional X = 0 [bab8]8d b7 02STA a:CastMagic_YPos_Frac; Fraction Y = 0 [babb]8d b9 02STA a:CastMagic_Counter; Counter = 0 [babe]8d ba 02STA a:CastMagic_Phase; Phase = 0
; ; Tilte behaves differently, so check which spell's being cast. ;
[bac1]ad b3 02LDA a:CastMagic_Type; Load the magic spell. [bac4]c9 04CMP #$04; Compare against Tilte. [bac6]d0 11BNE CastMagic_RunSpellHandler; If Tilte, jump to the next function in the spell cast logic.
; ; This is Tilte. Set the flags as initially falling for the ; downward arc. ;
[bac8]ad b4 02LDA a:CastMagic_Flags; Load the magic's flags. [bacb]09 80ORA #$80; Set the Falling bit. [bacd]8d b4 02STA a:CastMagic_Flags; Store it back out.
; ; Set the magic counter to a default of 33. ;
[bad0]a9 21LDA #$21; A = 0x21 [bad2]8d b9 02STA a:CastMagic_Counter; Store as the magic's counter. [bad5]4c d9 baJMP CastMagic_RunSpellHandler; Jump to the next function in the spell cast logic. [bad8]@_return2: [bad8]60RTS
;============================================================================ ; Run the handler for spawning or updating the current spell. ; ; This will fetch the address of the method used to handle ; a spell and put it on the stack, running it once this ; function has finished. ; ; NOTES: ; This is pushing two addresses onto the stack for A: ; ; 1. CastMagic_RunUpdateSpellHandler as the ; finish ; handler. ; ; 2. The address of the handler. ; ; INPUTS: ; VisiblePlayerMagic: ; The magic spell currently set. ; ; OUTPUTS: ; A: ; The address of the handler. ; ; XREFS: ; Player_CastMagic ;============================================================================
[bad9]CastMagic_RunSpellHandler:
; ; Push PRG15_MIRROR:C2E9 to the stack as the result ; after our magic function. ;
[bad9]a9 c2LDA #$c2 [badb]48PHA [badc]a9 e8LDA #$e8 [bade]48PHA
; ; Load the current spell into A and shift left 1 for lookup. ; ; Transfer that to Y as the index into the lookup table for ; the address. ;
[badf]ad b3 02LDA a:CastMagic_Type; A = Current spell [bae2]0aASL A; Multiply by 2. [bae3]a8TAY; Y = A [bae4]b9 f8 baLDA a:CAST_MAGIC_UPDATE_HANDLERS+1,Y; Load the upper nibble of the address [bae7]48PHA; Push onto A [bae8]b9 f7 baLDA a:CAST_MAGIC_UPDATE_HANDLERS,Y; Load the lower nibble of the address [baeb]48PHA; Push onto A
;============================================================================ ; TODO: Document CastMagic_Noop ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; CAST_MAGIC_UPDATE_FINISH_HANDLERS [$PRG14::bb39] ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb09] ;============================================================================
[baec]CastMagic_Noop: [baec]60RTS
; ; XREFS: ; Player_CastMagic ;
[baed]CAST_MAGIC_START_Y: [baed]08.byte $08; [0]: Deluge [baee]00.byte $00; [1]: Thunder [baef]00.byte $00; [2]: Fire [baf0]08.byte $08; [3]: Death [baf1]08.byte $08; [4]: Tilte
; ; XREFS: ; Player_CastMagic ;
[baf2]CAST_MAGIC_START_X: [baf2]00.byte $00; [0]: Deluge [baf3]00.byte $00; [1]: Thunder [baf4]00.byte $00; [2]: Fire [baf5]00.byte $00; [3]: Death [baf6]00.byte $00; [4]: Tilte
; ; XREFS: ; CastMagic_RunSpellHandler ;
[baf7]CAST_MAGIC_UPDATE_HANDLERS: [baf7]44 bbpointer CastMagic_UpdateDeluge-1; [0]: Deluge [baf9]7d bbpointer CastMagic_UpdateThunderOrDeath-1; [1]: Thunder [bafb]9b bbpointer CastMagic_UpdateFire-1; [2]: Fire [bafd]e6 bbpointer CastMagic_HandleDeath-1; [3]: Death [baff]f2 bbpointer CastMagic_UpdateTilte-1; [4]: Tilte [bb01]65 bcpointer CastMagic_Unused_UpdateDelugeAfterFirstHit-1; [5]: Deluge after first hit [bb03]73 bcpointer CastMagic_UpdateThunderAfterFirstHit-1; [6]: Thunder after first hit [bb05]81 bcpointer CastMagic_UpdateFireAfterFirstHit-1; [7]: Fire after first hit [bb07]8f bcpointer CastMagic_UpdateDeathAfterFirstHit-1; [8]: Death after first hit [bb09]eb bapointer CastMagic_Noop-1; [9]: UNUSED: No-op [bb0b]98 bcpointer CastMagic_Unused_UpdateHitWallEffect-1; [10]: UNUSED: Hit Wall effect [bb0d]9e bcpointer CastMagic_UpdateTilteAfterFirstHit-1; [11]: Tilte magic after first hit
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[bb0f]CAST_MAGIC_HIT_HANDLERS: [bb0f]6a bbpointer CastMagic_HitHandler_Deluge-1; [0]: Deluge [bb11]90 bbpointer CastMagic_HitHandler_Thunder-1; [1]: Thunder [bb13]d8 bbpointer CastMagic_HitHandler_Fire-1; [2]: Fire [bb15]e9 bbpointer CastMagic_HitHandler_Death-1; [3]: Death [bb17]5a bcpointer CastMagic_HitHandler_Tilte-1; [4]: Tilte [bb19]71 8bpointer CastMagic_HitHandler_NoOp-1; [5]: Deluge after first hit [bb1b]71 8bpointer CastMagic_HitHandler_NoOp-1; [6]: Thunder after first hit [bb1d]71 8bpointer CastMagic_HitHandler_NoOp-1; [7]: Fire after first hit [bb1f]71 8bpointer CastMagic_HitHandler_NoOp-1; [8]: Death after first hit [bb21]71 8bpointer CastMagic_HitHandler_NoOp-1; [9]: UNUSED [bb23]71 8bpointer CastMagic_HitHandler_NoOp-1; [10]: UNUSED: Hit Wall effect [bb25]71 8bpointer CastMagic_HitHandler_NoOp-1; [11]: Tilte after first hit
;============================================================================ ; Handlers for finishing casting a magic spell. ; ; XREFS: ; CastMagic_RunUpdateSpellHandler ;============================================================================
; ; XREFS: ; CastMagic_RunUpdateSpellHandler ;
[bb27]CAST_MAGIC_UPDATE_FINISH_HANDLERS: [bb27]9a c3pointer CastMagic_FinishHandler_Deluge-1; [0]: Deluge [bb29]a6 c3pointer CastMagic_FinishHandler_Thunder-1; [1]: Thunder [bb2b]b5 c3pointer CastMagic_FinishHandler_Fire-1; [2]: Fire [bb2d]c8 c3pointer CastMagic_FinishHandler_Death-1; [3]: Death [bb2f]d5 c3pointer CastMagic_FinishHandler_Tilte-1; [4]: Tilte [bb31]fa c3pointer CastMagic_FinishHandler_DelugeOrDeathAfterHit-1; [5]: Deluge after first hit [bb33]a6 c3pointer CastMagic_FinishHandler_Thunder-1; [6]: Thunder after first hit [bb35]b5 c3pointer CastMagic_FinishHandler_Fire-1; [7]: Fire after first hit [bb37]fa c3pointer CastMagic_FinishHandler_DelugeOrDeathAfterHit-1; [8]: Death after first hit [bb39]eb bapointer CastMagic_Noop-1; [9]: UNUSED [bb3b]02 c4pointer CastMagic_FinishHandler_HitWallEffect-1; [10]: UNUSED: Hit Wall effect [bb3d]2b c4pointer CastMagic_FinishHandler_TilteAfterFirstHit-1; [11]: Tilte after first hit
;============================================================================ ; Clear the cast magic shown on the screen. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Type: ; The cast magic type to clear. ; ; XREFS: ; CastMagic_UpdateDeluge ; CastMagic_UpdateFire ; CastMagic_UpdateThunderOrDeath ; CastMagic_UpdateTilte ;============================================================================
[bb3f]CastMagic_Clear: [bb3f]a9 ffLDA #$ff [bb41]8d b3 02STA a:CastMagic_Type [bb44]60RTS
;============================================================================ ; Handle casting or updating the Deluge spell. ; ; This will update the position, clearing the spell if it's ; either off-screen or collided with a block on the way. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Unused_HitWallDeltaPosY: ; Set to 4 if the magic hit an obstacle. ; ; CastMagic_Type: ; Unset if clearing the magic. ; ; Arg_DeltaX_Frac: ; Arg_DeltaX_Full: ; Clobbered. ; ; CALLS: ; CastMagic_Clear ; CastMagic_UpdateXPosition ; Sound_PlayEffect ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::baf7] ; CastMagic_Unused_UpdateDelugeAfterFirstHit ;============================================================================
[bb45]CastMagic_UpdateDeluge:
; ; Update the position by X +/- 3 and check if the ; magic flew off-screen. ;
[bb45]a9 03LDA #$03 [bb47]8d 75 03STA a:Arg_DeltaX_Full; Set delta X block argument to 3. [bb4a]a9 00LDA #$00 [bb4c]8d 74 03STA a:Arg_DeltaX_Frac; Set delta X pixel argument to 0. [bb4f]20 af bcJSR CastMagic_UpdateXPosition; Update position. [bb52]90 03BCC @_checkCollision; If not off-screen, check for collision.
; ; It's off-screen. Clear the magic. ;
[bb54]4c 3f bbJMP CastMagic_Clear; Clear the magic.
; ; Check if the magic is on a block other than air. ;
[bb57]@_checkCollision: [bb57]a5 b7LDA Blocks_Result; Check which block the magic is on. [bb59]f0 0fBEQ @_return; If air, we're done.
; ; It hit a block. Play the sound effect. ;
[bb5b]a9 0aLDA #$0a [bb5d]20 e4 d0JSR Sound_PlayEffect; Play the Magic Hit Obstacle sound effect.
; ; Clear the magic spell. ; ; NOTE: ; Originally, it seems this was meant to set a ; Hit Wall effect instead. This can be re-enabled ; by changing CastMagic_Type to 10. ;
[bb60]a9 ffLDA #$ff [bb62]8d b3 02STA a:CastMagic_Type; Unset the cast magic spell. [bb65]a9 04LDA #$04 [bb67]8d bb 02STA a:CastMagic_Unused_HitWallDeltaPosY; Set the Hit Wall appearance offset. [bb6a]@_return: [bb6a]60RTS
;============================================================================ ; Handle the Deluge magic hitting something. ; ; This will set an animation counter, clear out the magic ; type, and update the X position based on the sprite's ; X position. ; ; INPUTS: ; CurrentSpriteIndex: ; The current sprite index of the entity that ; was hit. ; ; OUTPUTS: ; CastMagic_Counter: ; Set to 4. ; ; CastMagic_Type: ; Unset (0xFF). ; ; CastMagic_XPos_Full: ; The same position as the sprite that was hit. ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb0f] ;============================================================================
[bb6b]CastMagic_HitHandler_Deluge: [bb6b]a9 ffLDA #$ff [bb6d]8d b3 02STA a:CastMagic_Type; Unset the magic type. [bb70]a9 04LDA #$04 [bb72]8d b9 02STA a:CastMagic_Counter; Set the magic counter to 4.
; ; Update the X position of the cast magic to the sprite's ; x position. ;
[bb75]ae 78 03LDX a:CurrentSpriteIndex; X = current sprite index [bb78]b5 baLDA CurrentSprites_XPos_Full,X; A = current sprite X position. [bb7a]8d b6 02STA a:CastMagic_XPos_Full; Store as the X position. [bb7d]60RTS
;============================================================================ ; Handle casting or updating the Thunder or Death spell. ; ; This will update the position, clearing the spell if it's ; off-screen. These spells can go through blocks. ; ; INPUTS: ; None ; ; OUTPUTS: ; Arg_DeltaX_Frac: ; Arg_DeltaX_Full: ; Clobbered. ; ; CALLS: ; CastMagic_Clear ; CastMagic_UpdateXPosition ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::baf9] ; CastMagic_HandleDeath ; CastMagic_UpdateThunderAfterFirstHit ;============================================================================
[bb7e]CastMagic_UpdateThunderOrDeath:
; ; Update the position by X +/- 2 and check if the ; magic flew off-screen. ;
[bb7e]a9 02LDA #$02 [bb80]8d 75 03STA a:Arg_DeltaX_Full; Set the delta X position to check to 2. [bb83]a9 00LDA #$00 [bb85]8d 74 03STA a:Arg_DeltaX_Frac; Set the delta fractional X position to 0. [bb88]20 af bcJSR CastMagic_UpdateXPosition; Update the X position and check if it stayed on-screen. [bb8b]90 03BCC @_return; If still on-screen, jump.
; ; It's off-screen. Clear the magic. ;
[bb8d]4c 3f bbJMP CastMagic_Clear; Clear the magic. [bb90]@_return: [bb90]60RTS
;============================================================================ ; Handle the Thunder magic hitting something. ; ; This will reset the animation counter (as it will ; still go through the enemy) and set a Thunder Explosion ; effect. ; ; INPUTS: ; None. ; ; OUTPUTS: ; CastMagic_Counter: ; Set to 0x18. ; ; CastMagic_Type: ; Set to the Thunder Explosion state. ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb11] ;============================================================================
[bb91]CastMagic_HitHandler_Thunder: [bb91]a9 18LDA #$18 [bb93]8d b9 02STA a:CastMagic_Counter; Set the magic counter to 24. [bb96]a9 06LDA #$06 [bb98]8d b3 02STA a:CastMagic_Type; Set the magic type to the thunder explosion effect. [bb9b]60RTS
;============================================================================ ; Handle casting or updating the Fire spell. ; ; This will update the position, clearing the spell if it's ; either off-screen or collided with a block on the way. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Unused_HitWallDeltaPosY: ; Set to 0 if the magic hit an obstacle. ; ; CastMagic_Flags: ; Cleared attack flags. ; ; CastMagic_XPos_Full: ; The new X position. ; ; CastMagic_Type: ; Unset if clearing the magic. ; ; Arg_DeltaX_Frac: ; Arg_DeltaX_Full: ; Clobbered. ; ; CALLS: ; CastMagic_Clear ; CastMagic_UpdateXPosition ; Sound_PlayEffect ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bafb] ; CastMagic_UpdateFireAfterFirstHit ;============================================================================
[bb9c]CastMagic_UpdateFire:
; ; Update X +/- 4 and check if the magic flew off-screen. ;
[bb9c]a9 04LDA #$04 [bb9e]8d 75 03STA a:Arg_DeltaX_Full; Full Delta X = 4 [bba1]a9 00LDA #$00 [bba3]8d 74 03STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bba6]20 af bcJSR CastMagic_UpdateXPosition; Update the X position. [bba9]90 03BCC @_checkCollision; If not off-screen, check for collision.
; ; It's off-screen. Clear the magic. ;
[bbab]4c 3f bbJMP CastMagic_Clear; Clear the magic.
; ; Check if the magic is on a block other than air. ;
[bbae]@_checkCollision: [bbae]a5 b7LDA Blocks_Result; Check which block the magic is on. [bbb0]f0 26BEQ @_return; If air, we're done.
; ; It hit a block. Play the sound effect. ;
[bbb2]a9 0aLDA #$0a [bbb4]20 e4 d0JSR Sound_PlayEffect; Play the Magic Hit Obstacle sound effect.
; ; Clear the magic spell. ; ; NOTE: ; Originally, it seems this was meant to set a ; Hit Wall effect instead. This can be re-enabled ; by changing CastMagic_Type to 10. ;
[bbb7]a9 00LDA #$00 [bbb9]8d bb 02STA a:CastMagic_Unused_HitWallDeltaPosY; Set the Hit Wall appearance offset. [bbbc]a9 ffLDA #$ff [bbbe]8d b3 02STA a:CastMagic_Type; Unset the cast magic spell.
; ; Set the final X position. ; ; If facing right, this will add 16 to the position, letting ; it appear to go off-screen. ;
[bbc1]ad b4 02LDA a:CastMagic_Flags; Load the magic's flags. [bbc4]29 40AND #$40; Check the direction bit. [bbc6]4aLSR A; If set, divide by 8 (resulting in 16). [bbc7]4aLSR A [bbc8]6d b6 02ADC a:CastMagic_XPos_Full; Add to the current position. [bbcb]8d b6 02STA a:CastMagic_XPos_Full; And set it.
; ; Switch the direction of the spell. ;
[bbce]ad b4 02LDA a:CastMagic_Flags; Load the flags. [bbd1]29 7fAND #$7f; Clear the Attacking bit. [bbd3]49 40EOR #$40; Toggle the Facing Right bit. [bbd5]8d b4 02STA a:CastMagic_Flags; Store it. [bbd8]@_return: [bbd8]60RTS
;============================================================================ ; Handle the Fire magic hitting something. ; ; This will clear out the animation counter and then ; set the type to a Fire magic that will disappear ; after hitting 255 enemies (which won't happen). ; ; INPUTS: ; CurrentSpriteIndex: ; The current sprite index of the entity that ; was hit. ; ; OUTPUTS: ; CastMagic_Counter: ; Set to 0xFF. ; ; CastMagic_Type: ; Set to the next type of Fire spell. ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb13] ;============================================================================
[bbd9]CastMagic_HitHandler_Fire: [bbd9]a9 ffLDA #$ff [bbdb]8d b9 02STA a:CastMagic_Counter; Set the counter to 0xFF. [bbde]a9 07LDA #$07 [bbe0]8d b3 02STA a:CastMagic_Type; Set the magic type to the post-hit handler. [bbe3]ae 78 03LDX a:CurrentSpriteIndex; X = Current sprite index. [bbe6]60RTS
;============================================================================ ; Handle casting Thunder or Death magic. ; ; This is a thunking function that forwards to ; CastMagic_UpdateThunderOrDeath. ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bafd] ;============================================================================
[bbe7]CastMagic_HandleDeath: [bbe7]4c 7e bbJMP CastMagic_UpdateThunderOrDeath
;============================================================================ ; Handle the Death magic hitting something. ; ; This will unset the magic from the screen. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Type: ; Unset (0xFF). ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb15] ;============================================================================
[bbea]CastMagic_HitHandler_Death: [bbea]a9 ffLDA #$ff [bbec]8d b3 02STA a:CastMagic_Type; Set the magic type to 0xFF (unset). [bbef]60RTS
; ; XREFS: ; CastMagic_UpdateTilte ;
[bbf0]CastMagic_ClearTilte: [bbf0]4c 3f bbJMP CastMagic_Clear
;============================================================================ ; Handle casting or updating the Tilte spell. ; ; This spell has two phases: ; ; 1. A slow-moving curved phase ; 2. A fast-moving missile phase ; ; During phase 1, this will control the X/Y positions in a ; curved form. Depending on the tick count, it will move ; downward toward the bottom of the arc, horizontal at ; the bottom, back up, or begin a transition to phase 2. ; ; In phase 2, it will simply move in a single diagonal ; direction. ; ; The block won't collide with anything on the screen, ; and will move through enemies. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Unused_HitWallDeltaPosY: ; Set to 0 if the magic hit an obstacle. ; ; CastMagic_Flags: ; Cleared attack flags. ; ; CastMagic_XPos_Full: ; The new X position. ; ; CastMagic_Type: ; Unset if clearing the magic. ; ; Arg_DeltaX_Frac: ; Arg_DeltaX_Full: ; Clobbered. ; ; CALLS: ; CastMagic_Clear ; CastMagic_UpdateXPosition ; Sound_PlayEffect ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::baff] ;============================================================================
[bbf3]CastMagic_UpdateTilte:
; ; Update based on the phase of this magic. ;
[bbf3]ad ba 02LDA a:CastMagic_Phase; Check the phase. [bbf6]4aLSR A; Check bit 0 for even/odd. [bbf7]b0 47BCS @_curveMagicPhase; If odd, jump.
; ; We're in the initial, curved magic phase. It dips down and ; then back up. ; ; Update X +/- 1 and check if the magic flew off the screen. ; We'll calculate gravity-based Y movement next. ;
[bbf9]a9 01LDA #$01 [bbfb]8d 75 03STA a:Arg_DeltaX_Full; Full Delta X = 1 [bbfe]a9 00LDA #$00 [bc00]8d 74 03STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bc03]20 af bcJSR CastMagic_UpdateXPosition; Update position. [bc06]b0 e8BCS CastMagic_ClearTilte; If off-screen, jump to clear.
; ; Calculate the next movement behavior. ;
[bc08]ad b9 02LDA a:CastMagic_Counter; Load the magic tick counter. [bc0b]a0 03LDY #$03; Y = 3 [bc0d]20 e1 83JSR Sprites_CalcYFromGravity; Calculate the movement behavior (delta Y). [bc10]a0 03LDY #$03; Y = 3 (count) [bc12]20 d1 83JSR Sprites_CalcVerticalSpriteMovement; Calculate vertical movement. [bc15]a9 00LDA #$00 [bc17]8d 77 03STA a:Arg_DeltaY_Full; Full Delta Y = 0 [bc1a]20 fb bcJSR CastMagic_UpdateYPosition; Update the Y position. [bc1d]b0 d1BCS CastMagic_ClearTilte; If off-screen, jump to clear.
; ; It's on-screen. Manage cycle of the magic. ; ; First, check if we're on tick 32, 64, 96, or 128. ;
[bc1f]ad b9 02LDA a:CastMagic_Counter; A = counter. [bc22]29 1fAND #$1f; Check against anything but 32, 64, or 128. [bc24]d0 16BNE @_incAndReturn; If 32, 64, or 128, jump to finish up.
; ; We're on a non-32/64/128 phase, dictating curve movement ; and possibly phase transition. ; ; When 32 is hit, the magic will appear and move downward. ; ; When 64 is hit, it will begin moving horizontally at the ; bottom of the arc. ; ; When 96 is hit, it will begin moving upward toward the ; top of the arc. ; ; When 128 is hit, it will transition to the missile phase. ;
[bc26]ad b4 02LDA a:CastMagic_Flags; Load the magic flags. [bc29]49 80EOR #$80; Toggle the Falling phase. [bc2b]8d b4 02STA a:CastMagic_Flags; Store the updated flags. [bc2e]10 0cBPL @_incAndReturn; If attacking is clear, jump to finish up.
; ; Switch to the missile phase. ;
[bc30]ee ba 02INC a:CastMagic_Phase; Increment the phase.
; ; Clear the falling flag, moving back up. ;
[bc33]ad b4 02LDA a:CastMagic_Flags; Load the magic flags. [bc36]29 7fAND #$7f; Clear attacking. [bc38]8d b4 02STA a:CastMagic_Flags; Store it. [bc3b]60RTS [bc3c]@_incAndReturn: [bc3c]ee b9 02INC a:CastMagic_Counter; Increment the tick counter. [bc3f]60RTS
; ; The magic is in the fast-moving diagonal missile phase. ; ; We'll update X +/- 4 and Y + 4 for the movement, annd check ; if it's off-screen. ;
[bc40]@_curveMagicPhase: [bc40]a9 04LDA #$04 [bc42]8d 75 03STA a:Arg_DeltaX_Full; Full Delta X = 4 [bc45]8d 77 03STA a:Arg_DeltaY_Full; Full Delta Y = 4 [bc48]a9 00LDA #$00 [bc4a]8d 74 03STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bc4d]8d 76 03STA a:Arg_DeltaY_Frac; Fractional Delta Y = 0 [bc50]20 af bcJSR CastMagic_UpdateXPosition; Update the X position. [bc53]b0 9bBCS CastMagic_ClearTilte; If off-screen, jump to clear. [bc55]20 fb bcJSR CastMagic_UpdateYPosition; Update the Y position. [bc58]b0 96BCS CastMagic_ClearTilte; If off-screen, jump to clear. [bc5a]60RTS
;============================================================================ ; Handle Tilte magic hitting something. ; ; This will turn off the transition counter and ; set the type to be the Tilte explosion effect. ; ; INPUTS: ; None ; ; OUTPUTS: ; CastMagic_Counter: ; Reset to 0. ; ; CastMagic_Type: ; Set to the Tilte Explosion type. ; ; XREFS: ; CAST_MAGIC_HIT_HANDLERS [$PRG14::bb17] ;============================================================================
[bc5b]CastMagic_HitHandler_Tilte: [bc5b]a9 00LDA #$00 [bc5d]8d b9 02STA a:CastMagic_Counter; Set the counter to 0. [bc60]a9 0bLDA #$0b [bc62]8d b3 02STA a:CastMagic_Type; Set the type to the post-collision Tilte type. [bc65]60RTS
;============================================================================ ; UNUSED: Handle updating a Deluge spell that has collided at least once. ; ; This would update the Deluge spell as normal, and then ; decrement a tick counter. Once that counter hits 0, the ; spell will clear. ; ; However, this never actually gets run. Instead, the spell ; is cleared as soon as the first hit occurs. ; ; INPUTS: ; CastMagic_Counter: ; The counter indicating the max number of ticks ; before disappearing. ; ; OUTPUTS: ; CastMagic_Counter: ; The decremented counter value. ; ; CastMagic_Type: ; The cleared magic type, if the counter reaches 0. ; ; CALLS: ; CastMagic_UpdateDeluge ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb01] ;============================================================================
[bc66]CastMagic_Unused_UpdateDelugeAfterFirstHit: [bc66]20 45 bbJSR CastMagic_UpdateDeluge; Run standard Deluge behavior. [bc69]ce b9 02DEC a:CastMagic_Counter; Decrement the tick counter. [bc6c]d0 05BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc6e]a9 ffLDA #$ff [bc70]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bc73]@_return: [bc73]60RTS
;============================================================================ ; Handle updating a Thunder spell that has collided at least once. ; ; This will update the Thunder spell as normal, and then ; decrement a tick counter. Once that counter hits 0, the ; spell will clear. ; ; INPUTS: ; CastMagic_Counter: ; The counter indicating the max number of ticks ; before disappearing. ; ; OUTPUTS: ; CastMagic_Counter: ; The decremented counter value. ; ; CastMagic_Type: ; The cleared magic type, if the counter reaches 0. ; ; CALLS: ; CastMagic_UpdateThunderOrDeath ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb03] ;============================================================================
[bc74]CastMagic_UpdateThunderAfterFirstHit: [bc74]20 7e bbJSR CastMagic_UpdateThunderOrDeath; Run standard Thunder behavior. [bc77]ce b9 02DEC a:CastMagic_Counter; Decrement the tick counter. [bc7a]d0 05BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc7c]a9 ffLDA #$ff [bc7e]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bc81]@_return: [bc81]60RTS
;============================================================================ ; Handle updating a Fire spell that has collided at least once. ; ; This will update the Fire spell as normal, and then ; decrement a tick counter. Once that counter hits 0, the ; spell will clear. ; ; INPUTS: ; CastMagic_Counter: ; The counter indicating the max number of ticks ; before disappearing. ; ; OUTPUTS: ; CastMagic_Counter: ; The decremented counter value. ; ; CastMagic_Type: ; The cleared magic type, if the counter reaches 0. ; ; CALLS: ; CastMagic_UpdateFire ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb05] ;============================================================================
[bc82]CastMagic_UpdateFireAfterFirstHit: [bc82]20 9c bbJSR CastMagic_UpdateFire; Run standard Fire behavior. [bc85]ce b9 02DEC a:CastMagic_Counter; Decrement the tick counter. [bc88]d0 05BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc8a]a9 ffLDA #$ff [bc8c]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bc8f]@_return: [bc8f]60RTS
;============================================================================ ; Handle updating a Death spell that has collided at least once. ; ; This will immediately clear the current magic type. ; ; INPUTS: ; None. ; ; OUTPUTS: ; None. ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb07] ;============================================================================
[bc90]CastMagic_UpdateDeathAfterFirstHit: [bc90]a9 ffLDA #$ff [bc92]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bc95]60RTS
;============================================================================ ; UNUSED ;============================================================================
[bc96]4c 3f bbJMP CastMagic_Clear
;============================================================================ ; UNUSED: Handle updating magic type 10. ; ; This isn't a type used in the game. If called, this ; would clear the current magic type. ; ; INPUTS: ; None. ; ; OUTPUTS: ; CastMagic_Type: ; Unset. ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb0b] ;============================================================================
[bc99]CastMagic_Unused_UpdateHitWallEffect: [bc99]a9 ffLDA #$ff [bc9b]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bc9e]60RTS
;============================================================================ ; Handle updating a Tilte spell that has collided at least once. ; ; This will simply increment the tick counter. Once that is >= 16, ; the spell will clear. ; ; INPUTS: ; CastMagic_Counter: ; The counter indicating the max number of ticks ; before disappearing. ; ; OUTPUTS: ; CastMagic_Counter: ; The incremented counter value. ; ; CastMagic_Type: ; The cleared magic type, if the counter reaches 16 or ; higher. ; ; XREFS: ; CAST_MAGIC_UPDATE_HANDLERS [$PRG14::bb0d] ;============================================================================
[bc9f]CastMagic_UpdateTilteAfterFirstHit: [bc9f]ee b9 02INC a:CastMagic_Counter; Increment the tick counter. [bca2]ad b9 02LDA a:CastMagic_Counter; Load the counter value. [bca5]c9 10CMP #$10; Is it < 16? [bca7]90 05BCC @_return; If so, return.
; ; The magic spell has dissipated. Clear it. ;
[bca9]a9 ffLDA #$ff [bcab]8d b3 02STA a:CastMagic_Type; Clear the active magic spell. [bcae]@_return: [bcae]60RTS
;============================================================================ ; Update magic's position in the X direction. ; ; This will take the delta X values and update the position ; accordingly. ; ; If the resulting position is off-screen, the magic will ; be set to disperse. ; ; INPUTS: ; Arg_DeltaX_Full: ; The full delta Y value to add/subtract. ; ; Arg_DeltaX_Frac: ; The fractional delta Y value to add/subtract. ; ; CastMagic_XPos_Full: ; The current block Y position. ; ; CastMagic_XPos_Frac: ; The current fractional Y position. ; ; CastMagic_Flags: ; Flag for the magic. ; ; OUTPUTS: ; C: ; 0 = The magic is on-screen ; 1 = The magic if off-scren. ; ; CastMagic_XPos_Full: ; The updated block X position. ; ; CastMagic_XPos_Frac: ; The updated fractional X position. ; ; CALLS: ; CastMagic_CheckDirection ; ; XREFS: ; CastMagic_UpdateDeluge ; CastMagic_UpdateFire ; CastMagic_UpdateThunderOrDeath ; CastMagic_UpdateTilte ;============================================================================
[bcaf]CastMagic_UpdateXPosition: [bcaf]ad b4 02LDA a:CastMagic_Flags; Load the magic's flags. [bcb2]29 40AND #$40; Check the Facing Right bit. [bcb4]d0 1eBNE @_isRight; If it's set, jump.
; ; The magic is moving left. ; ; Update the fractional X value based on the provided delta. ;
[bcb6]ad b5 02LDA a:CastMagic_XPos_Frac; Load the fractional X position. [bcb9]38SEC [bcba]ed 74 03SBC a:Arg_DeltaX_Frac; Subtract the provided delta. [bcbd]8d b5 02STA a:CastMagic_XPos_Frac; Store it.
; ; Now update the full X position. ;
[bcc0]ad b6 02LDA a:CastMagic_XPos_Full; Load the full X position. [bcc3]ed 75 03SBC a:Arg_DeltaX_Full; Subtract the provided delta. [bcc6]8d b6 02STA a:CastMagic_XPos_Full; Store it.
; ; Check for collision/off-screen in the Left direction. ;
[bcc9]a2 00LDX #$00; 0 = Left [bccb]20 8f bdJSR CastMagic_CheckDirection; Check for collision/off-screen in the left direction. [bcce]ad b6 02LDA a:CastMagic_XPos_Full; Load the block X coordinate. [bcd1]c9 f0CMP #$f0; Set C=0 if on-screen, 1 if off-screen (wrapped around). [bcd3]60RTS
; ; The magic is moving right. ; ; Update the fractional X value based on the provided delta. ;
[bcd4]@_isRight: [bcd4]ad b5 02LDA a:CastMagic_XPos_Frac; Load the fractional X coordinate. [bcd7]18CLC [bcd8]6d 74 03ADC a:Arg_DeltaX_Frac; Add the provided delta. [bcdb]8d b5 02STA a:CastMagic_XPos_Frac; Store it.
; ; Now update the full X position. ;
[bcde]ad b6 02LDA a:CastMagic_XPos_Full; Load the full X coordinate. [bce1]6d 75 03ADC a:Arg_DeltaX_Full; Add the delta. [bce4]8d b6 02STA a:CastMagic_XPos_Full; Store it.
; ; Check for collision/off-screen in the Right direction. ;
[bce7]a2 01LDX #$01; X = Right [bce9]20 8f bdJSR CastMagic_CheckDirection; Check for collision/off-screen in the right direction. [bcec]ae b3 02LDX a:CastMagic_Type; X = Magic type. [bcef]ad b6 02LDA a:CastMagic_XPos_Full; A = Full X position. [bcf2]dd f6 bcCMP a:CAST_MAGIC_MAX_SCREEN_WIDTHS,X; Compare the X position to the off-screen X position, and set C as the result. [bcf5]60RTS
; ; XREFS: ; CastMagic_UpdateXPosition ;
[bcf6]CAST_MAGIC_MAX_SCREEN_WIDTHS: [bcf6]f0.byte $f0; [0]: [bcf7]f0.byte $f0; [1]: [bcf8]e0.byte $e0; [2]: [bcf9]f0.byte $f0; [3]: [bcfa]f0.byte $f0; [4]:
;============================================================================ ; Update magic's position in the Y direction. ; ; This will take the delta Y values and update the position ; accordingly. ; ; If the resulting position is off-screen or collides with ; something, the magic will be set to disperse. ; ; INPUTS: ; Arg_DeltaY_Full: ; The full delta Y value to add/subtract. ; ; Arg_DeltaY_Frac: ; The fractional delta Y value to add/subtract. ; ; CastMagic_YPos_Full: ; The current block Y position. ; ; CastMagic_YPos_Frac: ; The current fractional Y position. ; ; CastMagic_Flags: ; Flag for the magic. ; ; OUTPUTS: ; C: ; 0 = The magic is on-screen ; 1 = The magic if off-scren. ; ; CastMagic_YPos_Full: ; The updated block Y position. ; ; CastMagic_YPos_Frac: ; The updated fractional Y position. ; ; CALLS: ; CastMagic_CheckDirection ; ; XREFS: ; CastMagic_UpdateTilte ;============================================================================
[bcfb]CastMagic_UpdateYPosition: [bcfb]ad b4 02LDA a:CastMagic_Flags; Load the magic's flags. [bcfe]30 1eBMI @_isMovingDown; If it's moving up, jump.
; ; The magic is moving upward. ; ; Update the fractional Y value based on the provided delta. ;
[bd00]ad b7 02LDA a:CastMagic_YPos_Frac; Load the fractional Y coordinate. [bd03]38SEC [bd04]ed 76 03SBC a:Arg_DeltaY_Frac; Subtract the provided delta value. [bd07]8d b7 02STA a:CastMagic_YPos_Frac; Store as the new fractional Y coordinate.
; ; Now update the block Y value. ;
[bd0a]ad b8 02LDA a:CastMagic_YPos_Full; Load the block Y coordinate. [bd0d]ed 77 03SBC a:Arg_DeltaY_Full; Subtract the provided delta value. [bd10]8d b8 02STA a:CastMagic_YPos_Full; Store it.
; ; Check for collision/off-screen in the Up direction. ;
[bd13]a2 02LDX #$02; X = 2 (up) [bd15]20 8f bdJSR CastMagic_CheckDirection; Check for collision/off-screen in the up direction. [bd18]ad b8 02LDA a:CastMagic_YPos_Full; Load the block Y coordiante. [bd1b]c9 f0CMP #$f0; Set C=0 if on-screen, 1 if off-screen. [bd1d]60RTS
; ; The magic is moving downward. ; ; Update the fractional Y value based on the provided delta. ;
[bd1e]@_isMovingDown: [bd1e]ad b7 02LDA a:CastMagic_YPos_Frac; Load the fractional Y coordinate. [bd21]18CLC [bd22]6d 76 03ADC a:Arg_DeltaY_Frac; Add the provided delta value. [bd25]8d b7 02STA a:CastMagic_YPos_Frac; Store as the new fractional Y coordinate.
; ; Now update the block Y value. ;
[bd28]ad b8 02LDA a:CastMagic_YPos_Full; Load the block Y coordinate. [bd2b]6d 77 03ADC a:Arg_DeltaY_Full; Subtract the provided delta value. [bd2e]8d b8 02STA a:CastMagic_YPos_Full; Store it.
; ; Check for collision/off-screen in the Up direction. ;
[bd31]ad 76 03LDA a:Arg_DeltaY_Frac; Load the provided fractional Y delta. [bd34]08PHP; Push flags to the stack. [bd35]a2 03LDX #$03; X = 3 (down) [bd37]20 8f bdJSR CastMagic_CheckDirection; Check for collision/off-screen in the down direction. [bd3a]28PLP; Pop flags from the stack. [bd3b]60RTS
;============================================================================ ; Check if magic moving left should disperse. ; ; If the magic is off the screen, or hits something. ; magic will be set to disperse. ; ; INPUTS: ; CastMagic_XPos_Full: ; The block X position of the magic spell. ; ; OUTPUTS: ; Blocks_Result: ; 1 if magic should disperse. ; 0 if it can remain on screen. ; ; Arg_PixelPosX: ; Clobbered. ; ; CALLS: ; CastMagic_CheckDirection_CheckImpassable ; ; XREFS: ; CastMagic_CheckDirection ;============================================================================
[bd3c]CastMagic_CheckDirection_Left: [bd3c]ad b6 02LDA a:CastMagic_XPos_Full; A = Magic X position [bd3f]85 b5STA Arg_PixelPosX; Store as the pixel position to check. [bd41]c9 f0CMP #$f0; Is it on-screen? [bd43]90 13BCC CastMagic_CheckDirection_CheckImpassable; If so, jump to check in a Y direction. Else, fall through.
; ; v-- Fall through --v ;
;============================================================================ ; Set a result stating magic should disperse. ; ; This is used as a utility by magic position checking ; functions. ; ; INPUTS: ; None. ; ; OUTPUTS: ; Blocks_Result: ; Set to 1. ; ; XREFS: ; CastMagic_CheckDirection_Right ;============================================================================
[bd45]CastMagic_SetShouldDisperse: [bd45]a9 01LDA #$01; A = 1 (true) [bd47]85 b7STA Blocks_Result; Set as the result. [bd49]60RTS
;============================================================================ ; Check if magic moving right should disperse. ; ; If the magic is off the screen, or hits something. ; magic will be set to disperse. ; ; INPUTS: ; CastMagic_XPos_Full: ; The block X position of the magic spell. ; ; OUTPUTS: ; Blocks_Result: ; 1 if magic should disperse. ; 0 if it can remain on screen. ; ; Arg_PixelPosX: ; Clobbered. ; ; CALLS: ; CastMagic_CheckDirection_CheckImpassable ; ; XREFS: ; CastMagic_CheckDirection ;============================================================================
[bd4a]CastMagic_CheckDirection_Right: [bd4a]ac b3 02LDY a:CastMagic_Type; Y = Magic type [bd4d]ad b6 02LDA a:CastMagic_XPos_Full; A = Block X position. [bd50]18CLC [bd51]79 9d bdADC a:CAST_MAGIC_WIDTHS,Y; Add a width based on the magic type. [bd54]85 b5STA Arg_PixelPosX; Store as the X argument. [bd56]b0 edBCS CastMagic_SetShouldDisperse; If the value wraps off-screen, jump to set dispersed. Else, fall through.
; ; v-- Fall through --v ;
;============================================================================ ; Check if the magic spell has hit an impassable block. ; ; This is called after checking a magic in an X direction. ; It will check the blocks overlapping the magic's sprite ; (middle block, then lower block, then upper, as ; appropriate) and set state if the spell has hit something. ; ; INPUTS: ; Arg_PixelPosX: ; The previously-calculated pixel X position of the ; magic spell. ; ; CastMagic_YPos_Full: ; The magic's full Y position. ; ; OUTPUTS: ; Blocks_Result: ; 1 = The spell hit an impassable block. ; 0 = The spell did not. ; ; Arg_PixelPosY: ; Clobbered. ; ; CALLS: ; Area_ConvertPixelsToBlockPos ; ScreenBuffer_IsBlockImpassable ; ; XREFS: ; CastMagic_CheckDirection_Left ;============================================================================
[bd58]CastMagic_CheckDirection_CheckImpassable:
; ; First, check if the block at middle Y position (at the ; previously-calculated X) is passable. ;
[bd58]ad b8 02LDA a:CastMagic_YPos_Full; A = Magic full Y position [bd5b]85 b6STA Arg_PixelPosY; Store as the Y argument. [bd5d]20 6c e8JSR Area_ConvertPixelsToBlockPos; Convert the pixels to a screen block lookup position. [bd60]20 7c e8JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd63]85 b7STA Blocks_Result; Set the tentative result accordingly. [bd65]d0 27BNE @_return; If not passable, return the result.
; ; The block was passable. Check the block at the bottom ; of the magic's bounding box. ;
[bd67]ac b3 02LDY a:CastMagic_Type; Load the magic type. [bd6a]b9 a9 bdLDA a:CAST_MAGIC_HEIGHTS,Y; Load the magic's height. [bd6d]c9 10CMP #$10; Is the height >= 16 (more than one block)? [bd6f]90 0cBCC @_checkTop; If so, jump. [bd71]8aTXA; A = X (block position). [bd72]18CLC [bd73]69 10ADC #$10; Add 16 (next block). [bd75]aaTAX; X = A (result) [bd76]20 7c e8JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd79]85 b7STA Blocks_Result; Store the tentative result. [bd7b]d0 11BNE @_return; If not passable, return the result.
; ; The block was passable. Check the block at the top of ; the magic's bounding box. ;
[bd7d]@_checkTop: [bd7d]ad b8 02LDA a:CastMagic_YPos_Full; Load the full Y position again. [bd80]29 0fAND #$0f; Keep the lower nibble. [bd82]f0 0aBEQ @_return; If it's 0, return the existing result. [bd84]8aTXA; A = X (block position). [bd85]18CLC [bd86]69 10ADC #$10; Add 16 (next block). [bd88]aaTAX; X = A (result) [bd89]20 7c e8JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd8c]85 b7STA Blocks_Result; Store the result. [bd8e]@_return: [bd8e]60RTS
;============================================================================ ; Check for magic movement in a given direction. ; ; This will check if the magic spell is off-screen or has ; collided in a given direction. ; ; This really only checks left or right. While there is ; some (potentially left-over) logic for checking up or ; down, only left/right movement will trigger an off-screen ; or collide result. ; ; INPUTS: ; X: ; The direction to check: ; ; 0 = Left ; 1 = Right ; 2 = Up ; 3 = Down ; ; OUTPUTS: ; Blocks_Result: ; 0 = Magic can remain on-screen. ; 1 = Magic should disperse. ; ; CALLS: ; CastMagic_CheckDirection_Left ; CastMagic_CheckDirection_Right ; ; XREFS: ; CastMagic_UpdateXPosition ; CastMagic_UpdateYPosition ;============================================================================
[bd8f]CastMagic_CheckDirection:
; ; See if we're checking magic moving left. ;
[bd8f]8aTXA; A = X (direction) [bd90]f0 aaBEQ CastMagic_CheckDirection_Left; If moving left, jump to check.
; ; See if we're checking magic moving right. ;
[bd92]caDEX; X-- (shift the Right direction into Left for comparison). [bd93]f0 b5BEQ CastMagic_CheckDirection_Right; If moving right, jump to check.
; ; See if we're checking magic moving up. ; ; But really, up or down gives the same result. Looks like ; there was intended to be code here handling Up and Down ; differently. ;
[bd95]caDEX; X-- (shift Up into Left). [bd96]f0 00BEQ @_isUpOrDown; If up, jump to the very next instruction.
; ; The magic is moving up. Or down. ; ; It will never collide, so return a false result. ;
[bd98]@_isUpOrDown: [bd98]a9 00LDA #$00; A = 0 (false result) [bd9a]85 b7STA Blocks_Result; Store as the result. [bd9c]60RTS
; ; XREFS: ; CastMagic_CheckDirection_Right ;
[bd9d]CAST_MAGIC_WIDTHS: [bd9d]0f.byte $0f; [0]: Deluge [bd9e]0f.byte $0f; [1]: Thunder [bd9f]1f.byte $1f; [2]: Fire [bda0]0f.byte $0f; [3]: Death [bda1]0f.byte $0f; [4]: Tilte [bda2]0f.byte $0f; [5]: Deluge after hit [bda3]0f.byte $0f; [6]: Thunder after hit [bda4]1f.byte $1f; [7]: Fire after hit [bda5]0f.byte $0f; [8]: Death after hit [bda6]0f.byte $0f; [9]: Unknown [bda7]0f.byte $0f; [10]: Hit Wall effect (unused) [bda8]0f.byte $0f; [11]: Tilte after hit
; ; XREFS: ; CastMagic_CheckDirection_CheckImpassable ;
[bda9]CAST_MAGIC_HEIGHTS: [bda9]0f.byte $0f; [0]: Deluge [bdaa]1f.byte $1f; [1]: Thunder [bdab]0f.byte $0f; [2]: Fire [bdac]0f.byte $0f; [3]: Death [bdad]0f.byte $0f; [4]: Tilte [bdae]0f.byte $0f; [5]: Deluge after hit [bdaf]1f.byte $1f; [6]: Thunder after hit [bdb0]0f.byte $0f; [7]: Fire after hit [bdb1]0f.byte $0f; [8]: Death after hit [bdb2]0f.byte $0f; [9]: Unknown [bdb3]0f.byte $0f; [10]: Hit Wall effect (unused) [bdb4]0f.byte $0f; [11]: Tilte after hit [bdb5]UNUSED_SPACE_PRG14: [bdb5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdbd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdc5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdcd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdd5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bddd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bde5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bded]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdf5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bdfd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be05]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be0d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be15]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be1d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be25]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be2d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be35]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be3d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be45]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be4d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be55]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be5d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be65]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be6d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be75]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be7d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be85]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be8d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be95]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [be9d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bea5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bead]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [beb5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bebd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bec5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [becd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bed5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bedd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bee5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [beed]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bef5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [befd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf05]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf0d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf15]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf1d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf25]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf2d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf35]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf3d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf45]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf4d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf55]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf5d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf65]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf6d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf75]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf7d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf85]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf8d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf95]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bf9d]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfa5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfad]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfb5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfbd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfc5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfcd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfd5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfdd]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfe5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bfed]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bff5]ff ff ff ff ff ff ff ff.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; undefined [bffd]ff ff ff.byte $ff,$ff,$ff; undefined