;============================================================================ ; 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] [8000]LDA a:Sprites_UpdatesPaused [8003]BNE @_spritesLoop [8005]LDA a:DurationHourGlass [8008]CMP #$ff [800a]BNE @_spritesLoop
; ; The Hour Glass isn't being used and sprites aren't paused, ; so sprites can be updated. ;
[800c]INC a:SpriteUpdateCounter
; ; Begin the loop. ;
[800f]@_spritesLoop:; [$800f] [800f]LDX #$07
; ; Process this sprite slot if it's populated with a ; valid sprite. ;
[8011]@_updateSpriteLoop:; [$8011] [8011]STX a:CurrentSpriteIndex [8014]LDA CurrentSprites_Entities,X [8017]BMI @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]LDA a:Sprites_UpdatesPaused [801c]BNE @_updateSpriteState
; ; The elixir is not active. Check if the sprite was hit. ;
[801e]LDA CurrentSprites_HitCounter,X [8021]BNE @_handleHit [8023]LDA CurrentSprites_HitByMagicBehavior,X [8026]BMI @LAB_PRG14__802e [8028]JSR Sprites_Maybe_UpdateHitByMagic [802b]JMP @_updateSpriteState [802e]@LAB_PRG14__802e:; [$802e] [802e]JSR Sprites_UpdateBehavior [8031]JSR Player_HitSpriteWithWeapon [8034]JSR Sprite_CheckHitByCastMagic [8037]JSR Sprite_GetBounds [803a]JSR Player_CheckShieldHitByMagic [803d]JSR CurrentSprite_CheckHitPlayer [8040]@_updateSpriteState:; [$8040] [8040]JSR CurrentSprite_UpdateState [8043]@LAB_PRG14__8043:; [$8043] [8043]LDX a:CurrentSpriteIndex [8046]DEX [8047]BPL @_updateSpriteLoop [8049]LDA #$00 [804b]STA Sprites_PPUOffset [804d]RTS
; ; 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] [804e]DEC CurrentSprites_HitCounter,X [8051]LDA CurrentSprites_Entities,X
; ; Check if this sprite is Tamazutsu, Pakukame, or Zorugeriru. ;
[8054]CMP #$2c [8056]BEQ @_updateSpriteState [8058]CMP #$30 [805a]BEQ @_updateSpriteState [805c]CMP #$31 [805e]BEQ @_updateSpriteState
; ; It's not any of those. ;
[8060]LDA #$02 [8062]STA a:Arg_DeltaX_Full [8065]LDA #$00 [8067]STA a:Arg_DeltaX_Frac [806a]JSR Sprites_Something_SomethingAndMoveHoriz [806d]JMP @_updateSpriteState
;============================================================================ ; TODO: Document Sprites_UpdateAllStates ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Game_DrawScreenInFrozenState ;============================================================================
[8070]Sprites_UpdateAllStates:; [$8070] [8070]LDA a:CurrentSpriteIndex [8073]PHA [8074]LDX #$07 [8076]@_loop:; [$8076] [8076]STX a:CurrentSpriteIndex [8079]JSR CurrentSprite_UpdateState [807c]LDX a:CurrentSpriteIndex [807f]DEX [8080]BPL @_loop [8082]PLA [8083]STA a:CurrentSpriteIndex [8086]RTS
; ; XREFS: ; CurrentSprite_UpdateState ;
[8087]SPRITE_UPDATE_HANDLERS:; [$8087] [8087]pointer SpriteUpdateHandler_Invisible-1; [0]: [8089]pointer SpriteUpdateHandler_Bread-1; [1]: Dropped: Bread [808b]pointer SpriteUpdateHandler_Coin-1; [2]: Dropped: Coin [808d]pointer SpriteUpdateHandler_Garbled03-1; [3]: Enemy: ? [808f]pointer SpriteUpdateHandler_Enemy_Raiden-1; [4]: Enemy: Raiden [8091]pointer SpriteUpdateHandler_Enemy_NecronAides-1; [5]: Enemy: Necron Aides [8093]pointer SpriteUpdateHandler_Enemy_Zombie-1; [6]: Enemy: Zombie [8095]pointer SpriteUpdateHandler_Enemy_Hornet-1; [7]: Enemy: Hornet [8097]pointer SpriteUpdateHandler_Enemy_Bihoruda-1; [8]: Enemy: Bihoruda [8099]pointer SpriteUpdateHandler_Enemy_Lilith-1; [9]: Enemy: Lilith [809b]pointer SpriteUpdateHandler_TODO_Garbled10-1; [10]: Magic: ? [809d]pointer SpriteUpdateHandler_Enemy_Yuinaru-1; [11]: Enemy: Yuinaru [809f]pointer SpriteUpdateHandler_Enemy_Snowman-1; [12]: Enemy: Snowman [80a1]pointer SpriteUpdateHandler_Enemy_Nash-1; [13]: Enemy: Nash [80a3]pointer SpriteUpdateHandler_Enemy_FireGiant-1; [14]: Enemy: Fire Giant [80a5]pointer SpriteUpdateHandler_Enemy_Ishiisu-1; [15]: Enemy: Ishiisu [80a7]pointer SpriteUpdateHandler_Enemy_ExecutionHood-1; [16]: Enemy: Execution Hood [80a9]pointer SpriteUpdateHandler_Boss_Rokusutahn-1; [17]: Boss: Rokusutahn [80ab]pointer SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart-1; [18]: Boss: unused (round body of snake boss) [80ad]pointer SpriteUpdateHandler_Effect_EnemyDeath-1; [19]: Effect: Enemy death [80af]pointer SpriteUpdateHandler_Effect_LightningBall20-1; [20]: Effect: Lightning ball [80b1]pointer SpriteUpdateHandler_Enemy_Charron-1; [21]: Enemy: Charron [80b3]pointer SpriteUpdateHandler_Invisible-1; [22]: Enemy: ? (Unused) [80b5]pointer SpriteUpdateHandler_Enemy_Geributa-1; [23]: Enemy: Geributa [80b7]pointer SpriteUpdateHandler_Enemy_Sugata-1; [24]: Enemy: Sugata [80b9]pointer SpriteUpdateHandler_Enemy_Grimlock-1; [25]: Enemy: Grimlock [80bb]pointer SpriteUpdateHandler_Enemy_GiantBees-1; [26]: Enemy: Giant Bees [80bd]pointer SpriteUpdateHandler_Enemy_Myconid-1; [27]: Enemy: Myconid [80bf]pointer SpriteUpdateHandler_Enemy_Naga-1; [28]: Enemy: Naga [80c1]pointer SpriteUpdateHandler_Enemy_Unused29-1; [29]: Enemy: Skeleton Knight (unused) [80c3]pointer SpriteUpdateHandler_Enemy_GiantStrider-1; [30]: Enemy: Giant Strider [80c5]pointer SpriteUpdateHandler_Enemy_SirGawaine_Wolfman-1; [31]: Enemy: Sir Gawaine [80c7]pointer SpriteUpdateHandler_Enemy_Maskman-1; [32]: Enemy: Maskman [80c9]pointer thunk_SpriteUpdateHandler_Enemy_SirGawaine_Wolfman-1; [33]: Enemy: Wolfman [80cb]pointer SpriteUpdateHandler_Enemy_Yareeka-1; [34]: Enemy: Yareeka [80cd]pointer SpriteUpdateHandler_Enemy_Magman-1; [35]: Enemy: Magman [80cf]pointer SpriteUpdateHandler_Enemy_Unused_CurlyTail-1; [36]: Enemy: Curly-tailed guy with spear (unused) [80d1]pointer SpriteUpdateHandler_Invisible-1; [37]: Enemy: ? (unused) [80d3]pointer SpriteUpdateHandler_Enemy_Ikeda-1; [38]: Enemy: Ikeda [80d5]pointer SpriteUpdateHandler_Enemy_MuppetGuy-1; [39]: Enemy: Muppet guy (unused) [80d7]pointer SpriteUpdateHandler_Enemy_Lamprey-1; [40]: Enemy: Lamprey [80d9]pointer SpriteUpdateHandler_Invisible-1; [41]: Enemy: ? (unused) [80db]pointer SpriteUpdateHandler_Enemy_Monodron-1; [42]: Enemy: Monodron [80dd]pointer SpriteUpdateHandler_Enemy_Unused_WingedSkeleton-1; [43]: Enemy: Winged skeleton (unused) [80df]pointer SpriteUpdateHandler_Enemy_Tamazutsu-1; [44]: Enemy: Tamazutsu [80e1]pointer SpriteUpdateHandler_Boss_Ripasheiku-1; [45]: Boss: Ripasheiku [80e3]pointer SpriteUpdateHandler_Boss_Zoradohna-1; [46]: Boss: Zoradohna [80e5]pointer SpriteUpdateHandler_Boss_Borabohra-1; [47]: Boss: Borabohra [80e7]pointer SpriteUpdateHandler_Boss_Pakukame-1; [48]: Boss: Pakukame [80e9]pointer SpriteUpdateHandler_Boss_Zorugeriru-1; [49]: Boss: Zorugeriru [80eb]pointer SpriteUpdateHandler_Boss_KingGrieve-1; [50]: Boss: King Grieve [80ed]pointer SpriteUpdateHandler_Boss_ShadowEura-1; [51]: Boss: Shadow Eura [80ef]pointer SpriteUpdateHandler_NPC_Walking-1; [52]: NPC: Walking Man 1 [80f1]pointer thunk1_SpriteUpdateHandler_NPC_Walking-1; [53]: NPC: Blue lady (unused) [80f3]pointer thunk2_SpriteUpdateHandler_NPC_Walking-1; [54]: NPC: Child (unused) [80f5]pointer SpriteUpdateHandler_NPC_ArmorSalesman-1; [55]: NPC: Armor Salesman [80f7]pointer SpriteUpdateHandler_NPC_MartialArts-1; [56]: NPC: Martial Artist [80f9]pointer SpriteUpdateHandler_NPC_Priest-1; [57]: NPC: Priest [80fb]pointer SpriteUpdateHandler_NPC_King-1; [58]: NPC: King [80fd]pointer SpriteUpdateHandler_NPC_MagicTeacher-1; [59]: NPC: Magic Teacher [80ff]pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [60]: NPC: Key Salesman [8101]pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [61]: NPC: Smoking Man [8103]pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [62]: NPC: Man in Chair [8105]pointer SpriteUpdateHandler_NPC_KeySalesman_Others-1; [63]: NPC: Sitting Man [8107]pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [64]: NPC: Meat Salesman [8109]pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [65]: NPC: Lady in Blue Dress with Cup [810b]pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [66]: NPC: Guard [810d]pointer SpriteUpdateHandler_NPC_Doctor-1; [67]: NPC: Doctor [810f]pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [68]: NPC: Walking Woman 1 [8111]pointer SpriteUpdateHandler_NPC_MeatSalesman_Others-1; [69]: NPC: Walking Woman 2 [8113]pointer SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura-1; [70]: Enemy: Eyeball (unused) [8115]pointer SpriteUpdateHandler_Enemy_UnusedEyeball_Zozura-1; [71]: Enemy: Zozura [8117]pointer SpriteUpdateHandler_Item_Standard-1; [72]: Item: Glove [8119]pointer SpriteUpdateHandler_Item_Special-1; [73]: Item: Black Onyx [811b]pointer SpriteUpdateHandler_Item_Special-1; [74]: Item: Pendant [811d]pointer SpriteUpdateHandler_Item_Standard-1; [75]: Item: Red Potion [811f]pointer SpriteUpdateHandler_Item_Standard-1; [76]: Item: Poison [8121]pointer SpriteUpdateHandler_Item_Standard-1; [77]: Item: Elixir [8123]pointer SpriteUpdateHandler_Item_Standard-1; [78]: Item: Ointment [8125]pointer SpriteUpdateHandler_Invisible-1; [79]: Trigger: Intro [8127]pointer SpriteUpdateHandler_Item_Standard-1; [80]: Item: Mattock [8129]pointer SpriteUpdateHandler_Magic_81-1; [81]: Magic: ? [812b]pointer SpriteUpdateHandler_Effect_Fountain-1; [82]: Effect: Fountain [812d]pointer SpriteUpdateHandler_Magic_83-1; [83]: Magic: ? [812f]pointer SpriteUpdateHandler_EnemyMagic-1; [84]: Magic: Enemy Fireball [8131]pointer SpriteUpdateHandler_Item_Standard-1; [85]: Item: Wing Boots [8133]pointer SpriteUpdateHandler_Item_Standard-1; [86]: Item: Hour Glass [8135]pointer SpriteUpdateHandler_Item_Special-1; [87]: Item: Magical Rod [8137]pointer SpriteUpdateHandler_Item_Special-1; [88]: Item: Battle Suit [8139]pointer SpriteUpdateHandler_Item_Special-1; [89]: Item: Battle Helmet [813b]pointer SpriteUpdateHandler_Item_Special-1; [90]: Item: Dragon Slayer [813d]pointer SpriteUpdateHandler_Item_Standard-1; [91]: Item: Mattock [813f]pointer SpriteUpdateHandler_Item_Standard-1; [92]: Item: Wing Boots (from quest) [8141]pointer SpriteUpdateHandler_Item_Standard-1; [93]: Item: Red Potion [8143]pointer SpriteUpdateHandler_Item_Standard-1; [94]: Item: Poison [8145]pointer SpriteUpdateHandler_Item_Standard-1; [95]: Item: Glove [8147]pointer SpriteUpdateHandler_Item_Standard-1; [96]: Item: Ointment [8149]pointer SpriteUpdateHandler_Effect_Spring-1; [97]: Effect: Spring of Trunk [814b]pointer SpriteUpdateHandler_Effect_Spring-1; [98]: Effect: Spring of Sky [814d]pointer SpriteUpdateHandler_Effect_Spring-1; [99]: Effect: Spring of Tower [814f]pointer SpriteUpdateHandler_Effect_BossDeath-1; [100]: Effect: Boss Death
;============================================================================ ; TODO: Document Sprites_Maybe_UpdateHitByMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8151]Sprites_Maybe_UpdateHitByMagic:; [$8151] [8151]LDY CurrentSprites_HitByMagicBehavior,X [8154]BEQ @LAB_PRG14__8162 [8156]DEY [8157]BEQ @LAB_PRG14__817a [8159]DEY [815a]BEQ @LAB_PRG14__8192 [815c]LDA #$ff [815e]STA CurrentSprites_HitByMagicBehavior,X [8161]RTS [8162]@LAB_PRG14__8162:; [$8162] [8162]LDA #$03 [8164]STA a:Arg_DeltaX_Full [8167]LDA #$00 [8169]STA a:Arg_DeltaX_Frac [816c]JSR Sprites_Something_SomethingAndMoveHoriz [816f]DEC CurrentSprites_HitByMagicIFrames,X [8172]BNE @LAB_PRG14__8179 [8174]LDA #$ff [8176]STA CurrentSprites_HitByMagicBehavior,X [8179]@LAB_PRG14__8179:; [$8179] [8179]RTS [817a]@LAB_PRG14__817a:; [$817a] [817a]LDA #$02 [817c]STA a:Arg_DeltaX_Full [817f]LDA #$00 [8181]STA a:Arg_DeltaX_Frac [8184]JSR Sprites_Something_SomethingAndMoveHoriz [8187]DEC CurrentSprites_HitByMagicIFrames,X [818a]BNE @_return1 [818c]LDA #$ff [818e]STA CurrentSprites_HitByMagicBehavior,X [8191]@_return1:; [$8191] [8191]RTS [8192]@LAB_PRG14__8192:; [$8192] [8192]LDA #$04 [8194]STA a:Arg_DeltaX_Full [8197]LDA #$00 [8199]STA a:Arg_DeltaX_Frac [819c]JSR Sprites_Something_SomethingAndMoveHoriz [819f]BCC @_return2 [81a1]LDA #$ff [81a3]STA CurrentSprites_HitByMagicBehavior,X [81a6]@_return2:; [$81a6] [81a6]RTS
;============================================================================ ; TODO: Document Player_HitEnemyWithMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
[81a7]Player_HitEnemyWithMagic:; [$81a7] [81a7]LDA CurrentSprites_Entities,X; Load the sprite entity at the given index. [81aa]CMP #$05; Is this Necron Aides? [81ac]BNE @_handleHitWithMagic; If not, jump.
; ; This is Necron Aides. Set bit 7 on its phase. ;
[81ae]LDA CurrentSprites_Phases,X; Load the phase for Necron Aides. [81b1]ORA #$80; Set bit 7. [81b3]STA 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] [81b6]LDA #$02; 2 == Enemy Hit With Magic sound effect [81b8]JSR Sound_PlayEffect; Play it.
; ; Load the standard damage amount for the current spell. ;
[81bb]LDA MAGIC_DAMAGE,Y; Load the magic damage for the current spell. [81be]STA Temp_00; Store it temporarily.
; ; Check if the player has the Magical Rod. ;
[81c0]LDA a:SpecialItems; Load the player's special items. [81c3]AND #$04; Is the Magical Rod equipped? [81c5]BEQ @_prepareCalcDefense
; ; The player has the Magical Rod. ; ; If they do, increase damage by 50%. ;
[81c7]LDA Temp_00; Load the magic damage for the spell. [81c9]LSR A; Reduce that amount by half (we'll add it back). [81ca]CLC [81cb]ADC Temp_00; Now add it back to the magic damage (yielding a 50% increase). [81cd]STA Temp_00; Store it. [81cf]@_prepareCalcDefense:; [$81cf] [81cf]LDA #$00 [81d1]STA Temp_Addr_L; Set the default magic defense flags to 0 (0%). [81d3]STY 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]CPY #$00; Is the spell Deluge? [81d7]BEQ @_reduceEnemyHP
; ; This is not the Deluge spell. ;
[81d9]LDY CurrentSprites_Entities,X; Load the entity that's been hit. [81dc]LDA 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] [81df]ASL A; Shift left, placing the most-significant bit into carry. [81e0]ROL Temp_Addr_L; Rotate left, placing that into bit 0. [81e2]ASL A; Shift left, placing the most-significant bit into carry. [81e3]ROL Temp_Addr_L; Rotate left, placing that into bit 0. [81e5]DEC Temp_01; Decrement the magic spell counter. [81e7]BNE @_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]LDA Temp_Addr_L; Load the magic defense flags. [81eb]AND #$03; Keep only bits 0 and 1. [81ed]TAY; Transfer to Y. [81ee]BEQ @_reduceEnemyHP; If flags are 0, there's no defense. Jump. [81f0]LSR Temp_00; There's magic defense. Half the damage. [81f2]DEY; Y-- (defense flags). [81f3]BEQ @_reduceEnemyHP; If flags are 0, we're done. Jump. [81f5]LSR Temp_00; Half the damage again (75% now). [81f7]BEQ @_reduceEnemyHP; If 0 magic damage remains, we're done. Jump. [81f9]LDA #$00; Ignore that 75%. Make it 100%. Why not. [81fb]STA Temp_00; Save it.
; ; Subtract the magic damage from entity's HP. ;
[81fd]@_reduceEnemyHP:; [$81fd] [81fd]LDA CurrentSprites_HP,X; Load the current HP for the entity being hit. [8200]SEC [8201]SBC Temp_00; Subtract the normalized magic damage. [8203]STA CurrentSprites_HP,X; Store it back. [8206]BCS RETURN_822D; If HP > 0, return.
; ; The entity is dead. ;
[8208]LDA CurrentSprites_Entities,X; Load the ID of this entity. [820b]CMP #$18; Is this Sugata? [820d]BNE @_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]LDA PPU_Mask; Load the screen color mode. [8211]AND #$fe; Clear the greyscale bit. [8213]STA PPU_Mask; Store it.
; ; Add experience from the sprite. ;
[8215]@_addExperience:; [$8215] [8215]JSR Player_AddExperienceFromSprite; Add experience to the player.
; ; Play the killed enemy sound effect. ;
[8218]LDA #$03; 3 == Enemy Death sound effect [821a]JSR Sound_PlayEffect; Play it.
; ; Check if this is a normal and big enemy. They need to be ; handled differently. ;
[821d]LDY CurrentSprites_Entities,X; Load the ID of this entity. [8220]LDA SPRITE_CATEGORIES_BY_ENTITY,Y; Load the entity's category. [8223]CMP #$07; Is it a boss? [8225]BNE @_isSmallEnemy; If not, jump. It should be a small enemy.
; ; This is a big enemy. Handle cleanup specially. ;
[8227]JMP Sprite_ShowBigEnemyDeathByMagicOrWeapon; Show the boss death effect. [822a]@_isSmallEnemy:; [$822a] [822a]JMP Sprite_ShowNormalEnemyDeathByMagic; Show the standard enemy death effect.
; ; XREFS: ; Player_HitEnemyWithMagic ; SpriteUpdateHandler_Effect_EnemyDeath ; SpriteUpdateHandler_Effect_LightningBall20 ;
[822d]RETURN_822D:; [$822d] [822d]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_EnemyDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ad] ; SpriteUpdateHandler_Effect_BossDeath ;============================================================================
[822e]SpriteUpdateHandler_Effect_EnemyDeath:; [$822e] [822e]LDA #$00 [8230]STA Sprites_PPUOffset [8232]LDA a:SpriteUpdateCounter [8235]LSR A [8236]BCS RETURN_822D [8238]LDA #$00 [823a]STA CurrentSprite_FlipMask [823c]STA Sprites_PPUOffset [823e]JSR Sprite_EnterNextAppearancePhase [8241]LDX a:CurrentSpriteIndex [8244]LDA CurrentSprites_BehaviorData2,X [8247]ASL A [8248]ASL A [8249]EOR #$ff [824b]STA Temp_00 [824d]INC Temp_00 [824f]LDA CurrentSprites_YPos,X [8251]CLC [8252]ADC Temp_00 [8254]STA Arg_DrawSprite_PosY [8256]LDA #$00 [8258]STA Sprites_PPUOffset [825a]LDA #$01 [825c]JSR Sprite_EnterNextAppearancePhase [825f]LDX a:CurrentSpriteIndex [8262]LDA CurrentSprites_BehaviorData2,X [8265]ASL A [8266]ASL A [8267]STA Temp_00 [8269]LDA CurrentSprites_YPos,X [826b]CLC [826c]ADC Temp_00 [826e]STA Arg_DrawSprite_PosY [8270]LDA #$00 [8272]STA Sprites_PPUOffset [8274]LDA #$02 [8276]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Effect_BossDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::814f] ;============================================================================
[8279]SpriteUpdateHandler_Effect_BossDeath:; [$8279] [8279]LDA #$00 [827b]STA Sprites_PPUOffset [827d]LDA CurrentSprites_Phases,X [8280]CMP #$02 [8282]BEQ SpriteUpdateHandler_Effect_LightningBall20 [8284]CMP #$07 [8286]BEQ SpriteUpdateHandler_Effect_LightningBall20 [8288]JMP 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] [828b]LDA #$00 [828d]STA Sprites_PPUOffset [828f]LDA a:SpriteUpdateCounter [8292]LSR A [8293]BCS RETURN_822D [8295]LDA #$00 [8297]STA CurrentSprite_FlipMask [8299]LDA #$00 [829b]STA Sprites_PPUOffset [829d]JSR Sprite_EnterNextAppearancePhase [82a0]LDY #$03 [82a2]@LAB_PRG14__82a2:; [$82a2] [82a2]LDX a:CurrentSpriteIndex [82a5]LDA CurrentSprites_XPos_Full,X [82a7]STA Arg_DrawSprite_PosX [82a9]LDA CurrentSprites_YPos,X [82ab]STA Arg_DrawSprite_PosY [82ad]LDA CurrentSprites_BehaviorData2,X [82b0]ASL A [82b1]ASL A [82b2]EOR $82f0,Y [82b5]STA Temp_00 [82b7]BPL @LAB_PRG14__82bb [82b9]INC Temp_00 [82bb]@LAB_PRG14__82bb:; [$82bb] [82bb]TYA [82bc]AND #$02 [82be]BNE @LAB_PRG14__82ca [82c0]LDA CurrentSprites_YPos,X [82c2]CLC [82c3]ADC Temp_00 [82c5]STA Arg_DrawSprite_PosY [82c7]JMP @LAB_PRG14__82d1 [82ca]@LAB_PRG14__82ca:; [$82ca] [82ca]LDA CurrentSprites_XPos_Full,X [82cc]CLC [82cd]ADC Temp_00 [82cf]STA Arg_DrawSprite_PosX [82d1]@LAB_PRG14__82d1:; [$82d1] [82d1]LDA $82f4,Y [82d4]STA CurrentSprite_FlipMask [82d6]LDA $82ec,Y [82d9]STA Temp_00 [82db]TYA [82dc]PHA [82dd]LDA #$00 [82df]STA Sprites_PPUOffset [82e1]LDA Temp_00 [82e3]JSR Sprite_EnterNextAppearancePhase [82e6]PLA [82e7]TAY [82e8]DEY [82e9]BPL @LAB_PRG14__82a2 [82eb]RTS [82ec].byte $01; [0]: [82ed].byte $02; [1]: [82ee].byte $03; [2]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82ef]BYTE_ARRAY_PRG14__82ec_3_:; [$82ef] [82ef].byte $03; [3]: [82f0].byte $ff; [0]: [82f1].byte $00; [1]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82f2]BYTE_ARRAY_PRG14__82f0_2_:; [$82f2] [82f2].byte $ff; [2]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82f3]BYTE_ARRAY_PRG14__82f0_3_:; [$82f3] [82f3].byte $00; [3]: [82f4].byte $00; [0]: [82f5].byte $00; [1]: [82f6].byte $00; [2]:
; ; XREFS: ; SpriteUpdateHandler_Effect_LightningBall20 ;
[82f7]BYTE_ARRAY_PRG14__82f4_3_:; [$82f7] [82f7].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] [82f8]LDA CurrentSprites_XPos_Full,X [82fa]SEC [82fb]SBC Player_PosX_Block [82fd]BCS @LAB_PRG14__8312 [82ff]EOR #$ff [8301]CLC [8302]ADC #$01 [8304]CLC [8305]LDY CurrentSprites_HitBoxTypes,X [8308]SEC [8309]SBC SPRITE_HITBOX_WIDTHS,Y [830c]BCS @_returnTrue [830e]LDA #$00 [8310]@_returnTrue:; [$8310] [8310]CLC [8311]RTS [8312]@LAB_PRG14__8312:; [$8312] [8312]SEC [8313]SBC #$10 [8315]BCS @_return [8317]LDA #$00 [8319]SEC [831a]@_return:; [$831a] [831a]RTS
;============================================================================ ; 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] [831b]LDA CurrentSprites_YPos,X [831d]SEC [831e]SBC Player_PosY [8320]BCS @_return [8322]EOR #$ff [8324]CLC [8325]ADC #$01 [8327]CLC [8328]@_return:; [$8328] [8328]RTS
;============================================================================ ; TODO: Document SpriteBehavior_Unknown_29_SomeSetup ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Unknown_29 ;============================================================================
[8329]SpriteBehavior_Unknown_29_SomeSetup:; [$8329] [8329]JSR BScript_Action_FacePlayerX [832c]JSR BScript_Action_FacePlayerY [832f]JSR Sprite_CalcDistanceXToPlayer [8332]STA CurrentSprites_BehaviorState_XFull,X [8335]JSR Sprite_CalcDistanceYToPlayer [8338]STA CurrentSprites_BehaviorState_YFull,X [833b]CMP CurrentSprites_BehaviorState_XFull,X [833e]BCS @LAB_PRG14__836c [8340]LDA CurrentSprites_BehaviorState_YFull,X [8343]STA a:Arg_PlayerHealthDelta_U [8346]LDA CurrentSprites_BehaviorState_XFull,X [8349]STA a:SpriteBehaviorUnknown20_SomethingXOrY [834c]LDA #$00 [834e]STA a:Arg_PlayerHealthDelta_L [8351]STA a:BYTE_04bf [8354]STA CurrentSprites_BehaviorState_XFrac,X [8357]JSR Player_Something_ChangeHP [835a]LDA a:Arg_PlayerHealthDelta_U [835d]STA CurrentSprites_BehaviorState_YFull,X [8360]LDA a:Arg_PlayerHealthDelta_L [8363]STA CurrentSprites_BehaviorState_YFrac,X [8366]LDA #$01 [8368]STA CurrentSprites_BehaviorState_XFull,X [836b]RTS [836c]@LAB_PRG14__836c:; [$836c] [836c]LDA CurrentSprites_BehaviorState_XFull,X [836f]STA a:Arg_PlayerHealthDelta_U [8372]LDA CurrentSprites_BehaviorState_YFull,X [8375]STA a:SpriteBehaviorUnknown20_SomethingXOrY [8378]LDA #$00 [837a]STA a:Arg_PlayerHealthDelta_L [837d]STA a:BYTE_04bf [8380]STA CurrentSprites_BehaviorState_YFrac,X [8383]JSR Player_Something_ChangeHP [8386]LDA a:Arg_PlayerHealthDelta_U [8389]STA CurrentSprites_BehaviorState_XFull,X [838c]LDA a:Arg_PlayerHealthDelta_L [838f]STA CurrentSprites_BehaviorState_XFrac,X [8392]LDA #$01 [8394]STA CurrentSprites_BehaviorState_YFull,X [8397]RTS
;============================================================================ ; MAYBE DEADCODE ; ; XREFS: ; FUN_PRG14__8398 ;============================================================================
[8398]FUN_PRG14__8398:; [$8398] [8398]ASL CurrentSprites_BehaviorState_XFull,X [839b]ROL CurrentSprites_BehaviorState_XFrac,X [839e]ASL CurrentSprites_BehaviorState_YFull,X [83a1]ROL CurrentSprites_BehaviorState_YFrac,X [83a4]DEY [83a5]BNE FUN_PRG14__8398 [83a7]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[83a8]FUN_PRG14__83a8:; [$83a8] [83a8]LDA CurrentSprites_BehaviorState_XFull,X [83ab]STA a:Arg_DeltaX_Frac [83ae]LDA CurrentSprites_BehaviorState_XFrac,X [83b1]STA a:Arg_DeltaX_Full [83b4]LDA CurrentSprites_BehaviorState_YFull,X [83b7]STA a:Arg_DeltaY_Frac [83ba]LDA CurrentSprites_BehaviorState_YFrac,X [83bd]STA a:Arg_DeltaY_Full [83c0]RTS
;============================================================================ ; TODO: Document Sprites_CalcHorizSpriteMovement ; ; INPUTS: ; A ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9593 ; SpriteBehavior_Bihoruda ; SpriteBehavior_Borabohra ; SpriteBehavior_Yuinaru ;============================================================================
[83c1]Sprites_CalcHorizSpriteMovement:; [$83c1] [83c1]STA a:Arg_DeltaX_Frac; Set pixels delta from A. [83c4]LDA #$00; A = 0 [83c6]@_loop:; [$83c6] [83c6]ASL a:Arg_DeltaX_Frac; Shift the pixels delta amount left. [83c9]ROL A [83ca]DEY [83cb]BNE @_loop [83cd]STA a:Arg_DeltaX_Full [83d0]RTS
;============================================================================ ; 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] [83d1]STA a:Arg_DeltaY_Frac [83d4]LDA #$00 [83d6]@LAB_PRG14__83d6:; [$83d6] [83d6]ASL a:Arg_DeltaY_Frac [83d9]ROL A [83da]DEY [83db]BNE @LAB_PRG14__83d6 [83dd]STA a:Arg_DeltaY_Full [83e0]RTS
;============================================================================ ; 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] [83e1]PHA [83e2]AND SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [83e5]STA Temp_00 [83e7]PLA [83e8]AND SPRITES_MAYBE_GRAVITY,Y [83eb]BEQ @LAB_PRG14__83f4 [83ed]LDA SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [83f0]SEC [83f1]SBC Temp_00 [83f3]RTS [83f4]@LAB_PRG14__83f4:; [$83f4] [83f4]LDA Temp_00 [83f6]RTS
; ; XREFS: ; SpriteBehavior_Hop ; SpriteBehavior_SomethingZoradohna_18 ; Sprites_CalcYFromGravity ;
[83f7]SPRITE_BEHAVIOR_HOP_PEAK_TICKS:; [$83f7] [83f7].byte $ff; [0]: [83f8].byte $7f; [1]: [83f9].byte $3f; [2]: [83fa].byte $1f; [3]: [83fb].byte $0f; [4]: [83fc].byte $07; [5]: [83fd].byte $03; [6]: [83fe].byte $01; [7]:
; ; XREFS: ; Sprites_CalcYFromGravity ;
[83ff]SPRITES_MAYBE_GRAVITY:; [$83ff] [83ff].byte $00; [0]: [8400].byte $80; [1]: [8401].byte $40; [2]: [8402].byte $20; [3]: [8403].byte $10; [4]: [8404].byte $08; [5]: [8405].byte $04; [6]: [8406].byte $02; [7]:
;============================================================================ ; TODO: Document BScript_Action_FlipXDirection ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a796] ; SpriteBehavior_WalkForward ;============================================================================
[8407]BScript_Action_FlipXDirection:; [$8407] [8407]LDA CurrentSprites_Flags,X [840a]EOR #$01 [840c]STA CurrentSprites_Flags,X [840f]RTS
;============================================================================ ; 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] [8410]LDA CurrentSprites_Flags,X [8413]EOR #$80 [8415]STA CurrentSprites_Flags,X [8418]RTS
;============================================================================ ; 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] [8419]JSR Sprites_Something_SomethingAndMoveHoriz [841c]BCC @_return [841e]LDA CurrentSprites_Flags,X [8421]EOR #$01 [8423]STA CurrentSprites_Flags,X [8426]@_return:; [$8426] [8426]RTS
;============================================================================ ; TODO: Document Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_EnemyMagic ; SpriteBehavior_GiantBees ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_Yuinaru ;============================================================================
[8427]Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz:; [$8427] [8427]JSR Sprite_MoveForwardX [842a]LDA CurrentSprites_XPos_Full,X [842c]CMP #$f0 [842e]BCC @_returnFalse [8430]LDA CurrentSprites_Flags,X [8433]LSR A [8434]LDA CurrentSprites_XPos_Full,X [8436]AND #$f0 [8438]BCS @LAB_PRG14__843d [843a]CLC [843b]ADC #$10 [843d]@LAB_PRG14__843d:; [$843d] [843d]STA CurrentSprites_XPos_Full,X [843f]LDA CurrentSprites_Flags,X [8442]EOR #$01 [8444]STA CurrentSprites_Flags,X [8447]SEC [8448]RTS [8449]@_returnFalse:; [$8449] [8449]CLC [844a]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[844b]FUN_PRG14__844b:; [$844b] [844b]JSR Sprite_Maybe_AddFacingPosX [844e]LDA CurrentSprites_XPos_Full,X [8450]CMP #$f0 [8452]BCC RETURN_846B [8454]LDA CurrentSprites_Flags,X [8457]LSR A [8458]LDA CurrentSprites_XPos_Full,X [845a]AND #$f0 [845c]BCS @LAB_PRG14__8461 [845e]CLC [845f]ADC #$10 [8461]@LAB_PRG14__8461:; [$8461] [8461]STA CurrentSprites_XPos_Full,X [8463]LDA CurrentSprites_Flags,X [8466]EOR #$01 [8468]STA CurrentSprites_Flags,X
; ; XREFS: ; FUN_PRG14__844b ; Sprite_Maybe_AddFacingPosX ;
[846b]RETURN_846B:; [$846b] [846b]RTS
;============================================================================ ; TODO: Document Sprite_Maybe_AddFacingPosX ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__844b ;============================================================================
[846c]Sprite_Maybe_AddFacingPosX:; [$846c] [846c]LDA CurrentSprites_XPos_Full,X [846e]CMP Player_PosX_Block [8470]BEQ RETURN_846B [8472]BCC @LAB_PRG14__847e [8474]LDA CurrentSprites_Flags,X [8477]AND #$01 [8479]BNE @LAB_PRG14__8488 [847b]JMP Sprite_SubtractPosX [847e]@LAB_PRG14__847e:; [$847e] [847e]LDA CurrentSprites_Flags,X [8481]AND #$01 [8483]BEQ @LAB_PRG14__8488 [8485]JMP Sprite_AddPosX [8488]@LAB_PRG14__8488:; [$8488] [8488]CLC [8489]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[848a]FUN_PRG14__848a:; [$848a] [848a]LDA #$00 [848c]STA a:Arg_DeltaX_Frac [848f]LDA #$01 [8491]STA 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] [8494]JSR Sprite_MoveForwardX [8497]JMP 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] [849a]LDA CurrentSprites_Flags,X; Load the sprite's flags. [849d]LSR A; Shift the "Facing Right" bit into Carry. [849e]BCS 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] [84a0]LDA CurrentSprites_XPos_Frac,X; Load the fractional X position for the sprite entity. [84a3]SEC [84a4]SBC a:Arg_DeltaX_Frac; Subtract the provided value. [84a7]STA CurrentSprites_XPos_Frac,X; Store it. [84aa]LDA CurrentSprites_XPos_Full,X; Load the block X position for the sprite entity. [84ac]SBC a:Arg_DeltaX_Full; Subtract the provided value. [84af]STA CurrentSprites_XPos_Full,X; Store it. [84b1]RTS
;============================================================================ ; 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] [84b2]LDA CurrentSprites_XPos_Frac,X; Load the fractional X position for the sprite entity. [84b5]CLC [84b6]ADC a:Arg_DeltaX_Frac; Add the provided value. [84b9]STA CurrentSprites_XPos_Frac,X; Store it. [84bc]LDA CurrentSprites_XPos_Full,X; Load the block X position for the sprite entity. [84be]ADC a:Arg_DeltaX_Full; Add the provided value. [84c1]STA CurrentSprites_XPos_Full,X; Store it. [84c3]RTS
;============================================================================ ; 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] [84c4]TYA [84c5]PHA [84c6]LDA CurrentSprites_Flags,X; Load the sprite flags. [84c9]AND #$01 [84cb]TAX [84cc]JSR CurrentSprite_CanMoveInDirection; Check if this sprite can move at all [84cf]LDA Blocks_Result; Load the current block properties [84d1]BEQ @_cannotMove; If 0, it cannot move [84d3]LDX a:CurrentSpriteIndex; Load the current sprite [84d6]LDA CurrentSprites_Flags,X; Load the sprite's flags. [84d9]AND #$01 [84db]TAY [84dc]LDA CurrentSprites_XPos_Full,X; Load the X coordinate of the sprite [84de]AND #$f0; Grab the X pos (top nibble) [84e0]CPY #$01 [84e2]BCS @_updateHorizPos [84e4]CLC [84e5]ADC #$10; Add 1 to the block X position [84e7]@_updateHorizPos:; [$84e7] [84e7]STA CurrentSprites_XPos_Full,X; Store the block position for the sprite. [84e9]PLA; Restore the original Y register. [84ea]TAY [84eb]SEC; C = 1 (moved, true result) [84ec]RTS [84ed]@_cannotMove:; [$84ed] [84ed]PLA; Restore the registers [84ee]TAY [84ef]LDX a:CurrentSpriteIndex [84f2]CLC; C = 0 (could not move, false result) [84f3]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[84f4]DEADCODE_FUN_PRG14__84f4:; [$84f4] [84f4]JSR Sprites_CanMoveDownByHitbox [84f7]TAX [84f8]BNE SpriteBehavior_RestoreXRegister [84fa]LDX a:CurrentSpriteIndex [84fd]JSR DEADCODE_Sprites_CanMoveDownBelowHitbox [8500]TAX [8501]BEQ SpriteBehavior_Something_850d [8503]LDX a:CurrentSpriteIndex [8506]RTS
;============================================================================ ; TODO: Document SpriteBehavior_Ishiisu_Something_915b ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ishiisu ;============================================================================
[8507]SpriteBehavior_Ishiisu_Something_915b:; [$8507] [8507]JSR Sprites_CanMoveDownByHitbox [850a]TAX [850b]BNE SpriteBehavior_RestoreXRegister
; ; v-- Fall through --v ;
;============================================================================ ; MAYBE DEADCODE ; ; XREFS: ; DEADCODE_FUN_PRG14__84f4 ;============================================================================
[850d]SpriteBehavior_Something_850d:; [$850d] [850d]LDX a:CurrentSpriteIndex [8510]LDA CurrentSprites_Flags,X [8513]LSR A [8514]PHP [8515]LDA CurrentSprites_XPos_Full,X [8517]AND #$f0 [8519]PLP [851a]BCS @LAB_PRG14__851e [851c]ADC #$10 [851e]@LAB_PRG14__851e:; [$851e] [851e]STA CurrentSprites_XPos_Full,X [8520]LDA InterruptCounter [8522]AND #$3f; On interrupts 64 and 128... [8524]BNE SpriteBehavior_RestoreXRegister [8526]LDA CurrentSprites_Flags,X [8529]EOR #$01 [852b]STA 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] [852e]LDX a:CurrentSpriteIndex [8531]RTS
; ; XREFS: ; Sprites_CheckPlacementInvalidAtY ;
[8532]SPRITE_CHECK_PLACEMENT_X_OFFSETS_BY_FACING:; [$8532] [8532].byte $00; [0]: 0 pixel movement [8533].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] [8534]LDY CurrentSprites_HitBoxTypes,X; Load the hitbox type for the current sprite. [8537]LDA CurrentSprites_YPos,X; Load the sprite's Y position. [8539]CLC [853a]ADC SPRITE_HITBOX_HEIGHTS,Y; Add the hitbox height. [853d]CLC [853e]ADC #$10; Add 16 (block height). [8540]JMP 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] [8543]LDY CurrentSprites_HitBoxTypes,X; Load the hitbox type for the current sprite. [8546]LDA CurrentSprites_YPos,X; Load the sprite's Y position. [8548]CLC [8549]ADC 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:; [$854c]
; ; 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]STA Arg_PixelPosY; Store A as the Y argument for placement checks. [854e]INC 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]LDA CurrentSprites_Flags,X; Load the sprite's flags. [8553]AND #$01; Keep the Facing bit. [8555]TAY; Transfer to Y. [8556]LDA CurrentSprites_XPos_Full,X; Load the sprite's X position. [8558]CLC [8559]ADC SPRITE_CHECK_PLACEMENT_X_OFFSETS_BY_FACING,Y; Add an offset based on the facing bit. [855c]STA 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]JSR Area_ConvertPixelsToBlockPos; Convert the pixels to a block position. [8561]JMP 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] [8564]JSR Sprite_CalculateNewVertPos [8567]JSR MoveSpriteVerticalIfPossible [856a]BCC @_return [856c]LDA CurrentSprites_Flags,X [856f]EOR #$80 [8571]STA CurrentSprites_Flags,X [8574]@_return:; [$8574] [8574]RTS
;============================================================================ ; TODO: Document MoveSpriteVerticalIfPossible ; ; INPUTS: ; X ; ; OUTPUTS: ; C ; ; XREFS: ; Sprite_MoveVertAndFlipIfNeeded ; Sprite_MoveVertical ;============================================================================
[8575]MoveSpriteVerticalIfPossible:; [$8575] [8575]LDA CurrentSprites_Flags,X [8578]ROL A [8579]ROL A [857a]AND #$01 [857c]ORA #$02 [857e]TAX [857f]JSR CurrentSprite_CanMoveInDirection [8582]LDX a:CurrentSpriteIndex [8585]LDA Blocks_Result [8587]BEQ @_returnFalse [8589]LDA CurrentSprites_Flags,X [858c]ASL A [858d]LDA CurrentSprites_YPos,X [858f]AND #$f0 [8591]BCS @_returnTrue [8593]CLC [8594]ADC #$10 [8596]@_returnTrue:; [$8596] [8596]STA CurrentSprites_YPos,X [8598]SEC [8599]RTS [859a]@_returnFalse:; [$859a] [859a]CLC [859b]RTS
;============================================================================ ; TODO: Document Sprite_Maybe_TurnAroundIfAtScreenEdgeVert ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ExecutionHood ; SpriteBehavior_GiantBees ; SpriteBehavior_SomethingEyeball_17 ; SpriteBehavior_Yuinaru ;============================================================================
[859c]Sprite_Maybe_TurnAroundIfAtScreenEdgeVert:; [$859c] [859c]JSR Sprite_CalculateNewVertPos [859f]JSR Sprite_CapToBlockOppositeFalling [85a2]BCC @_return [85a4]LDA CurrentSprites_Flags,X [85a7]EOR #$80 [85a9]STA CurrentSprites_Flags,X [85ac]@_return:; [$85ac] [85ac]RTS
;============================================================================ ; 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:; [$85ad]
; ; Check if the Y position is at the bottom of the screen. ;
[85ad]LDA CurrentSprites_YPos,X; Load the sprite's Y position. [85af]CMP #$e0; Is Y < 224? [85b1]BCC @_return; If so, return.
; ; There's room to fall. Check if the sprite is falling. ;
[85b3]LDA CurrentSprites_Flags,X; Load the sprite's flags. [85b6]ASL A; Shift the Falling flag into C. [85b7]LDA CurrentSprites_YPos,X; A = Y position. [85b9]AND #$f0; Round (floor) to a block position. [85bb]BCS @_setY; If falling, jump to set the position as Y.
; ; The sprite is not falling. It's moving up. ;
[85bd]CLC; Else, clear carry. [85be]ADC #$10; A += 16 (Y position)
; ; Set the resulting Y position for the sprite, and ; set C = 1 for the result. ;
[85c0]@_setY:; [$85c0] [85c0]STA CurrentSprites_YPos,X; Set as the new Y position. [85c2]SEC; Set C = 1. [85c3]@_return:; [$85c3] [85c3]RTS
;============================================================================ ; 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] [85c4]JSR Sprite_CalculateNewVertPos [85c7]JMP 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] [85ca]LDA CurrentSprites_Flags,X; Load the sprite's flags. [85cd]BMI @LAB_PRG14__85e1 [85cf]LDA CurrentSprites_YPos_Frac,X [85d2]SEC [85d3]SBC a:Arg_DeltaY_Frac [85d6]STA CurrentSprites_YPos_Frac,X [85d9]LDA CurrentSprites_YPos,X [85db]SBC a:Arg_DeltaY_Full [85de]STA CurrentSprites_YPos,X [85e0]RTS [85e1]@LAB_PRG14__85e1:; [$85e1] [85e1]LDA CurrentSprites_YPos_Frac,X [85e4]CLC [85e5]ADC a:Arg_DeltaY_Frac [85e8]STA CurrentSprites_YPos_Frac,X [85eb]LDA CurrentSprites_YPos,X [85ed]ADC a:Arg_DeltaY_Full [85f0]STA CurrentSprites_YPos,X [85f2]RTS [85f3]LDX a:CurrentSpriteIndex [85f6]LDA CurrentSprites_Flags,X [85f9]AND #$01 [85fb]TAY [85fc]LDA CurrentSprites_XPos_Full,X [85fe]CLC [85ff]ADC BYTE_ARRAY_PRG14__861d,Y [8602]STA Arg_PixelPosX [8604]LDY CurrentSprites_HitBoxTypes,X [8607]LDA CurrentSprites_YPos,X [8609]CLC [860a]ADC SPRITE_HITBOX_HEIGHTS,Y [860d]STA Arg_PixelPosY [860f]INC Arg_PixelPosY [8611]JSR Area_ConvertPixelsToBlockPos [8614]JSR ScreenBuffer_IsBlockImpassable [8617]STA Blocks_Result [8619]LDX a:CurrentSpriteIndex [861c]RTS [861d]BYTE_ARRAY_PRG14__861d:; [$861d] [861d].byte $00; [0]: [861e].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] [861f]LDX a:CurrentSpriteIndex; X = Currently active sprite. [8622]LDA CurrentSprites_Flags,X; A = Current sprite's flags. [8625]AND #$02 [8627]BNE @LAB_PRG14__863d [8629]JSR Sprites_CanMoveDownByHitbox [862c]STA Blocks_Result [862e]BNE @LAB_PRG14__863d [8630]LDX a:CurrentSpriteIndex [8633]LDA CurrentSprites_Flags,X [8636]ORA #$04 [8638]STA CurrentSprites_Flags,X [863b]SEC [863c]RTS [863d]@LAB_PRG14__863d:; [$863d] [863d]LDX a:CurrentSpriteIndex [8640]LDA CurrentSprites_Flags,X [8643]AND #$fb [8645]STA CurrentSprites_Flags,X [8648]CLC [8649]RTS
;============================================================================ ; 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] [864a]LDX a:CurrentSpriteIndex; X = Currently active sprite. [864d]LDA CurrentSprites_Flags,X; A = Current sprite's flags. [8650]AND #$04; Can the sprite move? [8652]BEQ @_done; If not, prepare to return.
; ; This sprite can move. ;
[8654]LDA CurrentSprites_YPos,X; A = Sprite's Y position. [8656]CLC [8657]ADC #$08; A += 8 [8659]STA CurrentSprites_YPos,X; Store as the new position. [865b]CMP #$c0; Is this at the bottom of the screen? [865d]BCS @_clearSprite; If so, jump to clear the sprite.
; ; Make the sprite fall, if it can. ;
[865f]LDX #$03; X = 3 (down direction) [8661]JSR CurrentSprite_CanMoveInDirection; Can the sprite move down? [8664]LDA Blocks_Result; A = result of that check. [8666]BEQ @_done; If not, prepare to return.
; ; Move the sprite down. ;
[8668]LDX a:CurrentSpriteIndex; X = Currently active sprite. [866b]LDA CurrentSprites_YPos,X; A = Sprite's Y position. [866d]AND #$f0; Round to a block position (after the above += 8). [866f]STA CurrentSprites_YPos,X; Store as the new position. [8671]@_done:; [$8671] [8671]LDX a:CurrentSpriteIndex; Restore the current sprite index. [8674]RTS [8675]@_clearSprite:; [$8675] [8675]LDA #$ff [8677]STA CurrentSprites_Entities,X [867a]RTS
;============================================================================ ; 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] [867b]LDA Player_PosX_Block; Load the player's X position.
; ; Check if the player and sprite are in the same X position. ;
[867d]CMP CurrentSprites_XPos_Full,X; Compare to the sprite's X position. [867f]BEQ @_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]ROL A; Rotate the X position left. [8682]AND #$01; And take the right-most bit for the facing bit. [8684]STA Temp_00; Store it.
; ; Set the facing bit for the sprite. ;
[8686]LDA CurrentSprites_Flags,X; Load the sprite's flags. [8689]AND #$fe; Clear the Facing Right bit. [868b]ORA Temp_00; Set Facing Right depending on our rotate above. [868d]STA CurrentSprites_Flags,X; Save it back out. [8690]@_return:; [$8690] [8690]RTS
;============================================================================ ; 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] [8691]LDA Player_PosY
; ; Check if the player and sprite are in the same Y position. ;
[8693]CMP CurrentSprites_YPos,X [8695]BEQ @_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]ROR A [8698]AND #$80 [869a]STA Temp_00
; ; Set the Y directinoal bit for the sprite. ;
[869c]LDA CurrentSprites_Flags,X; Load the sprite's flags. [869f]AND #$7f; Clear the Falling bit. [86a1]ORA Temp_00; Set the Falling bit based on the rotate above. [86a3]STA CurrentSprites_Flags,X; Save it back out. [86a6]@_return:; [$86a6] [86a6]RTS
;============================================================================ ; TODO: Document Sprites_MoveRight ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_CanMoveInDirection ;============================================================================
[86a7]Sprites_MoveRight:; [$86a7] [86a7]LDX CurrentSprites_HitBoxTypes,Y [86aa]LDA CurrentSprites_XPos_Full,Y [86ad]CLC [86ae]ADC SPRITE_HITBOX_WIDTHS,X [86b1]STA Arg_PixelPosX [86b3]BCC Sprites_MoveRight__86c6
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprites_SetBlockIsMovingResult ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__86bd ;============================================================================
[86b5]Sprites_SetBlockIsMovingResult:; [$86b5]
; ; Set the block as moving. ;
[86b5]LDA #$01 [86b7]STA Blocks_Result [86b9]LDX a:CurrentSpriteIndex [86bc]RTS
;============================================================================ ; TODO: Document FUN_PRG14__86bd ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_CanMoveInDirection ;============================================================================
[86bd]FUN_PRG14__86bd:; [$86bd] [86bd]LDA CurrentSprites_XPos_Full,Y [86c0]CMP #$f1 [86c2]BCS Sprites_SetBlockIsMovingResult [86c4]STA Arg_PixelPosX
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprites_MoveRight__86c6 ; ; INPUTS: ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprites_MoveRight ;============================================================================
[86c6]Sprites_MoveRight__86c6:; [$86c6] [86c6]LDA CurrentSprites_YPos,Y [86c9]STA Arg_PixelPosY [86cb]JSR Area_ConvertPixelsToBlockPos [86ce]JSR ScreenBuffer_IsBlockImpassable [86d1]STA Blocks_Result [86d3]BNE @LAB_PRG14__870c [86d5]LDY a:CurrentSpriteIndex [86d8]LDA CurrentSprites_HitBoxTypes,Y [86db]TAY [86dc]LDA SPRITE_HITBOX_HEIGHTS,Y [86df]STA Temp_HitBoxValue [86e1]@LAB_PRG14__86e1:; [$86e1] [86e1]LDA Temp_HitBoxValue [86e3]SEC [86e4]SBC #$10 [86e6]STA Temp_HitBoxValue [86e8]BCC @LAB_PRG14__86f8 [86ea]TXA [86eb]CLC [86ec]ADC #$10 [86ee]TAX [86ef]JSR ScreenBuffer_IsBlockImpassable [86f2]STA Blocks_Result [86f4]BNE @LAB_PRG14__870c [86f6]BEQ @LAB_PRG14__86e1 [86f8]@LAB_PRG14__86f8:; [$86f8] [86f8]LDY a:CurrentSpriteIndex [86fb]LDA CurrentSprites_YPos,Y [86fe]AND #$0f [8700]BEQ @LAB_PRG14__870c [8702]TXA [8703]CLC [8704]ADC #$10 [8706]TAX [8707]JSR ScreenBuffer_IsBlockImpassable [870a]STA Blocks_Result [870c]@LAB_PRG14__870c:; [$870c] [870c]LDX a:CurrentSpriteIndex [870f]RTS
;============================================================================ ; TODO: Document CurrentSprite_CanMoveInDirection ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_HandleFall ; MoveSpriteHorizIfPossible ; MoveSpriteVerticalIfPossible ;============================================================================
[8710]CurrentSprite_CanMoveInDirection:; [$8710] [8710]LDY a:CurrentSpriteIndex [8713]TXA [8714]BEQ FUN_PRG14__86bd [8716]DEX [8717]BEQ Sprites_MoveRight [8719]DEX [871a]BEQ @LAB_PRG14__8731 [871c]LDX CurrentSprites_HitBoxTypes,Y [871f]LDA CurrentSprites_YPos,Y [8722]CLC [8723]ADC SPRITE_HITBOX_HEIGHTS,X [8726]STA Arg_PixelPosY [8728]CMP #$f0 [872a]BCC @LAB_PRG14__873a [872c]@LAB_PRG14__872c:; [$872c] [872c]LDA #$01 [872e]STA Blocks_Result [8730]RTS [8731]@LAB_PRG14__8731:; [$8731] [8731]LDA CurrentSprites_YPos,Y [8734]CMP #$f0 [8736]BCS @LAB_PRG14__872c [8738]STA Arg_PixelPosY [873a]@LAB_PRG14__873a:; [$873a] [873a]LDA CurrentSprites_XPos_Full,Y [873d]STA Arg_PixelPosX [873f]JSR Area_ConvertPixelsToBlockPos [8742]JSR ScreenBuffer_IsBlockImpassable [8745]STA Blocks_Result [8747]BNE @LAB_PRG14__8778 [8749]LDY a:CurrentSpriteIndex [874c]LDA CurrentSprites_HitBoxTypes,Y [874f]TAY [8750]LDA SPRITE_HITBOX_WIDTHS,Y [8753]STA Temp_HitBoxValue [8755]@LAB_PRG14__8755:; [$8755] [8755]LDA Temp_HitBoxValue [8757]SEC [8758]SBC #$10 [875a]STA Temp_HitBoxValue [875c]BCC @LAB_PRG14__8768 [875e]INX [875f]JSR ScreenBuffer_IsBlockImpassable [8762]STA Blocks_Result [8764]BNE @LAB_PRG14__8778 [8766]BEQ @LAB_PRG14__8755 [8768]@LAB_PRG14__8768:; [$8768] [8768]LDY a:CurrentSpriteIndex [876b]LDA CurrentSprites_XPos_Full,Y [876e]AND #$0f [8770]BEQ @LAB_PRG14__8778 [8772]INX [8773]JSR ScreenBuffer_IsBlockImpassable [8776]STA Blocks_Result [8778]@LAB_PRG14__8778:; [$8778] [8778]LDX a:CurrentSpriteIndex [877b]RTS
;============================================================================ ; TODO: Document Player_CheckShieldHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ;============================================================================
[877c]Player_CheckShieldHitByMagic:; [$877c] [877c]LDA a:SelectedShield [877f]CMP #$03 [8781]BCS RETURN_87CA [8783]JSR Maybe_Player_CalcAnimFrame [8786]SEC [8787]SBC #$04 [8789]CMP #$03 [878b]BCC RETURN_87CA [878d]LDX a:CurrentSpriteIndex [8790]LDY CurrentSprites_Entities,X [8793]CPY #$ff [8795]BEQ RETURN_87CA [8797]LDA SPRITE_CATEGORIES_BY_ENTITY,Y [879a]CMP #$06 [879c]BNE RETURN_87CA [879e]LDA a:SpriteBox_Width [87a1]CLC [87a2]ADC #$07 [87a4]STA Temp_00 [87a6]LDA a:Player_ShieldPositionX [87a9]CLC [87aa]ADC #$07 [87ac]SEC [87ad]SBC a:SpriteBox_Left [87b0]CMP Temp_00 [87b2]BCS RETURN_87CA [87b4]LDA a:SpriteBox_Height [87b7]CLC [87b8]ADC #$0f [87ba]STA Temp_00 [87bc]LDA a:Player_ShieldPositionY [87bf]CLC [87c0]ADC #$0f [87c2]SEC [87c3]SBC a:SpriteBox_Top [87c6]CMP Temp_00 [87c8]BCC Player_HandleShieldHitByMagic
; ; XREFS: ; Player_CheckShieldHitByMagic ; Player_HitSpriteWithWeapon ;
[87ca]RETURN_87CA:; [$87ca] [87ca]RTS
;============================================================================ ; TODO: Document Player_HandleShieldHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_CheckShieldHitByMagic ;============================================================================
[87cb]Player_HandleShieldHitByMagic:; [$87cb] [87cb]JSR Player_HandleHitByMagic [87ce]LDX a:CurrentSpriteIndex [87d1]LDA #$ff [87d3]STA CurrentSprites_Entities,X [87d6]LDA #$0c [87d8]JSR Sound_PlayEffect [87db]RTS
;============================================================================ ; TODO: Document Player_HandleHitByMagic ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_HandleShieldHitByMagic ;============================================================================
[87dc]Player_HandleHitByMagic:; [$87dc] [87dc]LDX a:CurrentSpriteIndex [87df]LDY CurrentSprites_Entities,X [87e2]LDA SPRITE_ENTITY_DAMAGES,Y [87e5]LDY a:SelectedShield [87e8]@LAB_PRG14__87e8:; [$87e8] [87e8]LSR A [87e9]DEY [87ea]BPL @LAB_PRG14__87e8 [87ec]STA a:Arg_PlayerHealthDelta_U [87ef]LDA #$00 [87f1]STA a:Arg_PlayerHealthDelta_L [87f4]LDA a:Arg_PlayerHealthDelta_U [87f7]BNE @LAB_PRG14__87fa [87f9]RTS [87fa]@LAB_PRG14__87fa:; [$87fa] [87fa]JSR Player_SetDamagedBySprite [87fd]JMP Player_ReduceHP [8800]DEC CurrentSprites_HitCounter,X [8803]RTS
;============================================================================ ; TODO: Document Player_HitSpriteWithWeapon ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8804]Player_HitSpriteWithWeapon:; [$8804] [8804]JSR Sprites_IsSpriteHidden
; ; Check if the sprite is visible. If so, return. ;
[8807]BNE RETURN_87CA [8809]LDA Player_Flags [880b]BPL RETURN_87CA [880d]LDY PlayerHitsPhaseCounter [880f]DEY [8810]CPY #$02 [8812]BCS RETURN_87CA
; ; Check if the player has a weapon. If not, return. ;
[8814]LDA a:Player_CurWeapon [8817]BMI RETURN_87CA [8819]LDX a:CurrentSpriteIndex [881c]LDY CurrentSprites_Entities,X
; ; Check if the sprite being hit is an enemy. If not, return. ;
[881f]LDA SPRITE_CATEGORIES_BY_ENTITY,Y [8822]BEQ @LAB_PRG14__8828 [8824]CMP #$07 [8826]BNE RETURN_87CA [8828]@LAB_PRG14__8828:; [$8828] [8828]LDA CurrentSprites_XPos_Full,X [882a]STA a:Something_Maybe_WeaponDistanceX [882d]LDA CurrentSprites_YPos,X [882f]STA a:Something_Maybe_WeaponDistanceY [8832]JSR Sprites_IsSpriteOutOfWeaponRange [8835]BCC @LAB_PRG14__883a
; ; The sprite isn't within range. Return. ;
[8837]JMP @_return [883a]@LAB_PRG14__883a:; [$883a] [883a]LDA CurrentSprites_Entities,X [883d]CMP #$05 [883f]BNE @LAB_PRG14__8849
; ; TODO: Figure out why Necron Aides get bit 7 set. ;
[8841]LDA CurrentSprites_Phases,X [8844]ORA #$80 [8846]STA CurrentSprites_Phases,X [8849]@LAB_PRG14__8849:; [$8849] [8849]LDA #$02
; ; Play the Hit Enemy sound. ;
[884b]JSR Sound_PlayEffect
; ; Stop the player from walking. ;
[884e]LDA Player_Flags [8850]AND #$df [8852]STA Player_Flags
; ; Set the flags and hit counter for the sprite. ;
[8854]LDY #$00 [8856]AND #$40 [8858]BEQ @LAB_PRG14__885b [885a]INY [885b]@LAB_PRG14__885b:; [$885b] [885b]STY Temp_00 [885d]LDA CurrentSprites_Flags,X [8860]AND #$fe [8862]ORA Temp_00 [8864]STA CurrentSprites_Flags,X [8867]LDA #$08 [8869]STA CurrentSprites_HitCounter,X [886c]LDY a:Player_CurWeapon
; ; Set the base strength of the equipped weapon. ;
[886f]LDA WEAPON_STRENGTHS,Y [8872]STA Temp_00 [8874]LDA 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]AND #$02 [8879]BNE @_checkGlove [887b]LDA Temp_00 [887d]LSR A [887e]LSR A [887f]CLC [8880]ADC Temp_00 [8882]STA 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] [8884]LDA a:DurationGlove; Load the glove duration. [8887]BMI @_updateSpriteHP; If it's no longer active, jump. [8889]LDA Temp_00; Load the calculated weapon strength. [888b]CLC [888c]ADC WEAPON_TO_GLOVE_STRENGTH,Y; Add the glove strength for the current weapon. [888f]STA 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] [8891]LDA CurrentSprites_HP,X; Load the current HP for this enemy. [8894]SEC [8895]SBC Temp_00; Subtract the current damage. [8897]STA CurrentSprites_HP,X; Store back as the enemy HP.
; ; Check if the sprite is still alive. If so, we're done. ;
[889a]BCS @_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]LDA CurrentSprites_Entities,X [889f]CMP #$18; Compare to Sugata. [88a1]BNE @_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]LDA PPU_Mask; Load the current screen mode. [88a5]AND #$fe; Clear bit 0, setting to greyscale. [88a7]STA PPU_Mask; Store back as the screen mode. [88a9]@_handleEnemyGeneric:; [$88a9] [88a9]LDA #$03; Play sound #3.
; ; Play a sound for the enemy kill, reset state, and add ; experience. ;
[88ab]JSR Sound_PlayEffect [88ae]LDA #$00 [88b0]STA CurrentSprites_HitCounter,X; Clear the hit counter for the dead enemy. [88b3]JSR Player_AddExperienceFromSprite; Add experience for the current sprite.
; ; Check if we killed a standard enemy or a boss. ;
[88b6]LDY CurrentSprites_Entities,X; Load the type of this enemy. [88b9]LDA SPRITE_CATEGORIES_BY_ENTITY,Y [88bc]CMP #$07; Is this a big enemy? [88be]BNE @LAB_PRG14__88c3; If not, jump.
; ; This was a big enemy (a boss). ;
[88c0]JMP Sprite_ShowBigEnemyDeathByMagicOrWeapon; Handle big enemy death cleanup.
; ; This was a standard enemy. ;
[88c3]@LAB_PRG14__88c3:; [$88c3] [88c3]JMP Sprite_ShowNormalEnemyDeathByWeapon; Handle standard enemy death cleanup. [88c6]@_return:; [$88c6] [88c6]RTS
;============================================================================ ; A mapping of weapon types to additional hit power. ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
; ; XREFS: ; Player_HitSpriteWithWeapon ;
[88c7]WEAPON_TO_GLOVE_STRENGTH:; [$88c7] [88c7].byte $02; [0]: Hand Dagger -- 2HP [88c8].byte $04; [1]: Long Sword -- 4HP [88c9].byte $08; [2]: Giant Blade -- 8HP [88ca].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:; [$88cb]
; ; First check the distance in the X position between the ; weapon and the sprite. ;
[88cb]LDA CurrentSprites_Entities,X [88ce]ASL A [88cf]TAY [88d0]LDA MAYBE_SPRITE_EXTENTS,Y [88d3]CLC [88d4]ADC Maybe_WeaponRange_X [88d6]STA Temp_00 [88d8]LDA PlayerPosXPlus10 [88da]CLC
; ; If that wasn't in range... ;
[88db]ADC Maybe_WeaponRange_X [88dd]SEC [88de]SBC a:Something_Maybe_WeaponDistanceX [88e1]CMP Temp_00 [88e3]BCS @_return
; ; Check the distance in the Y direction between the ; weapon and the sprite. ;
[88e5]LDA MAYBE_SPRITE_EXTENTS_1_,Y [88e8]CLC [88e9]ADC Maybe_WeaponRange_Y [88eb]STA Temp_00 [88ed]LDA Maybe_Something_WeaponPosY [88ef]CLC [88f0]ADC Maybe_WeaponRange_Y [88f2]SEC [88f3]SBC a:Something_Maybe_WeaponDistanceY [88f6]CMP Temp_00 [88f8]BCS @_return [88fa]@_return:; [$88fa] [88fa]RTS
;============================================================================ ; 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] [88fb]LDA CurrentSprites_Entities,X; Load the entity at the given index. [88fe]JSR Player_PickUp; Pick up the item. [8901]LDX a:CurrentSpriteIndex; X = current sprite index.
; ; Remove the item from the screen. ;
[8904]LDA #$ff; A = 0xFF (unset) [8906]STA CurrentSprites_Entities,X; Set the entity at this sprite index as 0xFF.
; ; XREFS: ; CurrentSprite_CheckHitPlayer ;
[8909]RETURN_8909:; [$8909] [8909]RTS
;============================================================================ ; TODO: Document CurrentSprite_CheckHitPlayer ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ;============================================================================
[890a]CurrentSprite_CheckHitPlayer:; [$890a] [890a]LDX a:CurrentSpriteIndex [890d]LDA CurrentSprites_Entities,X [8910]CMP #$ff [8912]BEQ RETURN_8909 [8914]JSR Sprites_IsSpriteHidden [8917]BNE RETURN_8998 [8919]LDA a:SpriteBox_Width [891c]CLC [891d]ADC #$0b [891f]STA Temp_00 [8921]LDA Player_PosX_Block [8923]CLC [8924]ADC #$0b [8926]SEC [8927]SBC a:SpriteBox_Left [892a]CMP Temp_00 [892c]BCS RETURN_8998 [892e]LDA a:SpriteBox_Height [8931]CLC [8932]ADC #$1b [8934]STA Temp_00 [8936]LDA Player_PosY [8938]CLC [8939]ADC #$1b [893b]SEC [893c]SBC a:SpriteBox_Top [893f]CMP Temp_00 [8941]BCS RETURN_8998 [8943]LDY CurrentSprites_Entities,X [8946]LDA SPRITE_CATEGORIES_BY_ENTITY,Y [8949]ASL A [894a]TAY [894b]CPY #$10 [894d]BCS Player_HandleCollision_NoOp [894f]LDA SPRITE_COLLISION_HANDLERS+1,Y [8952]PHA [8953]LDA SPRITE_COLLISION_HANDLERS,Y [8956]PHA
; ; XREFS: ; CurrentSprite_CheckHitPlayer ; SPRITE_COLLISION_HANDLERS [$PRG14::895e] ;
[8957]Player_HandleCollision_NoOp:; [$8957] [8957]RTS
;============================================================================ ; Handlers for touching entities in the game. ; ; XREFS: ; CurrentSprite_CheckHitPlayer ;============================================================================
; ; XREFS: ; CurrentSprite_CheckHitPlayer ;
[8958]SPRITE_COLLISION_HANDLERS:; [$8958] [8958]pointer Player_HandleTouchEnemy-1; [0]: [895a]pointer Player_HandleTouchBreadOrCoin-1; [1]: Coin/meat touched [895c]pointer Player_CheckHandlePressUpOnNPC-1; [2]: Press Up on NPC [895e]pointer Player_HandleCollision_NoOp-1; [3]: Large animation. Just return. [8960]pointer Player_HandleTouchNPC-1; [4]: Collide with NPC [8962]pointer Player_HandleTouchItem-1; [5]: Item touched [8964]pointer Player_HandleTouchEnemyMagic-1; [6]: Enemy magic touched [8966]pointer 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:; [$8968]
; ; Check if this is a gold coin or bread. ;
[8968]LDA CurrentSprites_Entities,X; Load the entity for this sprite. [896b]CMP #$01; Is it bread? [896d]BEQ @_isBread; If so, jump.
; ; This is a gold coin. ;
[896f]LDA #$ff [8971]STA CurrentSprites_Entities,X; Clear the sprite. [8974]JMP Player_HandleTouchCoin; Handle touching the gold coin.
; ; This is bread. ;
[8977]@_isBread:; [$8977] [8977]LDA #$ff [8979]STA CurrentSprites_Entities,X; Clear the sprite. [897c]JMP 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:; [$897f]
; ; Check if Up is pressed. ;
[897f]LDA Joy1_ChangedButtonMask; Load the changed button mask. [8981]CMP #$08; Is Up pressed? [8983]BNE 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]LDA CurrentSprites_Values,X; Load the value for the sprite. [8988]STA a:CurrentSprite_Value; Store it as the current value. [898b]CMP #$ff; Is it 0xFF? [898d]BEQ RETURN_8998; If so, return. [898f]JSR MMC1_LoadBankAndJump; Execute the handler. [8992].byte BANK_12_LOGIC; Bank = 12 [8993]pointer IScripts_Begin-1; Address = IScripts_Begin [8995]@_afterFarJump:; [$8995] [8995]LDX a:CurrentSpriteIndex; X = current sprite index
; ; XREFS: ; CurrentSprite_CheckHitPlayer ; Player_CheckHandlePressUpOnNPC ; Player_HandleTouchNPC ;
[8998]RETURN_8998:; [$8998] [8998]RTS
;============================================================================ ; 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] [8999]LDA Player_InvincibilityPhase [899b]BNE RETURN_89AD [899d]LDA a:DurationOintment [89a0]BPL RETURN_89AD [89a2]JSR Player_HandleTouchEnemy [89a5]LDX a:CurrentSpriteIndex [89a8]LDA #$ff [89aa]STA CurrentSprites_Entities,X
; ; XREFS: ; Player_HandleTouchEnemy ; Player_HandleTouchEnemyMagic ;
[89ad]RETURN_89AD:; [$89ad] [89ad]RTS
;============================================================================ ; 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:; [$89ae]
; ; Check if the player currently has iframes. ;
[89ae]LDA Player_InvincibilityPhase; Load the invincibility phase. [89b0]BEQ @_canTakeDamage; If no iframes are available, begin processing the hit. [89b2]RTS; Else, return.
; ; Check if the player has Ointment active. ;
[89b3]@_canTakeDamage:; [$89b3] [89b3]LDA a:DurationOintment; Check the ointment duration. [89b6]BPL RETURN_89AD; If there's time left, no damage will be taken. Return.
; ; Process special enemy handling. ;
[89b8]LDA CurrentSprites_Entities,X; Load the sprite entity that hit the player. [89bb]CMP #$05; Is it the Necron Aides? [89bd]BNE @_handleDamage; If not, perform standard damage handling.
; ; This is the Necron Aides enemy. ;
[89bf]LDA CurrentSprites_Phases,X; Load the phase of the enemy. [89c2]ORA #$80; Set the 7th bit. [89c4]STA CurrentSprites_Phases,X; Store it.
; ; Play the sound effect and process damage. ;
[89c7]@_handleDamage:; [$89c7] [89c7]LDA #$04 [89c9]JSR Sound_PlayEffect; Play the Player Hit sound. [89cc]JSR Player_SetDamagedBySprite; Mark the player as damaged and set state. [89cf]JMP Player_ApplyDamage; Apply damage. [89d2].byte $60; [$89d2] byte
; ; XREFS: ; Player_SetDamagedBySprite ;
[89d3]SPRITES_FACING_VALUE_TO_OPPOSITE_PLAYER_FACING_BITMASK:; [$89d3] [89d3].byte $40; [0]: [89d4].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:; [$89d5]
; ; Set the invincibility phase to 60. ;
[89d5]LDA #$3c [89d7]STA Player_InvincibilityPhase; Set iframes to 60.
; ; Set the player's facing direction to face the enemy. ;
[89d9]LDA CurrentSprites_Flags,X; Load the sprite's current flags. [89dc]AND #$01; Grab the direction bit. [89de]TAY; Set to Y. [89df]LDA Player_Flags; Load the player's flags. [89e1]AND #$bf; Unset the Facing Right bit. [89e3]ORA SPRITES_FACING_VALUE_TO_OPPOSITE_PLAYER_FACING_BITMASK,Y; Set facing to the opposite of the sprite's. [89e6]STA Player_Flags; Store it.
; ; Set knockback on the player. ;
[89e8]LDA Player_StatusFlag; Load the player's status flag. [89ea]ORA #$02; Set knockback. [89ec]STA Player_StatusFlag; Store it. [89ee]RTS
;============================================================================ ; 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] [89ef]LDA CurrentSprites_Values,X; Load the value for this sprite. [89f2]STA a:CurrentSprite_Value; Store as the current sprite's value. [89f5]CMP #$ff; Is it 0xFF (unset)? [89f7]BEQ RETURN_8998; If so, return. [89f9]JSR MMC1_LoadBankAndJump; Else, execute the IScript at that value. [89fc].byte BANK_12_LOGIC; Bank = 12 [89fd]pointer IScripts_Begin-1; Address = IScripts_Begin
; ; Clear this sprite. ;
[89ff]@_afterFarJump:; [$89ff] [89ff]LDX a:CurrentSpriteIndex; X = current sprite index. [8a02]LDA #$ff; A = 0xFF [8a04]STA CurrentSprites_Entities,X; Set the entity at that index to 0xFF. [8a07]RTS
;============================================================================ ; TODO: Document Sprite_GetBounds ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[8a08]Sprite_GetBounds:; [$8a08] [8a08]LDA #$00 [8a0a]STA Temp_Addr_U [8a0c]LDA CurrentSprites_Entities,X [8a0f]ASL A [8a10]ROL Temp_Addr_U [8a12]ASL A [8a13]ROL Temp_Addr_U [8a15]ADC #$73 [8a17]STA Temp_Addr_L [8a19]LDA Temp_Addr_U [8a1b]ADC #$b2 [8a1d]STA Temp_Addr_U [8a1f]LDA CurrentSprites_Entities,X [8a22]CMP #$1f [8a24]BEQ @LAB_PRG14__8a2e [8a26]CMP #$20 [8a28]BEQ @LAB_PRG14__8a40 [8a2a]CMP #$21 [8a2c]BNE Sprite_SetBoundsFromTemp [8a2e]@LAB_PRG14__8a2e:; [$8a2e] [8a2e]LDA CurrentSprites_Phases,X [8a31]CMP #$02 [8a33]BNE Sprite_SetBoundsFromTemp [8a35]LDA #$71 [8a37]STA Temp_Addr_L [8a39]LDA #$8a [8a3b]STA Temp_Addr_U [8a3d]JMP Sprite_SetBoundsFromTemp [8a40]@LAB_PRG14__8a40:; [$8a40] [8a40]LDA CurrentSprites_Phases,X [8a43]BEQ @LAB_PRG14__8a49 [8a45]CMP #$04 [8a47]BNE Sprite_SetBoundsFromTemp [8a49]@LAB_PRG14__8a49:; [$8a49] [8a49]LDA #$75 [8a4b]STA Temp_Addr_L [8a4d]LDA #$8a [8a4f]STA Temp_Addr_U
; ; XREFS: ; Sprite_GetBounds ;
[8a51]Sprite_SetBoundsFromTemp:; [$8a51] [8a51]LDY #$00 [8a53]LDA CurrentSprites_XPos_Full,X [8a55]CLC [8a56]ADC (Temp_Addr_L),Y [8a58]STA a:SpriteBox_Left [8a5b]LDA CurrentSprites_YPos,X [8a5d]CLC [8a5e]INY [8a5f]ADC (Temp_Addr_L),Y [8a61]STA a:SpriteBox_Top [8a64]INY [8a65]LDA (Temp_Addr_L),Y [8a67]STA a:SpriteBox_Width [8a6a]INY [8a6b]LDA (Temp_Addr_L),Y [8a6d]STA a:SpriteBox_Height [8a70]RTS [8a71]SPRITE_GETBOUNDS_COMMON:; [$8a71] [8a71].byte $30; [0]: [8a72].byte $08; [1]: [8a73].byte $f0; [2]: [8a74].byte $00; [3]: [8a75]SPRITE_GETBOUNDS_MASKMAN:; [$8a75] [8a75].byte $20; [0]: [8a76].byte $10; [1]: [8a77].byte $f8; [2]: [8a78].byte $00; [3]:
;============================================================================ ; TODO: Document Player_ApplyDamage ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_HandleTouchEnemy ;============================================================================
[8a79]Player_ApplyDamage:; [$8a79] [8a79]LDY CurrentSprites_Entities,X [8a7c]LDA SPRITE_ENTITY_DAMAGES,Y [8a7f]STA Temp_Addr_U [8a81]STA Temp_05 [8a83]LDA #$00 [8a85]STA Temp_Addr_L [8a87]STA Temp_04 [8a89]LSR Temp_05 [8a8b]ROR Temp_04 [8a8d]LSR Temp_05 [8a8f]ROR Temp_04 [8a91]LSR Temp_05 [8a93]ROR Temp_04
; ; If the player is wearing any armor, apply damage reduction. ;
[8a95]LDY a:SelectedArmor; Load the current armor. [8a98]BEQ @_applyDamage; If it's 0 (leather), then jump. [8a9a]CPY #$04; Is it > 4 (Battle Suit)? [8a9c]BCS @_applyDamage; Then jump.
; ; Apply the armor's defense multiplier. ;
[8a9e]LDA ARMOR_DEFENSE_MULTIPLIERS,Y; Load the multiplier for this armor. [8aa1]TAY; Y = A [8aa2]@LAB_PRG14__8aa2:; [$8aa2] [8aa2]LDA Temp_Addr_L [8aa4]SEC [8aa5]SBC Temp_04 [8aa7]STA Temp_Addr_L [8aa9]LDA Temp_Addr_U [8aab]SBC Temp_05 [8aad]STA Temp_Addr_U [8aaf]DEY [8ab0]BNE @LAB_PRG14__8aa2 [8ab2]@_applyDamage:; [$8ab2] [8ab2]LDA Temp_Addr_L [8ab4]STA a:Arg_PlayerHealthDelta_L [8ab7]LDA Temp_Addr_U [8ab9]STA a:Arg_PlayerHealthDelta_U [8abc]LDA a:SpecialItems [8abf]AND #$01 [8ac1]BEQ @LAB_PRG14__8ad4 [8ac3]LDA a:Arg_PlayerHealthDelta_L [8ac6]SEC [8ac7]SBC Temp_04 [8ac9]STA a:Arg_PlayerHealthDelta_L [8acc]LDA a:Arg_PlayerHealthDelta_U [8acf]SBC Temp_05 [8ad1]STA a:Arg_PlayerHealthDelta_U [8ad4]@LAB_PRG14__8ad4:; [$8ad4] [8ad4]JMP Player_ReduceHP
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8ad7]RETURN_8AD7:; [$8ad7] [8ad7]RTS
;============================================================================ ; Defense multipliers for each armor. ; ; XREFS: ; Player_ApplyDamage ;============================================================================
; ; XREFS: ; Player_ApplyDamage ;
[8ad8]ARMOR_DEFENSE_MULTIPLIERS:; [$8ad8] [8ad8].byte $00; [0]: Leather (0) [8ad9].byte $01; [1]: Studded Mail (1) [8ada].byte $02; [2]: Full Plate (2) [8adb].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:; [$8adc]
; ; Check if there's a valid cast magic type on screen. ;
[8adc]LDA a:CastMagic_Type; Load the cast magic type. [8adf]CMP #$05; Check against the supported magic types. [8ae1]BCS RETURN_8AD7; If not, then return.
; ; Check if the currently-processed sprite is visible on screen. ;
[8ae3]LDX a:CurrentSpriteIndex; Get the current sprite. [8ae6]JSR Sprites_IsSpriteHidden; Check if the sprite is visible. [8ae9]BNE RETURN_8AD7; If not, return.
; ; Check the sprite type. ;
[8aeb]LDA CurrentSprites_Entities,X; Get the type of this sprite. [8aee]CMP #$ff; Is it unset? [8af0]BEQ RETURN_8AD7; If so, return.
; ; Check if this is either a standard or big enemy. ;
[8af2]TAY; Y = A (sprite type) [8af3]LDA SPRITE_CATEGORIES_BY_ENTITY,Y; A = Category type of this sprite [8af6]BEQ @_isEnemy; If it's a standard enemy, jump. [8af8]CMP #$07; Check if it's a big enemy. [8afa]BNE CastMagic_HitHandler_NoOp
; ; Check if the magic overlaps the sprite in the X direction. ;
[8afc]@_isEnemy:; [$8afc] [8afc]LDY a:CastMagic_Type; Load the cast magic type. [8aff]LDA CAST_MAGIC_HIT_WIDTHS,Y; Load the htbox width for the magic. [8b02]STA Temp_01; Store that. [8b04]LDY CurrentSprites_HitBoxTypes,X; Load the hitbox type for the sprite. [8b07]LDA SPRITE_HITBOX_WIDTHS,Y; Get the width of the sprite. [8b0a]CLC [8b0b]ADC Temp_01; Add the hitbox width for this. [8b0d]STA Temp_00; Store that. [8b0f]LDA a:CastMagic_XPos_Full; Load the cast magic X position. [8b12]CLC [8b13]ADC Temp_01; Add the hitbox width. [8b15]SEC [8b16]SBC CurrentSprites_XPos_Full,X; Subtract the sprite X position. [8b18]CMP Temp_00; Compare to the magic hitbox. [8b1a]BCS 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]LDY a:CastMagic_Type; Load the cast magic type. [8b1f]LDA CAST_MAGIC_HIT_HEIGHTS,Y; Load the hitbox height of the magic. [8b22]STA Temp_01; Store that. [8b24]LDY CurrentSprites_HitBoxTypes,X; Load the hitbox type for the sprite. [8b27]LDA SPRITE_HITBOX_HEIGHTS,Y; Get the height of the sprite. [8b2a]CLC [8b2b]ADC Temp_01; Add the hitbox height for this. [8b2d]STA Temp_00; Store that. [8b2f]LDA a:CastMagic_YPos_Full; Load the cast magic Y position. [8b32]CLC [8b33]ADC Temp_01; Add the hitbox height. [8b35]SEC [8b36]SBC CurrentSprites_YPos,X; Subtract the sprite Y position. [8b38]CMP Temp_00; Compare to the magic hitbox. [8b3a]BCS CastMagic_HitHandler_NoOp; If it didn't overlap in the Y position, return.
; ; The magic hit the sprite. Update state on the sprite. ;
[8b3c]LDY a:CastMagic_Type; Load the cast magic type. [8b3f]LDA CAST_MAGIC_HIT_BEHAVIORS,Y; Load the hit behavior for the magic. [8b42]STA CurrentSprites_HitByMagicBehavior,X; Store as the hit behavior for the sprite. [8b45]LDA CAST_MAGIC_HIT_IFRAMES,Y; Load the hit behavior timeframe for the magic. [8b48]STA CurrentSprites_HitByMagicIFrames,X; Store for the sprite.
; ; Update the sprite to face the direction the magic is facing. ;
[8b4b]LDA a:CastMagic_Flags; Load the cast magic flags. [8b4e]ROL A; Get the facing direction of the magic. [8b4f]ROL A [8b50]ROL A [8b51]AND #$01 [8b53]STA Temp_00; Store that. [8b55]LDA CurrentSprites_Flags,X; Load the sprite's flags. [8b58]AND #$fe; Clear the facing direction bit. [8b5a]ORA Temp_00; Set it to match the magic's direction. [8b5c]STA CurrentSprites_Flags,X; Store it back out.
; ; Give the player credit for hitting the enemy with magic. ;
[8b5f]LDY a:CastMagic_Type; Y = Cast magic type. [8b62]JSR Player_HitEnemyWithMagic; Update player state.
; ; Load the magic hit sprite handler for this magic type. ;
[8b65]LDA a:CastMagic_Type; A = Cast magic type. [8b68]ASL A; Update to a word boundary for the lookup table. [8b69]TAY; Y = A [8b6a]LDA CAST_MAGIC_HIT_HANDLERS+1,Y; Load the next address from the lookup table. [8b6d]PHA [8b6e]LDA CAST_MAGIC_HIT_HANDLERS,Y [8b71]PHA
;============================================================================ ; 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] [8b72]RTS
;============================================================================ ; Hitbox widths for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b73]CAST_MAGIC_HIT_WIDTHS:; [$8b73] [8b73].byte $0b; [0]: Deluge (11) [8b74].byte $0b; [1]: Thunder (11) [8b75].byte $1b; [2]: Fire (27) [8b76].byte $0b; [3]: Death (11) [8b77].byte $0b; [4]: Tilte (11)
;============================================================================ ; Hitbox widths for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b78]CAST_MAGIC_HIT_HEIGHTS:; [$8b78] [8b78].byte $0b; [0]: Deluge (11) [8b79].byte $1b; [1]: Thunder (27) [8b7a].byte $0b; [2]: Fire (11) [8b7b].byte $0b; [3]: Death (11) [8b7c].byte $0b; [4]: Tilte (11)
;============================================================================ ; Magic behaviors for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b7d]CAST_MAGIC_HIT_BEHAVIORS:; [$8b7d] [8b7d].byte $00; [0]: Deluge (0) [8b7e].byte $01; [1]: Thunder (1) [8b7f].byte $02; [2]: Fire (2) [8b80].byte $ff; [3]: Death (none) [8b81].byte $ff; [4]: Tilte (none)
;============================================================================ ; Hit iframe time for each magic type. ; ; XREFS: ; Sprite_CheckHitByCastMagic ;============================================================================
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[8b82]CAST_MAGIC_HIT_IFRAMES:; [$8b82] [8b82].byte $04; [0]: Deluge (4) [8b83].byte $08; [1]: Thunder (8) [8b84].byte $ff; [2]: Fire (none) [8b85].byte $ff; [3]: Death (none) [8b86].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] [8b87]LDY CurrentSprites_Entities,X; Load the current enemy sprite type. [8b8a]LDA ENEMY_EXPERIENCE,Y; Load the experience for that type. [8b8d]STA Temp_Int24; Store as the lower byte of the experience. [8b8f]LDA #$00 [8b91]STA Temp_Int24_M; Store 0 as the middle byte. [8b93]JSR Player_UpdateExperience; Update the player's experience. [8b96]LDX a:CurrentSpriteIndex [8b99]RTS
;============================================================================ ; 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] [8b9a]LDA #$09 [8b9c]JSR Sound_PlayEffect; Play sound 9 (coin touched).
; ; Update the lower byte of the gold. ;
[8b9f]LDA a:Gold; Load the lower byte of the gold. [8ba2]CLC [8ba3]ADC CurrentSprites_Values,X; Add the value of the coin; Set Carry = overflow. [8ba6]STA a:Gold; Store as the lower byte.
; ; Update the middle byte of the gold. ;
[8ba9]LDA a:Gold_M; Load the middle byte for the gold. [8bac]ADC #$00; Add with carry, set the carry bit if overflow. [8bae]STA a:Gold_M; Store as the middle byte.
; ; Update the upper byte of the gold. ;
[8bb1]LDA a:Gold_U; Load the upper byte for the gold. [8bb4]ADC #$00; Add with carry, set carry bit if overflow. [8bb6]STA a:Gold_U; Store as the upper byte.
; ; Render and prepare to return. ;
[8bb9]JSR UI_DrawGoldValue; Render the new gold amount. [8bbc]LDX a:CurrentSpriteIndex; Set X = current sprite index. [8bbf]RTS
;============================================================================ ; 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] [8bc0]LDA #$1b [8bc2]JSR Sound_PlayEffect; Play sound 0x1B (pick up meat). [8bc5]LDX a:CurrentSpriteIndex; Load the current sprite index for meat. [8bc8]LDA CurrentSprites_Values,X; Load the HP value for it. [8bcb]JSR Player_AddHP; Add it to the player's HP. [8bce]LDX a:CurrentSpriteIndex [8bd1]RTS
;============================================================================ ; TODO: Document CurrentSprite_UpdateState ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprites_UpdateAllStates ; _updateSpriteState [$PRG14::8040] ;============================================================================
[8bd2]CurrentSprite_UpdateState:; [$8bd2] [8bd2]LDA a:IScript_PortraitID [8bd5]BPL @_return
; ; Check if this sprite is set. ;
[8bd7]LDX a:CurrentSpriteIndex; X = Current sprite index [8bda]LDY CurrentSprites_Entities,X; Y = Current sprite entity [8bdd]BMI @_return; If unset, return.
; ; Check if this sprite is specifically Tamazutsu. It hides and ; won't be affected when hidden. ;
[8bdf]CPY #$2c; Check the sprite against Tamazutsu. [8be1]BEQ @_notTamazutsu; If not, handle the enemy normally.
; ; This is Tamazutsu. Check if it's visible or hiding. ;
[8be3]JSR Sprites_IsSpriteHidden [8be6]BNE @_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] [8be8]LDA CurrentSprites_HitCounter,X [8beb]AND #$02 [8bed]BNE @_return
; ; Update sprite state. ;
[8bef]LDA CurrentSprites_XPos_Full,X [8bf1]STA Arg_DrawSprite_PosX [8bf3]LDA CurrentSprites_YPos,X [8bf5]STA Arg_DrawSprite_PosY [8bf7]LDA Screen_Maybe_ScrollXCounter [8bf9]STA Unused_Sprite_ScrollPosX [8bfb]LDA Player_Something_ScrollPosY [8bfd]STA Unused_Sprite_ScrollPosY [8bff]LDA CurrentSprites_PPUOffsets,X [8c02]STA Sprites_PPUOffset [8c04]JSR CurrentSprite_CalculateVisibility [8c07]LDX a:CurrentSpriteIndex [8c0a]LDA CurrentSprites_Entities,X [8c0d]ASL A [8c0e]TAY [8c0f]LDA SPRITE_UPDATE_HANDLERS+1,Y [8c12]PHA [8c13]LDA SPRITE_UPDATE_HANDLERS,Y [8c16]PHA [8c17]@_return:; [$8c17] [8c17]RTS
;============================================================================ ; 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] [8c18].byte $00; [0]: [8c19].byte $40; [1]:
;============================================================================ ; TODO: Document CurrentSprite_CalculateVisibility ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; CurrentSprite_UpdateState ;============================================================================
[8c1a]CurrentSprite_CalculateVisibility:; [$8c1a] [8c1a]LDX a:CurrentSpriteIndex [8c1d]LDA #$00 [8c1f]STA Temp_MovingSpriteVisibility
; ; Get the Y position of the current sprite and store ; as an argument for the ConvertPixelsToBlockPos() call. ;
[8c21]LDA CurrentSprites_YPos,X [8c23]STA Arg_PixelPosY
; ; Get the X position of the current sprite and store ; as an argument for the ConvertPixelsToBlockPos() call. ;
[8c25]LDA CurrentSprites_XPos_Full,X [8c27]CLC [8c28]ADC #$04 [8c2a]STA Arg_PixelPosX
; ; Convert to a block position. ;
[8c2c]JSR Area_ConvertPixelsToBlockPos [8c2f]JSR ScreenBuffer_LoadBlockProperty [8c32]CMP #$04 [8c34]BEQ @LAB_PRG14__8c3e [8c36]CMP #$0d [8c38]BEQ @LAB_PRG14__8c3e [8c3a]CMP #$09 [8c3c]BNE @LAB_PRG14__8c44 [8c3e]@LAB_PRG14__8c3e:; [$8c3e] [8c3e]LDA Temp_MovingSpriteVisibility [8c40]ORA #$01 [8c42]STA Temp_MovingSpriteVisibility [8c44]@LAB_PRG14__8c44:; [$8c44] [8c44]LDX a:CurrentSpriteIndex [8c47]LDA CurrentSprites_XPos_Full,X [8c49]CLC [8c4a]ADC #$0c [8c4c]STA Arg_PixelPosX [8c4e]JSR Area_ConvertPixelsToBlockPos [8c51]JSR ScreenBuffer_LoadBlockProperty [8c54]CMP #$04 [8c56]BEQ @LAB_PRG14__8c60 [8c58]CMP #$0d [8c5a]BEQ @LAB_PRG14__8c60 [8c5c]CMP #$09 [8c5e]BNE @LAB_PRG14__8c66 [8c60]@LAB_PRG14__8c60:; [$8c60] [8c60]LDA Temp_MovingSpriteVisibility [8c62]ORA #$02 [8c64]STA Temp_MovingSpriteVisibility [8c66]@LAB_PRG14__8c66:; [$8c66] [8c66]LDX a:CurrentSpriteIndex [8c69]LDA CurrentSprites_Flags,X [8c6c]AND #$01 [8c6e]BEQ @LAB_PRG14__8c7d [8c70]LDA Temp_MovingSpriteVisibility [8c72]BEQ Something_SetDAT26 [8c74]CMP #$03 [8c76]BEQ Something_SetDAT26 [8c78]EOR #$03 [8c7a]JMP Something_SetDAT26 [8c7d]@LAB_PRG14__8c7d:; [$8c7d] [8c7d]LDA Temp_MovingSpriteVisibility
; ; XREFS: ; CurrentSprite_CalculateVisibility ;
[8c7f]Something_SetDAT26:; [$8c7f] [8c7f]STA MovingSpriteVisibility [8c81]RTS
;============================================================================ ; 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] [8c82]LDA CurrentSprites_Flags,X; Load flags for this sprite. [8c85]AND #$01; AND for the facing bit. [8c87]TAY; Y = result [8c88]LDA SPRITES_FACING_TO_FLIPMASK,Y; Load the bitmask from the mapping table. [8c8b]STA CurrentSprite_FlipMask; Store it. [8c8d]RTS
;============================================================================ ; 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] [8c8e]CLC [8c8f]LDY CurrentSprites_Entities,X [8c92]ADC SPRITE_APPEARANCE_PHASE_OFFSETS,Y [8c95]JMP 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] [8c98]LDA #$00 [8c9a]STA Sprites_PPUOffset [8c9c]STA MovingSpriteVisibility [8c9e]RTS
;============================================================================ ; Offsets into TILEINFO_ENTITY_ADDRS for each entity. ; ; XREFS: ; Sprite_EnterNextAppearancePhase ;============================================================================
; ; XREFS: ; Sprite_EnterNextAppearancePhase ;
[8c9f]SPRITE_APPEARANCE_PHASE_OFFSETS:; [$8c9f] [8c9f].byte $00; [0]: [8ca0].byte $db; [1]: Dropped: Bread [8ca1].byte $93; [2]: Dropped: Coin [8ca2].byte $83; [3]: Enemy: ? [8ca3].byte $01; [4]: Enemy: Raiden [8ca4].byte $05; [5]: Enemy: Necron Aides [8ca5].byte $07; [6]: Enemy: Zombie [8ca6].byte $0a; [7]: Enemy: Hornet [8ca7].byte $0c; [8]: Enemy: Bihoruda [8ca8].byte $0e; [9]: Enemy: Lilith [8ca9].byte $ef; [10]: Magic: ? [8caa].byte $13; [11]: Enemy: Yuinaru [8cab].byte $15; [12]: Enemy: Snowman [8cac].byte $17; [13]: Enemy: Nash [8cad].byte $1a; [14]: Enemy: Fire Giant [8cae].byte $1d; [15]: Enemy: Ishiisu [8caf].byte $21; [16]: Enemy: Execution Hood [8cb0].byte $71; [17]: Boss: Rokusutahn [8cb1].byte $6c; [18]: Boss: unused (round body of snake boss) [8cb2].byte $a9; [19]: Effect: Enemy death [8cb3].byte $a9; [20]: Effect: Lightning ball [8cb4].byte $23; [21]: Enemy: Charron [8cb5].byte $00; [22]: Enemy: ? (Unused) [8cb6].byte $26; [23]: Enemy: Geributa [8cb7].byte $29; [24]: Enemy: Sugata [8cb8].byte $2b; [25]: Enemy: Grimlock [8cb9].byte $2f; [26]: Enemy: Giant Bees [8cba].byte $31; [27]: Enemy: Myconid [8cbb].byte $33; [28]: Enemy: Naga [8cbc].byte $35; [29]: Enemy: Skeleton Knight (unused) [8cbd].byte $39; [30]: Enemy: Giant Strider [8cbe].byte $3c; [31]: Enemy: Sir Gawaine [8cbf].byte $3f; [32]: Enemy: Maskman [8cc0].byte $44; [33]: Enemy: Wolfman [8cc1].byte $47; [34]: Enemy: Yareeka [8cc2].byte $49; [35]: Enemy: Magman [8cc3].byte $4b; [36]: Enemy: Curly-tailed guy with spear (unused) [8cc4].byte $00; [37]: Enemy: ? (unused) [8cc5].byte $4f; [38]: Enemy: Ikeda [8cc6].byte $52; [39]: Enemy: Muppet guy (unused) [8cc7].byte $54; [40]: Enemy: Lamprey [8cc8].byte $00; [41]: Enemy: ? (unused) [8cc9].byte $58; [42]: Enemy: Monodron [8cca].byte $5b; [43]: Enemy: Winged skeleton (unused) [8ccb].byte $5d; [44]: Enemy: Tamazutsu [8ccc].byte $79; [45]: Boss: Ripasheiku [8ccd].byte $75; [46]: Boss: Zoradohna [8cce].byte $64; [47]: Boss: Borabohra [8ccf].byte $7d; [48]: Boss: Pakukame [8cd0].byte $83; [49]: Boss: Zorugeriru [8cd1].byte $80; [50]: Boss: King Grieve [8cd2].byte $89; [51]: Boss: Shadow Eura [8cd3].byte $ae; [52]: NPC: Walking Man 1 [8cd4].byte $b1; [53]: NPC: Blue lady (unused) [8cd5].byte $b4; [54]: NPC: Child (unused) [8cd6].byte $b7; [55]: NPC: Armor Salesman [8cd7].byte $b9; [56]: NPC: Martial Artist [8cd8].byte $bb; [57]: NPC: Guru [8cd9].byte $bd; [58]: NPC: King [8cda].byte $c1; [59]: NPC: Magic Teacher [8cdb].byte $c3; [60]: NPC: Key Salesman [8cdc].byte $c5; [61]: NPC: Smoking Man [8cdd].byte $c7; [62]: NPC: Man in Chair [8cde].byte $c9; [63]: NPC: Sitting Man [8cdf].byte $cb; [64]: NPC: Meat Salesman [8ce0].byte $cd; [65]: NPC: Lady in Blue Dress with Cup [8ce1].byte $cf; [66]: NPC: Guard [8ce2].byte $d1; [67]: NPC: Doctor [8ce3].byte $d3; [68]: NPC: Walking Woman 1 [8ce4].byte $d5; [69]: NPC: Walking Woman 2 [8ce5].byte $d7; [70]: Enemy: Eyeball (unused) [8ce6].byte $d9; [71]: Enemy: Zozura [8ce7].byte $dc; [72]: Item: Glove [8ce8].byte $dd; [73]: Item: Black Onyx [8ce9].byte $de; [74]: Item: Pendant [8cea].byte $df; [75]: Item: Red Potion [8ceb].byte $e0; [76]: Item: Poison [8cec].byte $e1; [77]: Item: Elixir [8ced].byte $e2; [78]: Item: Ointment [8cee].byte $00; [79]: Trigger: Intro [8cef].byte $e3; [80]: Item: Mattock [8cf0].byte $f1; [81]: Magic: ? [8cf1].byte $e8; [82]: Effect: Fountain [8cf2].byte $f3; [83]: Magic: ? [8cf3].byte $95; [84]: Magic: Enemy Fireball [8cf4].byte $f6; [85]: Item: Wing Boots [8cf5].byte $f7; [86]: Item: Hour Glass [8cf6].byte $f8; [87]: Item: Magical Rod [8cf7].byte $f9; [88]: Item: Battle Suit [8cf8].byte $fa; [89]: Item: Battle Helmet [8cf9].byte $fb; [90]: Item: Dragon Slayer [8cfa].byte $e3; [91]: Item: Mattock [8cfb].byte $f6; [92]: Item: Wing Boots (from quest) [8cfc].byte $df; [93]: Item: Red Potion [8cfd].byte $e0; [94]: Item: Poison [8cfe].byte $dc; [95]: Item: Glove [8cff].byte $e2; [96]: Item: Ointment [8d00].byte $e8; [97]: Effect: Spring of Trunk [8d01].byte $e8; [98]: Effect: Spring of Sky [8d02].byte $e8; [99]: Effect: Spring of Tower [8d03].byte $a9; [100]: Effect: Boss Death
;============================================================================ ; TODO: Document SpriteBehavior_MaybeFallingRocks__ClearEntity ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_BounceAndExpire ;============================================================================
[8d04]SpriteBehavior_MaybeFallingRocks__ClearEntity:; [$8d04] [8d04]LDA #$ff [8d06]STA CurrentSprites_Entities,X [8d09]RTS
;============================================================================ ; TODO: Document SpriteBehavior_BounceAndExpire ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5eb] ;============================================================================
[8d0a]SpriteBehavior_BounceAndExpire:; [$8d0a] [8d0a]JSR Sprite_IsBehaviorNotReady [8d0d]BNE @LAB_PRG14__8d22 [8d0f]LDA #$00 [8d11]STA CurrentSprites_Phases,X [8d14]STA CurrentSprites_InternalBehaviorStates,X [8d17]STA CurrentSprites_PPUOffsets,X [8d1a]LDA #$80 [8d1c]STA CurrentSprites_Flags,X [8d1f]JSR Sprite_SetBehaviorReady [8d22]@LAB_PRG14__8d22:; [$8d22] [8d22]INC CurrentSprites_InternalBehaviorStates,X [8d25]BEQ SpriteBehavior_MaybeFallingRocks__ClearEntity [8d27]LDY CurrentSprites_Phases,X [8d2a]BNE @LAB_PRG14__8d4c [8d2c]LDA #$04 [8d2e]STA a:Arg_DeltaY_Full [8d31]LDA #$00 [8d33]STA a:Arg_DeltaY_Frac [8d36]JSR Sprite_MoveVertical [8d39]BCC @_return1 [8d3b]INC CurrentSprites_Phases,X [8d3e]LDA #$20 [8d40]STA CurrentSprites_BehaviorData3,X [8d43]LDA CurrentSprites_Flags,X [8d46]AND #$7f [8d48]STA CurrentSprites_Flags,X [8d4b]@_return1:; [$8d4b] [8d4b]RTS [8d4c]@LAB_PRG14__8d4c:; [$8d4c] [8d4c]LDA CurrentSprites_BehaviorData3,X [8d4f]LDY #$03 [8d51]JSR Sprites_CalcYFromGravity [8d54]LDY #$04 [8d56]JSR Sprites_CalcVerticalSpriteMovement [8d59]JSR Sprite_MoveVertical [8d5c]LDA CurrentSprites_Phases,X [8d5f]TAY [8d60]INC CurrentSprites_BehaviorData3,X [8d63]LDA CurrentSprites_BehaviorData3,X [8d66]AND #$1f [8d68]BNE @_return2 [8d6a]JSR BScript_Action_FlipYDirection [8d6d]@_return2:; [$8d6d] [8d6d]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Coin ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808b] ;============================================================================
[8d6e]SpriteUpdateHandler_Coin:; [$8d6e] [8d6e]LDA #$00 [8d70]STA CurrentSprite_FlipMask [8d72]LDY #$00 [8d74]LDA CurrentSprites_InternalBehaviorStates,X [8d77]AND #$08 [8d79]BEQ @LAB_PRG14__8d7c [8d7b]INY [8d7c]@LAB_PRG14__8d7c:; [$8d7c] [8d7c]TYA [8d7d]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Raiden ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808f] ;============================================================================
[8d80]SpriteUpdateHandler_Enemy_Raiden:; [$8d80] [8d80]JSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8d83]LDY #$00 [8d85]LDA CurrentSprites_Phases,X; Load the current phase. [8d88]CMP #$02; Is it 2? [8d8a]BEQ @_isPhase2; If so, jump. [8d8c]LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8d8f]LSR A; Divide by 4. [8d90]LSR A [8d91]AND #$01; Use the odd/even bit as the phase, giving phases 0 or 1. [8d93]JMP Sprite_EnterNextAppearancePhase; Set that as the new phase. [8d96]@_isPhase2:; [$8d96] [8d96]LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8d99]LSR A; Divide by 8. [8d9a]LSR A [8d9b]LSR A [8d9c]AND #$01; Keep the odd/even bit for the phase. [8d9e]ORA #$02; And OR with 2, giving phases 2 or 3. [8da0]JMP 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] [8da3]JSR Sprite_IsBehaviorNotReady [8da6]BNE @LAB_PRG14__8db3 [8da8]LDA #$00 [8daa]STA CurrentSprites_BehaviorData2,X [8dad]STA CurrentSprites_BehaviorData3,X [8db0]JSR Sprite_SetBehaviorReady [8db3]@LAB_PRG14__8db3:; [$8db3] [8db3]LDX a:CurrentSpriteIndex [8db6]LDA CurrentSprites_Phases,X [8db9]BMI @LAB_PRG14__8e0e [8dbb]LDA CurrentSprites_Flags,X [8dbe]ROL A [8dbf]ROL A [8dc0]AND #$01 [8dc2]TAY [8dc3]LDA CurrentSprites_YPos,X [8dc5]CLC [8dc6]ADC BYTE_ARRAY_PRG14__8e3a,Y [8dc9]STA Arg_PixelPosY [8dcb]LDA CurrentSprites_XPos_Full,X [8dcd]STA Arg_PixelPosX [8dcf]JSR Area_ConvertPixelsToBlockPos [8dd2]JSR ScreenBuffer_LoadBlockProperty [8dd5]LDX a:CurrentSpriteIndex [8dd8]CMP #$02 [8dda]BEQ @LAB_PRG14__8de4 [8ddc]LDA CurrentSprites_Flags,X [8ddf]EOR #$80 [8de1]STA CurrentSprites_Flags,X [8de4]@LAB_PRG14__8de4:; [$8de4] [8de4]LDA a:SpriteUpdateCounter [8de7]CMP #$17 [8de9]BEQ @LAB_PRG14__8def [8deb]CMP #$75 [8ded]BNE @LAB_PRG14__8df7 [8def]@LAB_PRG14__8def:; [$8def] [8def]LDA CurrentSprites_Flags,X [8df2]EOR #$80 [8df4]STA CurrentSprites_Flags,X [8df7]@LAB_PRG14__8df7:; [$8df7] [8df7]LDA a:SpriteUpdateCounter [8dfa]LSR A [8dfb]LSR A [8dfc]AND #$03 [8dfe]TAY [8dff]LDA BYTE_ARRAY_PRG14__8e3c,Y [8e02]STA a:Arg_DeltaY_Frac [8e05]LDA BYTE_ARRAY_PRG14__8e40,Y [8e08]STA a:Arg_DeltaY_Full [8e0b]JMP Sprite_CalculateNewVertPos [8e0e]@LAB_PRG14__8e0e:; [$8e0e] [8e0e]JSR Sprites_SetCurrentSpriteCanMove [8e11]BCC @LAB_PRG14__8e16 [8e13]JMP CurrentSprite_HandleFall [8e16]@LAB_PRG14__8e16:; [$8e16] [8e16]LDA a:SpriteUpdateCounter [8e19]CMP #$26 [8e1b]BEQ @LAB_PRG14__8e25 [8e1d]CMP #$48 [8e1f]BEQ @LAB_PRG14__8e25 [8e21]CMP #$93 [8e23]BNE @LAB_PRG14__8e2d [8e25]@LAB_PRG14__8e25:; [$8e25] [8e25]LDA CurrentSprites_Flags,X [8e28]EOR #$01 [8e2a]STA CurrentSprites_Flags,X [8e2d]@LAB_PRG14__8e2d:; [$8e2d] [8e2d]LDA #$00 [8e2f]STA a:Arg_DeltaX_Frac [8e32]LDA #$01 [8e34]STA a:Arg_DeltaX_Full [8e37]JMP Sprites_Something_SomethingAndMoveHoriz
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e3a]BYTE_ARRAY_PRG14__8e3a:; [$8e3a] [8e3a].byte $ff; [0]: [8e3b].byte $20; [1]:
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e3c]BYTE_ARRAY_PRG14__8e3c:; [$8e3c] [8e3c].byte $20; [0]: [8e3d].byte $40; [1]: [8e3e].byte $80; [2]: [8e3f].byte $00; [3]:
; ; XREFS: ; SpriteBehavior_NecronAides ;
[8e40]BYTE_ARRAY_PRG14__8e40:; [$8e40] [8e40].byte $00; [0]: [8e41].byte $00; [1]: [8e42].byte $00; [2]: [8e43].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_NecronAides ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8091] ;============================================================================
[8e44]SpriteUpdateHandler_Enemy_NecronAides:; [$8e44] [8e44]JSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8e47]LDA a:SpriteUpdateCounter; Load the sprite's update counter. [8e4a]LSR A; Divide it by 4. [8e4b]LSR A [8e4c]LDY CurrentSprites_Phases,X; Load the current sprite phase. [8e4f]BMI @_setPhase; If unset, jump. [8e51]LSR A; Divide again by 2 (total of 8). [8e52]@_setPhase:; [$8e52] [8e52]AND #$01; Keep the odd/even bit, yielding a phase of 0 or 1. [8e54]JMP 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] [8e57]JSR CurrentSprite_UpdateFlipMask; Update the flip mask for the sprite based on its facing direction. [8e5a]LDY #$00 [8e5c]JSR Sprite_GetPreviousSpritePhase; Get the previous phase for the sprite. [8e5f]LSR A; Divide it by 2. [8e60]BCS @LAB_PRG14__8e6f [8e62]LDA a:SpriteUpdateCounter [8e65]LSR A [8e66]LSR A [8e67]LSR A [8e68]AND #$03 [8e6a]TAY [8e6b]LDA SPRITEBEHAVIOR_ENEMY_ZOMBIE_PHASES,Y [8e6e]TAY [8e6f]@LAB_PRG14__8e6f:; [$8e6f] [8e6f]TYA [8e70]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Zombie ;
[8e73]SPRITEBEHAVIOR_ENEMY_ZOMBIE_PHASES:; [$8e73] [8e73].byte $00; [0]: [8e74].byte $01; [1]: [8e75].byte $02; [2]: [8e76].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_BuzzAround ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a665] ;============================================================================
[8e77]SpriteBehavior_BuzzAround:; [$8e77] [8e77]JSR Sprite_IsBehaviorNotReady [8e7a]BNE @LAB_PRG14__8e87 [8e7c]LDA #$00 [8e7e]STA CurrentSprites_Phases,X [8e81]STA CurrentSprites_BehaviorData2,X [8e84]JSR Sprite_SetBehaviorReady [8e87]@LAB_PRG14__8e87:; [$8e87] [8e87]LDA #$00 [8e89]STA a:Arg_DeltaX_Frac [8e8c]LDA #$02 [8e8e]STA a:Arg_DeltaX_Full [8e91]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [8e94]LDA CurrentSprites_BehaviorData2,X [8e97]LSR A [8e98]LSR A [8e99]LSR A [8e9a]AND #$07 [8e9c]TAY [8e9d]LDA SPRITE_BEHAVIOR_BUZZ_AROUND_Y_FRAC,Y [8ea0]STA a:Arg_DeltaY_Frac [8ea3]LDA SPRITE_BEHAVIOR_BUZZ_AROUND_X_FRAC,Y [8ea6]STA a:Arg_DeltaY_Full [8ea9]JSR Sprite_MoveVertAndFlipIfNeeded [8eac]INC CurrentSprites_BehaviorData2,X; Increment the sprite's tick counter. [8eaf]RTS
; ; XREFS: ; SpriteBehavior_BuzzAround ;
[8eb0]SPRITE_BEHAVIOR_BUZZ_AROUND_Y_FRAC:; [$8eb0] [8eb0].byte $00; [0]: [8eb1].byte $00; [1]: [8eb2].byte $80; [2]: [8eb3].byte $40; [3]: [8eb4].byte $00; [4]: [8eb5].byte $40; [5]: [8eb6].byte $80; [6]: [8eb7].byte $00; [7]:
; ; XREFS: ; SpriteBehavior_BuzzAround ;
[8eb8]SPRITE_BEHAVIOR_BUZZ_AROUND_X_FRAC:; [$8eb8] [8eb8].byte $02; [0]: [8eb9].byte $01; [1]: [8eba].byte $00; [2]: [8ebb].byte $00; [3]: [8ebc].byte $00; [4]: [8ebd].byte $00; [5]: [8ebe].byte $00; [6]: [8ebf].byte $01; [7]: [8ec0].byte $ff,$01; [$8ec0] undefined
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Hornet ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8095] ;============================================================================
[8ec2]SpriteUpdateHandler_Enemy_Hornet:; [$8ec2] [8ec2]JSR CurrentSprite_UpdateFlipMask [8ec5]LDA a:SpriteUpdateCounter [8ec8]LSR A [8ec9]LSR A [8eca]AND #$01 [8ecc]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Bihoruda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a615] ;============================================================================
[8ecf]SpriteBehavior_Bihoruda:; [$8ecf] [8ecf]JSR Sprite_IsBehaviorNotReady [8ed2]BNE @LAB_PRG14__8ee1 [8ed4]LDA #$00 [8ed6]STA CurrentSprites_BehaviorData2,X [8ed9]LDA #$40 [8edb]STA CurrentSprites_BehaviorData3,X [8ede]JSR Sprite_SetBehaviorReady [8ee1]@LAB_PRG14__8ee1:; [$8ee1] [8ee1]LDA CurrentSprites_BehaviorData2,X [8ee4]LDY #$02 [8ee6]JSR Sprites_CalcYFromGravity [8ee9]LDY #$03 [8eeb]JSR Sprites_CalcHorizSpriteMovement [8eee]LDA a:Arg_DeltaX_Full [8ef1]AND #$01 [8ef3]STA a:Arg_DeltaX_Full [8ef6]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [8ef9]INC CurrentSprites_BehaviorData2,X [8efc]LDA CurrentSprites_BehaviorData3,X [8eff]LDY #$02 [8f01]JSR Sprites_CalcYFromGravity [8f04]LDY #$03 [8f06]JSR Sprites_CalcVerticalSpriteMovement [8f09]LDA a:Arg_DeltaY_Full [8f0c]AND #$01 [8f0e]STA a:Arg_DeltaY_Full [8f11]JSR Sprite_MoveVertAndFlipIfNeeded [8f14]INC CurrentSprites_BehaviorData3,X [8f17]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Bihoruda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8097] ;============================================================================
[8f18]SpriteUpdateHandler_Enemy_Bihoruda:; [$8f18] [8f18]JSR CurrentSprite_UpdateFlipMask [8f1b]LDY #$00 [8f1d]LDA CurrentSprites_BehaviorData2,X [8f20]AND #$7f [8f22]SEC [8f23]SBC #$30 [8f25]CMP #$30 [8f27]BCC @LAB_PRG14__8f2a [8f29]INY [8f2a]@LAB_PRG14__8f2a:; [$8f2a] [8f2a]TYA [8f2b]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Lilith ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a617] ;============================================================================
[8f2e]SpriteBehavior_Lilith:; [$8f2e] [8f2e]JSR Sprite_IsBehaviorNotReady [8f31]BNE @LAB_PRG14__8f51 [8f33]LDA #$00 [8f35]STA CurrentSprites_BehaviorData2,X [8f38]STA CurrentSprites_BehaviorData3,X [8f3b]STA CurrentSprites_Phases,X [8f3e]LDA CurrentSprites_Flags,X [8f41]ORA #$80 [8f43]STA CurrentSprites_Flags,X [8f46]LDA #$3c [8f48]STA CurrentSprites_InternalBehaviorStates,X [8f4b]JSR Sprite_SetBehaviorReady [8f4e]JSR BScript_Action_RandomlyFlipXDirection [8f51]@LAB_PRG14__8f51:; [$8f51] [8f51]LDY CurrentSprites_Phases,X [8f54]BEQ @LAB_PRG14__8f59 [8f56]JMP SpriteBehavior__8f9a [8f59]@LAB_PRG14__8f59:; [$8f59] [8f59]LDA #$01 [8f5b]STA a:Arg_DeltaX_Full [8f5e]LDA #$00 [8f60]STA a:Arg_DeltaX_Frac [8f63]JSR Sprites_Something_SomethingAndMoveHoriz [8f66]LDY #$05 [8f68]LDA CurrentSprites_BehaviorData3,X [8f6b]JSR Sprites_CalcYFromGravity [8f6e]LDY #$05 [8f70]JSR Sprites_CalcVerticalSpriteMovement [8f73]JSR Sprite_CalculateNewVertPos [8f76]INC CurrentSprites_BehaviorData3,X [8f79]LDA CurrentSprites_BehaviorData3,X [8f7c]AND #$0f [8f7e]BNE @LAB_PRG14__8f83 [8f80]JSR BScript_Action_FlipYDirection [8f83]@LAB_PRG14__8f83:; [$8f83] [8f83]DEC CurrentSprites_InternalBehaviorStates,X [8f86]BNE @_return [8f88]INC CurrentSprites_Phases,X [8f8b]JSR BScript_Action_FacePlayerX [8f8e]JSR BScript_Action_FacePlayerY [8f91]LDA #$00 [8f93]STA CurrentSprites_BehaviorData2,X [8f96]STA CurrentSprites_BehaviorData3,X [8f99]@_return:; [$8f99] [8f99]RTS
; ; XREFS: ; SpriteBehavior_Lilith ;
[8f9a]SpriteBehavior__8f9a:; [$8f9a] [8f9a]LDA CurrentSprites_BehaviorData2,X [8f9d]LDY #$03 [8f9f]JSR Sprites_CalcYFromGravity [8fa2]LDY #$04 [8fa4]JSR Sprites_CalcHorizSpriteMovement [8fa7]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [8faa]INC CurrentSprites_BehaviorData2,X [8fad]LDA CurrentSprites_BehaviorData2,X [8fb0]AND #$3f [8fb2]BNE @LAB_PRG14__8fb7 [8fb4]JSR BScript_Action_FacePlayerX [8fb7]@LAB_PRG14__8fb7:; [$8fb7] [8fb7]INC CurrentSprites_BehaviorData3,X [8fba]LDA CurrentSprites_BehaviorData3,X [8fbd]CMP #$27 [8fbf]BEQ @LAB_PRG14__8fc9 [8fc1]LDA #$00 [8fc3]STA CurrentSprites_BehaviorData3,X [8fc6]JSR BScript_Action_FacePlayerY [8fc9]@LAB_PRG14__8fc9:; [$8fc9] [8fc9]LDA #$01 [8fcb]STA a:Arg_DeltaY_Full [8fce]LDA #$00 [8fd0]STA a:Arg_DeltaY_Frac [8fd3]JMP Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [8fd6]@_return:; [$8fd6] [8fd6]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[8fd7]FUN_PRG14__8fd7:; [$8fd7] [8fd7]LDA #$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] [8fd9]JSR CurrentSprite_UpdateFlipMask [8fdc]LDA a:SpriteUpdateCounter [8fdf]LSR A [8fe0]LSR A [8fe1]LSR A [8fe2]AND #$01 [8fe4]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Yuinaru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a619] ;============================================================================
[8fe7]SpriteBehavior_Yuinaru:; [$8fe7] [8fe7]JSR Sprite_IsBehaviorNotReady [8fea]BNE @LAB_PRG14__8ff9 [8fec]LDA #$00 [8fee]STA CurrentSprites_BehaviorData2,X [8ff1]LDA #$80 [8ff3]STA CurrentSprites_BehaviorData3,X [8ff6]JSR Sprite_SetBehaviorReady [8ff9]@LAB_PRG14__8ff9:; [$8ff9] [8ff9]LDA CurrentSprites_BehaviorData2,X [8ffc]LDY #$01 [8ffe]JSR Sprites_CalcYFromGravity [9001]LDY #$03 [9003]JSR Sprites_CalcHorizSpriteMovement [9006]LDA a:Arg_DeltaX_Full [9009]AND #$03 [900b]STA a:Arg_DeltaX_Full [900e]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9011]INC CurrentSprites_BehaviorData2,X [9014]LDA CurrentSprites_BehaviorData3,X [9017]LDA CurrentSprites_BehaviorData3,X [901a]LDY #$02 [901c]JSR Sprites_CalcYFromGravity [901f]LDY #$03 [9021]JSR Sprites_CalcVerticalSpriteMovement [9024]LDA a:Arg_DeltaY_Full [9027]AND #$01 [9029]STA a:Arg_DeltaY_Full [902c]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [902f]INC CurrentSprites_BehaviorData3,X [9032]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Yuinaru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809d] ;============================================================================
[9033]SpriteUpdateHandler_Enemy_Yuinaru:; [$9033] [9033]JSR CurrentSprite_UpdateFlipMask [9036]LDY #$00 [9038]LDA CurrentSprites_BehaviorData2,X [903b]AND #$08 [903d]BEQ @LAB_PRG14__9040 [903f]INY [9040]@LAB_PRG14__9040:; [$9040] [9040]TYA [9041]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Snowman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809f] ;============================================================================
[9044]SpriteUpdateHandler_Enemy_Snowman:; [$9044] [9044]JSR CurrentSprite_UpdateFlipMask [9047]LDY #$00 [9049]LDA CurrentSprites_Phases,X [904c]BEQ @LAB_PRG14__905c [904e]TAY [904f]LDA a:SpriteUpdateCounter [9052]LSR A [9053]LSR A [9054]CPY #$01 [9056]BNE @LAB_PRG14__9059 [9058]LSR A [9059]@LAB_PRG14__9059:; [$9059] [9059]AND #$01 [905b]TAY [905c]@LAB_PRG14__905c:; [$905c] [905c]TYA [905d]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Nash ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61b] ;============================================================================
[9060]SpriteBehavior_Nash:; [$9060] [9060]JSR Sprite_IsBehaviorNotReady [9063]BNE @LAB_PRG14__906d [9065]LDA #$78 [9067]STA CurrentSprites_BehaviorData2,X [906a]JSR Sprite_SetBehaviorReady [906d]@LAB_PRG14__906d:; [$906d] [906d]LDY CurrentSprites_Phases,X [9070]BEQ @LAB_PRG14__908f [9072]DEY [9073]BEQ @LAB_PRG14__90ce [9075]DEC CurrentSprites_BehaviorData2,X [9078]BEQ @LAB_PRG14__9084 [907a]LDA CurrentSprites_BehaviorData2,X [907d]CMP #$0a [907f]BNE @_return [9081]JMP FUN_PRG14__a0a0 [9084]@LAB_PRG14__9084:; [$9084] [9084]LDA #$00 [9086]STA CurrentSprites_Phases,X [9089]LDA #$78 [908b]STA CurrentSprites_BehaviorData2,X [908e]@_return:; [$908e] [908e]RTS [908f]@LAB_PRG14__908f:; [$908f] [908f]JSR Sprite_SetVisible [9092]DEC CurrentSprites_BehaviorData2,X [9095]BNE @_return1 [9097]JSR Sprites_HideSprite [909a]INC CurrentSprites_Phases,X [909d]LDA #$3c [909f]STA CurrentSprites_BehaviorData2,X [90a2]LDA Player_Flags [90a4]AND #$40 [90a6]BNE @LAB_PRG14__90bd [90a8]LDA Player_PosX_Block [90aa]CLC [90ab]ADC #$20 [90ad]STA CurrentSprites_XPos_Full,X [90af]BCS @LAB_PRG14__90b5 [90b1]CMP #$f0 [90b3]BCC @_return1 [90b5]@LAB_PRG14__90b5:; [$90b5] [90b5]LDA Player_PosX_Block [90b7]SEC [90b8]SBC #$20 [90ba]STA CurrentSprites_XPos_Full,X [90bc]RTS [90bd]@LAB_PRG14__90bd:; [$90bd] [90bd]LDA Player_PosX_Block [90bf]SEC [90c0]SBC #$20 [90c2]STA CurrentSprites_XPos_Full,X [90c4]BCS @_return1 [90c6]LDA Player_PosX_Block [90c8]CLC [90c9]ADC #$20 [90cb]STA CurrentSprites_XPos_Full,X [90cd]@_return1:; [$90cd] [90cd]RTS [90ce]@LAB_PRG14__90ce:; [$90ce] [90ce]JSR BScript_Action_FacePlayerX [90d1]DEC CurrentSprites_BehaviorData2,X [90d4]BNE @_return2 [90d6]LDA #$3c [90d8]STA CurrentSprites_BehaviorData2,X [90db]INC CurrentSprites_Phases,X [90de]@_return2:; [$90de] [90de]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Nash ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a1] ;============================================================================
[90df]SpriteUpdateHandler_Enemy_Nash:; [$90df] [90df]JSR CurrentSprite_UpdateFlipMask [90e2]LDA CurrentSprites_Phases,X [90e5]BEQ @_return [90e7]CMP #$02 [90e9]BEQ @LAB_PRG14__90f7 [90eb]LDA a:SpriteUpdateCounter [90ee]AND #$04 [90f0]BNE @_return [90f2]LDY #$00 [90f4]BEQ @LAB_PRG14__910b [90f6]@_return:; [$90f6] [90f6]RTS [90f7]@LAB_PRG14__90f7:; [$90f7] [90f7]LDY #$00 [90f9]LDA CurrentSprites_BehaviorData2,X [90fc]SEC [90fd]SBC #$0a [90ff]CMP #$28 [9101]BCS @LAB_PRG14__910b [9103]LDY #$01 [9105]CMP #$14 [9107]BCS @LAB_PRG14__910b [9109]LDY #$02 [910b]@LAB_PRG14__910b:; [$910b] [910b]TYA [910c]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_FireGiant ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a3] ;============================================================================
[910f]SpriteUpdateHandler_Enemy_FireGiant:; [$910f] [910f]JSR CurrentSprite_UpdateFlipMask [9112]LDY #$02 [9114]LDA CurrentSprites_Phases,X [9117]CMP #$02 [9119]BNE @LAB_PRG14__9125 [911b]LDY #$00 [911d]LDA a:SpriteUpdateCounter [9120]AND #$04 [9122]BEQ @LAB_PRG14__9125 [9124]INY [9125]@LAB_PRG14__9125:; [$9125] [9125]TYA [9126]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Ishiisu ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a667] ;============================================================================
[9129]SpriteBehavior_Ishiisu:; [$9129] [9129]JSR Sprite_IsBehaviorNotReady [912c]BNE @LAB_PRG14__9136 [912e]LDA #$00 [9130]STA CurrentSprites_Phases,X [9133]JSR Sprite_SetBehaviorReady [9136]@LAB_PRG14__9136:; [$9136] [9136]LDA CurrentSprites_Phases,X [9139]LSR A [913a]BCS @LAB_PRG14__9176 [913c]LDA CurrentSprites_XPos_Full,X [913e]SEC [913f]SBC Player_PosX_Block [9141]BCS @LAB_PRG14__9147 [9143]EOR #$ff [9145]ADC #$01 [9147]@LAB_PRG14__9147:; [$9147] [9147]CMP #$20 [9149]BCC @LAB_PRG14__915e [914b]JSR BScript_Action_FacePlayerX [914e]LDA #$c0 [9150]STA a:Arg_DeltaX_Frac [9153]LDA #$00 [9155]STA a:Arg_DeltaX_Full [9158]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [915b]JMP SpriteBehavior_Ishiisu_Something_915b [915e]@LAB_PRG14__915e:; [$915e] [915e]LDA CurrentSprites_Flags,X [9161]AND #$01 [9163]TAY [9164]LDA Player_Flags [9166]AND #$40 [9168]EOR BYTE_ARRAY_PRG14__918c,Y [916b]BNE @_return1 [916d]INC CurrentSprites_Phases,X [9170]LDA #$1e [9172]STA CurrentSprites_BehaviorData2,X [9175]@_return1:; [$9175] [9175]RTS [9176]@LAB_PRG14__9176:; [$9176] [9176]JSR BScript_Action_FacePlayerX [9179]DEC CurrentSprites_BehaviorData2,X [917c]LDA CurrentSprites_BehaviorData2,X [917f]BEQ @LAB_PRG14__9188 [9181]CMP #$14 [9183]BNE @_return2 [9185]JMP FUN_PRG14__a0a0 [9188]@LAB_PRG14__9188:; [$9188] [9188]INC CurrentSprites_Phases,X [918b]@_return2:; [$918b] [918b]RTS
; ; XREFS: ; SpriteBehavior_Ishiisu ;
[918c]BYTE_ARRAY_PRG14__918c:; [$918c] [918c].byte $40; [0]: [918d].byte $00; [1]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Ishiisu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a5] ;============================================================================
[918e]SpriteUpdateHandler_Enemy_Ishiisu:; [$918e] [918e]JSR CurrentSprite_UpdateFlipMask [9191]LDA CurrentSprites_Phases,X [9194]LSR A [9195]BCS @LAB_PRG14__91a4 [9197]LDY #$00 [9199]LDA a:SpriteUpdateCounter [919c]AND #$04 [919e]BEQ @LAB_PRG14__91af [91a0]LDY #$01 [91a2]BNE @LAB_PRG14__91af [91a4]@LAB_PRG14__91a4:; [$91a4] [91a4]LDY #$02 [91a6]LDA CurrentSprites_BehaviorData2,X [91a9]CMP #$14 [91ab]BCS @LAB_PRG14__91af [91ad]LDY #$03 [91af]@LAB_PRG14__91af:; [$91af] [91af]TYA [91b0]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ExecutionHood ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a669] ;============================================================================
[91b3]SpriteBehavior_ExecutionHood:; [$91b3] [91b3]JSR Sprite_IsBehaviorNotReady [91b6]BNE @LAB_PRG14__91c3 [91b8]LDA #$00 [91ba]STA CurrentSprites_BehaviorData3,X [91bd]STA CurrentSprites_Phases,X [91c0]JSR Sprite_SetBehaviorReady [91c3]@LAB_PRG14__91c3:; [$91c3] [91c3]LDA CurrentSprites_Phases,X [91c6]AND #$03 [91c8]CMP #$03 [91ca]BEQ @LAB_PRG14__920b [91cc]LDA #$80 [91ce]STA a:Arg_DeltaX_Frac [91d1]LDA #$00 [91d3]STA a:Arg_DeltaX_Full [91d6]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [91d9]LDA CurrentSprites_BehaviorData3,X [91dc]LDY #$05 [91de]JSR Sprites_CalcYFromGravity [91e1]LDY #$05 [91e3]JSR Sprites_CalcVerticalSpriteMovement [91e6]LDA #$00 [91e8]STA a:Arg_DeltaY_Full [91eb]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [91ee]INC CurrentSprites_BehaviorData3,X [91f1]LDA CurrentSprites_BehaviorData3,X [91f4]AND #$07 [91f6]BNE @LAB_PRG14__91fb [91f8]JSR BScript_Action_FlipYDirection [91fb]@LAB_PRG14__91fb:; [$91fb] [91fb]LDA CurrentSprites_BehaviorData3,X [91fe]AND #$0f [9200]BNE @_return1 [9202]INC CurrentSprites_Phases,X [9205]LDA #$0f [9207]STA CurrentSprites_BehaviorData2,X [920a]@_return1:; [$920a] [920a]RTS [920b]@LAB_PRG14__920b:; [$920b] [920b]JSR BScript_Action_FacePlayerX [920e]DEC CurrentSprites_BehaviorData2,X [9211]BNE @_return2 [9213]INC CurrentSprites_Phases,X [9216]LDA #$00 [9218]STA CurrentSprites_BehaviorData3,X [921b]JMP SpriteBehavior_ExecutionHood__a093 [921e]@_return2:; [$921e] [921e]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_ExecutionHood ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a7] ;============================================================================
[921f]SpriteUpdateHandler_Enemy_ExecutionHood:; [$921f] [921f]JSR CurrentSprite_UpdateFlipMask [9222]LDY #$00 [9224]LDA CurrentSprites_Phases,X [9227]AND #$03 [9229]CMP #$03 [922b]BNE @LAB_PRG14__9235 [922d]LDA a:SpriteUpdateCounter [9230]AND #$04 [9232]BEQ @LAB_PRG14__9235 [9234]INY [9235]@LAB_PRG14__9235:; [$9235] [9235]TYA [9236]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document BScript_Action_CastMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_ACTIONS [$PRG14::a7a2] ;============================================================================
[9239]BScript_Action_CastMagic:; [$9239] [9239]JSR Sprites_HasMaxOnScreen [923c]BCS @_return [923e]LDA CurrentSprites_Flags,X [9241]AND #$01 [9243]STA CurrentSprites_Flags,Y [9246]LDA CurrentSprites_XPos_Full,X [9248]STA CurrentSprites_XPos_Full,Y [924b]LDA CurrentSprites_YPos,X [924d]CLC [924e]ADC #$08 [9250]STA CurrentSprites_YPos,Y [9253]LDA #$54 [9255]STA CurrentSprites_Entities,Y [9258]LDA #$00 [925a]STA CurrentSprites_PPUOffsets,Y [925d]JMP Sprite_Maybe_ResetState [9260]@_return:; [$9260] [9260]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Charron ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b1] ;============================================================================
[9261]SpriteUpdateHandler_Enemy_Charron:; [$9261] [9261]JSR CurrentSprite_UpdateFlipMask [9264]LDA CurrentSprites_Phases,X [9267]BEQ @LAB_PRG14__927b [9269]CMP #$05 [926b]BEQ @LAB_PRG14__9280 [926d]LSR A [926e]BCS @LAB_PRG14__927b [9270]LDA a:SpriteUpdateCounter [9273]LSR A [9274]LSR A [9275]LSR A [9276]AND #$01 [9278]JMP @LAB_PRG14__927d [927b]@LAB_PRG14__927b:; [$927b] [927b]LDA #$01 [927d]@LAB_PRG14__927d:; [$927d] [927d]JMP Sprite_EnterNextAppearancePhase [9280]@LAB_PRG14__9280:; [$9280] [9280]LDA #$02 [9282]BNE @LAB_PRG14__927d
;============================================================================ ; TODO: Document _thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a623] ;============================================================================
[9284]_thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7:; [$9284] [9284]JMP Sprite_FinishBehavior
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Geributa ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b5] ;============================================================================
[9287]SpriteUpdateHandler_Enemy_Geributa:; [$9287] [9287]JSR CurrentSprite_UpdateFlipMask [928a]LDY #$02 [928c]LDA CurrentSprites_Phases,X [928f]BEQ @LAB_PRG14__929b [9291]LDY #$00 [9293]LDA a:SpriteUpdateCounter [9296]AND #$04 [9298]BEQ @LAB_PRG14__929b [929a]INY [929b]@LAB_PRG14__929b:; [$929b] [929b]TYA [929c]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Sugata ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b7] ;============================================================================
[929f]SpriteUpdateHandler_Enemy_Sugata:; [$929f] [929f]JSR CurrentSprite_UpdateFlipMask [92a2]LDY #$00 [92a4]LDA a:SpriteUpdateCounter [92a7]AND #$08 [92a9]BEQ @LAB_PRG14__92ac [92ab]INY [92ac]@LAB_PRG14__92ac:; [$92ac] [92ac]TYA [92ad]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Grimlock ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80b9] ;============================================================================
[92b0]SpriteUpdateHandler_Enemy_Grimlock:; [$92b0] [92b0]JSR CurrentSprite_UpdateFlipMask [92b3]LDY #$03 [92b5]LDA CurrentSprites_Phases,X [92b8]CMP #$09 [92ba]BEQ @LAB_PRG14__92d8 [92bc]CMP #$0b [92be]BEQ @LAB_PRG14__92d8 [92c0]LDY #$00 [92c2]CMP #$08 [92c4]BCC @LAB_PRG14__92d8 [92c6]TAY [92c7]LDA a:SpriteUpdateCounter [92ca]CPY #$0b [92cc]BEQ @LAB_PRG14__92cf [92ce]LSR A [92cf]@LAB_PRG14__92cf:; [$92cf] [92cf]LSR A [92d0]LSR A [92d1]AND #$03 [92d3]TAY [92d4]LDA SPRITE_GRIMLOCK_PHASES,Y [92d7]TAY [92d8]@LAB_PRG14__92d8:; [$92d8] [92d8]TYA [92d9]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Grimlock ;
[92dc]SPRITE_GRIMLOCK_PHASES:; [$92dc] [92dc].byte $00; [0]: [92dd].byte $01; [1]: [92de].byte $02; [2]: [92df].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_GiantBees ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a627] ;============================================================================
[92e0]SpriteBehavior_GiantBees:; [$92e0] [92e0]JSR Sprite_IsBehaviorNotReady [92e3]BNE @LAB_PRG14__92ed [92e5]LDA #$00 [92e7]STA CurrentSprites_Phases,X [92ea]JSR Sprite_SetBehaviorReady [92ed]@LAB_PRG14__92ed:; [$92ed] [92ed]LDY CurrentSprites_Phases,X [92f0]BEQ @LAB_PRG14__92f8 [92f2]DEY [92f3]BEQ @LAB_PRG14__932b [92f5]JMP @LAB_PRG14__9360 [92f8]@LAB_PRG14__92f8:; [$92f8] [92f8]LDA #$00 [92fa]STA a:Arg_DeltaY_Frac [92fd]LDA #$04 [92ff]STA a:Arg_DeltaY_Full [9302]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [9305]LDA CurrentSprites_YPos,X [9307]CMP #$20 [9309]BCS @_return1 [930b]INC CurrentSprites_Phases,X [930e]LDA #$ff [9310]STA CurrentSprites_BehaviorData2,X [9313]STA CurrentSprites_BehaviorData3,X [9316]JSR BScript_Action_FacePlayerX [9319]JSR BScript_Action_FacePlayerY [931c]@_return1:; [$931c] [931c]RTS [931d]@LAB_PRG14__931d:; [$931d] [931d]INC CurrentSprites_Phases,X [9320]LDA #$40 [9322]STA CurrentSprites_BehaviorData2,X [9325]LDA #$00 [9327]STA CurrentSprites_BehaviorData3,X [932a]RTS [932b]@LAB_PRG14__932b:; [$932b] [932b]LDA CurrentSprites_BehaviorData3,X [932e]BEQ @LAB_PRG14__931d [9330]JSR Sprite_CalcDistanceYToPlayer [9333]CMP #$08 [9335]BCC @LAB_PRG14__931d [9337]LDA #$00 [9339]STA a:Arg_DeltaX_Frac [933c]LDA #$01 [933e]STA a:Arg_DeltaX_Full [9341]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9344]LDA CurrentSprites_BehaviorData3,X [9347]LDY #$02 [9349]JSR Sprites_CalcVerticalSpriteMovement [934c]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [934f]LDA CurrentSprites_BehaviorData3,X [9352]SEC [9353]SBC #$04 [9355]STA CurrentSprites_BehaviorData3,X [9358]BCS @_return2 [935a]LDA #$00 [935c]STA CurrentSprites_BehaviorData3,X [935f]@_return2:; [$935f] [935f]RTS [9360]@LAB_PRG14__9360:; [$9360] [9360]JSR BScript_Action_FacePlayerX [9363]LDA #$c0 [9365]STA a:Arg_DeltaX_Frac [9368]LDA #$00 [936a]STA a:Arg_DeltaX_Full [936d]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [9370]LDA CurrentSprites_BehaviorData3,X [9373]LDY #$04 [9375]JSR Sprites_CalcYFromGravity [9378]LDY #$04 [937a]JSR Sprites_CalcVerticalSpriteMovement [937d]LDA #$00 [937f]STA a:Arg_DeltaY_Full [9382]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [9385]INC CurrentSprites_BehaviorData3,X [9388]LDA CurrentSprites_BehaviorData3,X [938b]AND #$0f [938d]BNE @LAB_PRG14__9397 [938f]LDA CurrentSprites_Flags,X [9392]EOR #$80 [9394]STA CurrentSprites_Flags,X [9397]@LAB_PRG14__9397:; [$9397] [9397]LDA CurrentSprites_BehaviorData3,X [939a]AND #$7f [939c]BNE @_return [939e]LDA #$00 [93a0]STA CurrentSprites_Phases,X [93a3]LDA CurrentSprites_Flags,X [93a6]AND #$7f [93a8]STA CurrentSprites_Flags,X [93ab]@_return:; [$93ab] [93ab]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_GiantBees ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bb] ;============================================================================
[93ac]SpriteUpdateHandler_Enemy_GiantBees:; [$93ac] [93ac]JSR CurrentSprite_UpdateFlipMask [93af]LDY #$00 [93b1]LDA a:SpriteUpdateCounter [93b4]AND #$08 [93b6]BEQ @LAB_PRG14__93b9 [93b8]INY [93b9]@LAB_PRG14__93b9:; [$93b9] [93b9]TYA [93ba]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Myconid ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bd] ;============================================================================
[93bd]SpriteUpdateHandler_Enemy_Myconid:; [$93bd] [93bd]JSR CurrentSprite_UpdateFlipMask [93c0]LDA CurrentSprites_Phases,X [93c3]CMP #$01 [93c5]BEQ @LAB_PRG14__93d4 [93c7]CMP #$03 [93c9]BEQ @LAB_PRG14__93d4 [93cb]CMP #$05 [93cd]BEQ @LAB_PRG14__93d4 [93cf]LDA #$00 [93d1]JMP Sprite_EnterNextAppearancePhase [93d4]@LAB_PRG14__93d4:; [$93d4] [93d4]TAY [93d5]LDA a:SpriteUpdateCounter [93d8]CPY #$05 [93da]BEQ @LAB_PRG14__93dd [93dc]LSR A [93dd]@LAB_PRG14__93dd:; [$93dd] [93dd]LSR A [93de]LSR A [93df]LSR A [93e0]AND #$01 [93e2]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Naga ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a629] ;============================================================================
[93e5]SpriteBehavior_Naga:; [$93e5] [93e5]JSR Sprite_IsBehaviorNotReady [93e8]BNE @LAB_PRG14__93f5 [93ea]LDA #$00 [93ec]STA CurrentSprites_BehaviorData3,X [93ef]STA CurrentSprites_Phases,X [93f2]JSR Sprite_SetBehaviorReady [93f5]@LAB_PRG14__93f5:; [$93f5] [93f5]JSR BScript_Action_FacePlayerX [93f8]LDA CurrentSprites_BehaviorData3,X [93fb]LDY #$04 [93fd]JSR Sprites_CalcYFromGravity [9400]LDY #$05 [9402]JSR Sprites_CalcVerticalSpriteMovement [9405]LDA a:Arg_DeltaY_Full [9408]AND #$01 [940a]STA a:Arg_DeltaY_Full [940d]JSR Sprite_MoveVertical [9410]INC CurrentSprites_BehaviorData3,X [9413]LDA CurrentSprites_BehaviorData3,X [9416]AND #$1f [9418]BNE @LAB_PRG14__9422 [941a]LDA CurrentSprites_Flags,X [941d]EOR #$80 [941f]STA CurrentSprites_Flags,X [9422]@LAB_PRG14__9422:; [$9422] [9422]JSR Sprite_CalcDistanceYToPlayer [9425]CMP #$10 [9427]BCC @_return [9429]LDA CurrentSprites_Flags,X [942c]PHA [942d]JSR BScript_Action_FacePlayerY [9430]LDA #$00 [9432]STA a:Arg_DeltaY_Full [9435]LDA #$c0 [9437]STA a:Arg_DeltaY_Frac [943a]JSR Sprite_MoveVertical [943d]PLA [943e]STA CurrentSprites_Flags,X [9441]@_return:; [$9441] [9441]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Naga ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80bf] ;============================================================================
[9442]SpriteUpdateHandler_Enemy_Naga:; [$9442] [9442]JSR CurrentSprite_UpdateFlipMask [9445]LDY #$00 [9447]LDA a:SpriteUpdateCounter [944a]AND #$08 [944c]BEQ @LAB_PRG14__944f [944e]INY [944f]@LAB_PRG14__944f:; [$944f] [944f]TYA [9450]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused29 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c1] ;============================================================================
[9453]SpriteUpdateHandler_Enemy_Unused29:; [$9453] [9453]JSR CurrentSprite_UpdateFlipMask [9456]LDY #$03 [9458]LDA CurrentSprites_Phases,X [945b]BEQ @LAB_PRG14__946c [945d]CMP #$02 [945f]BEQ @LAB_PRG14__9470 [9461]LDY #$01 [9463]LDA a:SpriteUpdateCounter [9466]AND #$08 [9468]BEQ @LAB_PRG14__946c [946a]LDY #$02 [946c]@LAB_PRG14__946c:; [$946c] [946c]TYA [946d]JMP Sprite_EnterNextAppearancePhase [9470]@LAB_PRG14__9470:; [$9470] [9470]LDY #$00 [9472]LDA a:SpriteUpdateCounter [9475]AND #$10 [9477]BEQ @LAB_PRG14__946c [9479]LDY #$02 [947b]BNE @LAB_PRG14__946c
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_GiantStrider ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c3] ;============================================================================
[947d]SpriteUpdateHandler_Enemy_GiantStrider:; [$947d] [947d]JSR CurrentSprite_UpdateFlipMask [9480]LDY #$02 [9482]LDA CurrentSprites_Phases,X [9485]CMP #$02 [9487]BEQ @LAB_PRG14__9493 [9489]LDY #$00 [948b]LDA a:SpriteUpdateCounter [948e]AND #$04 [9490]BEQ @LAB_PRG14__9493 [9492]INY [9493]@LAB_PRG14__9493:; [$9493] [9493]TYA [9494]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_SirGawaineWolfman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a637] ;============================================================================
[9497]SpriteBehavior_SirGawaineWolfman:; [$9497] [9497]JSR Sprite_IsBehaviorNotReady [949a]BNE @LAB_PRG14__94a4 [949c]LDA #$00 [949e]STA CurrentSprites_Phases,X [94a1]JSR Sprite_SetBehaviorReady [94a4]@LAB_PRG14__94a4:; [$94a4] [94a4]JSR Sprites_SetCurrentSpriteCanMove [94a7]BCC @LAB_PRG14__94ac [94a9]JSR CurrentSprite_HandleFall [94ac]@LAB_PRG14__94ac:; [$94ac] [94ac]LDA #$00 [94ae]STA CurrentSprites_Phases,X [94b1]JSR Sprite_CalcDistanceXToPlayer [94b4]CMP #$18 [94b6]BEQ @_return1 [94b8]BCC @LAB_PRG14__94d5 [94ba]JSR BScript_Action_FacePlayerX [94bd]LDA #$01 [94bf]STA a:Arg_DeltaX_Full [94c2]LDA #$00 [94c4]STA a:Arg_DeltaX_Frac [94c7]JSR Sprites_Something_SomethingAndMoveHoriz [94ca]LDA a:SpriteUpdateCounter [94cd]AND #$08 [94cf]BEQ @_return1 [94d1]INC CurrentSprites_Phases,X [94d4]@_return1:; [$94d4] [94d4]RTS [94d5]@LAB_PRG14__94d5:; [$94d5] [94d5]LDA #$01 [94d7]STA CurrentSprites_Phases,X [94da]LDA Player_Flags [94dc]AND #$01 [94de]BNE @LAB_PRG14__94f3 [94e0]JSR BScript_Action_FacePlayerX [94e3]LDY #$00 [94e5]LDA a:SpriteUpdateCounter [94e8]AND #$10 [94ea]BEQ @LAB_PRG14__94ee [94ec]LDY #$02 [94ee]@LAB_PRG14__94ee:; [$94ee] [94ee]TYA [94ef]STA CurrentSprites_Phases,X [94f2]RTS [94f3]@LAB_PRG14__94f3:; [$94f3] [94f3]LDA #$00 [94f5]STA CurrentSprites_Phases,X [94f8]JSR BScript_Action_FacePlayerX [94fb]LDA #$02 [94fd]STA a:Arg_DeltaX_Full [9500]LDA #$00 [9502]STA a:Arg_DeltaX_Frac [9505]JSR Sprites_Something_SomethingAndMoveHoriz [9508]LDA a:SpriteUpdateCounter [950b]AND #$04 [950d]BNE @_return2 [950f]INC CurrentSprites_Phases,X [9512]@_return2:; [$9512] [9512]RTS
;============================================================================ ; 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] [9513]JSR CurrentSprite_UpdateFlipMask [9516]LDA CurrentSprites_Phases,X [9519]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Maskman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80c7] ;============================================================================
[951c]SpriteUpdateHandler_Enemy_Maskman:; [$951c] [951c]JSR CurrentSprite_UpdateFlipMask [951f]LDY #$04 [9521]LDA CurrentSprites_Phases,X [9524]LSR A [9525]BCC @LAB_PRG14__9531 [9527]LDY #$00 [9529]LDA a:SpriteUpdateCounter [952c]AND #$08 [952e]BEQ @LAB_PRG14__9531 [9530]INY [9531]@LAB_PRG14__9531:; [$9531] [9531]TYA [9532]JMP 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] [9535]JMP SpriteUpdateHandler_Enemy_SirGawaine_Wolfman
;============================================================================ ; TODO: Document SpriteBehavior_Yareeka ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62b] ;============================================================================
[9538]SpriteBehavior_Yareeka:; [$9538] [9538]JSR Sprite_IsBehaviorNotReady [953b]BNE @LAB_PRG14__9548 [953d]LDA #$00 [953f]STA CurrentSprites_BehaviorData2,X [9542]STA CurrentSprites_Phases,X [9545]JSR Sprite_SetBehaviorReady [9548]@LAB_PRG14__9548:; [$9548] [9548]LDY CurrentSprites_Phases,X [954b]CPY #$02 [954d]BEQ @LAB_PRG14__9580 [954f]DEY [9550]BEQ @LAB_PRG14__9565 [9552]JSR FUN_PRG14__9593 [9555]LDA CurrentSprites_BehaviorData2,X [9558]CMP #$40 [955a]BCC @_return1 [955c]INC CurrentSprites_Phases,X [955f]LDA #$40 [9561]STA CurrentSprites_BehaviorData2,X [9564]@_return1:; [$9564] [9564]RTS [9565]@LAB_PRG14__9565:; [$9565] [9565]LDA #$02 [9567]STA a:Arg_DeltaX_Full [956a]LDA #$00 [956c]STA a:Arg_DeltaX_Frac [956f]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9572]DEC CurrentSprites_BehaviorData2,X [9575]BNE @LAB_PRG14__957f [9577]INC CurrentSprites_Phases,X [957a]LDA #$40 [957c]STA CurrentSprites_BehaviorData2,X [957f]@LAB_PRG14__957f:; [$957f] [957f]RTS [9580]@LAB_PRG14__9580:; [$9580] [9580]JSR FUN_PRG14__9593 [9583]LDA CurrentSprites_BehaviorData2,X [9586]CMP #$80 [9588]BCC @_return2 [958a]LDA #$00 [958c]STA CurrentSprites_Phases,X [958f]STA CurrentSprites_BehaviorData2,X [9592]@_return2:; [$9592] [9592]RTS
;============================================================================ ; 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] [9593]LDA CurrentSprites_BehaviorData2,X [9596]INC CurrentSprites_BehaviorData2,X [9599]LDY #$02 [959b]JSR Sprites_CalcYFromGravity [959e]LDY #$03 [95a0]JSR Sprites_CalcHorizSpriteMovement [95a3]LDA a:Arg_DeltaX_Full [95a6]AND #$01 [95a8]STA a:Arg_DeltaX_Full [95ab]JMP Sprite_MoveHorizAndTurnAroundIfNeeded
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Yareeka ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cb] ;============================================================================
[95ae]SpriteUpdateHandler_Enemy_Yareeka:; [$95ae] [95ae]JSR CurrentSprite_UpdateFlipMask [95b1]LDY #$00 [95b3]LDA a:SpriteUpdateCounter [95b6]AND #$08 [95b8]BEQ @LAB_PRG14__95bc [95ba]LDY #$01 [95bc]@LAB_PRG14__95bc:; [$95bc] [95bc]TYA [95bd]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Magman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62d] ;============================================================================
[95c0]SpriteBehavior_Magman:; [$95c0] [95c0]JSR Sprite_IsBehaviorNotReady [95c3]BNE @LAB_PRG14__95da [95c5]LDA #$3c [95c7]STA CurrentSprites_BehaviorData2,X [95ca]LDA #$00 [95cc]STA CurrentSprites_Phases,X [95cf]LDA #$d0 [95d1]STA CurrentSprites_YPos,X [95d3]LDA #$f0 [95d5]STA CurrentSprites_XPos_Full,X [95d7]JSR Sprite_SetBehaviorReady [95da]@LAB_PRG14__95da:; [$95da] [95da]LDA CurrentSprites_Phases,X [95dd]LSR A [95de]BCS @LAB_PRG14__9602 [95e0]DEC CurrentSprites_BehaviorData2,X [95e3]BNE @_return [95e5]INC CurrentSprites_Phases,X [95e8]LDA #$78 [95ea]STA CurrentSprites_BehaviorData2,X [95ed]LDY #$30 [95ef]LDA Player_Flags [95f1]AND #$40 [95f3]BNE @LAB_PRG14__95f7 [95f5]LDY #$d0 [95f7]@LAB_PRG14__95f7:; [$95f7] [95f7]TYA [95f8]CLC [95f9]ADC Player_PosX_Block [95fb]STA CurrentSprites_XPos_Full,X [95fd]LDA Player_PosY [95ff]STA CurrentSprites_YPos,X [9601]@_return:; [$9601] [9601]RTS [9602]@LAB_PRG14__9602:; [$9602] [9602]JSR BScript_Action_FacePlayerX [9605]DEC CurrentSprites_BehaviorData2,X [9608]BNE RETURN_961A [960a]INC CurrentSprites_Phases,X [960d]LDA #$3c [960f]STA CurrentSprites_BehaviorData2,X [9612]LDA #$d0 [9614]STA CurrentSprites_YPos,X [9616]LDA #$f0 [9618]STA CurrentSprites_XPos_Full,X
; ; XREFS: ; SpriteBehavior_Magman ; SpriteUpdateHandler_Enemy_Magman ;
[961a]RETURN_961A:; [$961a] [961a]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Magman ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cd] ;============================================================================
[961b]SpriteUpdateHandler_Enemy_Magman:; [$961b] [961b]JSR CurrentSprite_UpdateFlipMask [961e]LDA CurrentSprites_Phases,X [9621]LSR A [9622]BCC RETURN_961A [9624]LDY #$00 [9626]LDA a:SpriteUpdateCounter [9629]AND #$08 [962b]BEQ @LAB_PRG14__962e [962d]INY [962e]@LAB_PRG14__962e:; [$962e] [962e]TYA [962f]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused36 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a62f] ;============================================================================
[9632]SpriteBehavior_EnemyUnused36:; [$9632] [9632]JSR Sprite_IsBehaviorNotReady [9635]BNE @LAB_PRG14__9644 [9637]LDA #$20 [9639]STA CurrentSprites_BehaviorData3,X [963c]LDA #$00 [963e]STA CurrentSprites_Phases,X [9641]JSR Sprite_SetBehaviorReady [9644]@LAB_PRG14__9644:; [$9644] [9644]LDA CurrentSprites_Phases,X [9647]AND #$03 [9649]STA CurrentSprites_Phases,X [964c]LDA CurrentSprites_BehaviorData3,X [964f]LDY #$04 [9651]JSR Sprites_CalcYFromGravity [9654]LDY #$05 [9656]JSR Sprites_CalcVerticalSpriteMovement [9659]LDA a:Arg_DeltaY_Full [965c]AND #$01 [965e]STA a:Arg_DeltaY_Full [9661]JSR Sprite_MoveVertical [9664]INC CurrentSprites_BehaviorData3,X [9667]LDA CurrentSprites_BehaviorData3,X [966a]AND #$1f [966c]BNE @LAB_PRG14__9671 [966e]JSR BScript_Action_FlipYDirection [9671]@LAB_PRG14__9671:; [$9671] [9671]LDA CurrentSprites_Phases,X [9674]BNE FUN_PRG14__9699 [9676]LDA #$00 [9678]STA a:Arg_DeltaX_Full [967b]LDA #$c0 [967d]STA a:Arg_DeltaX_Frac [9680]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9683]JSR Sprite_CalcDistanceYToPlayer [9686]CMP #$20 [9688]BCS @_return [968a]INC CurrentSprites_Phases,X [968d]LDA #$00 [968f]STA CurrentSprites_BehaviorData2,X [9692]@_return:; [$9692] [9692]RTS
;============================================================================ ; TODO: Document FUN_PRG14__9693 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9699 ;============================================================================
[9693]FUN_PRG14__9693:; [$9693] [9693]LDA #$00 [9695]STA CurrentSprites_Phases,X [9698]RTS
;============================================================================ ; TODO: Document FUN_PRG14__9699 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused36 ;============================================================================
[9699]FUN_PRG14__9699:; [$9699] [9699]JSR Sprite_CalcDistanceYToPlayer [969c]CMP #$20 [969e]BCS FUN_PRG14__9693 [96a0]LDY CurrentSprites_Phases,X [96a3]CPY #$03 [96a5]BEQ @LAB_PRG14__96d5 [96a7]DEY [96a8]BEQ @LAB_PRG14__96b8 [96aa]JSR FUN_PRG14__9593 [96ad]LDA CurrentSprites_BehaviorData2,X [96b0]CMP #$40 [96b2]BCC @_return1 [96b4]INC CurrentSprites_Phases,X [96b7]@_return1:; [$96b7] [96b7]RTS [96b8]@LAB_PRG14__96b8:; [$96b8] [96b8]LDA #$02 [96ba]STA a:Arg_DeltaX_Full [96bd]LDA #$00 [96bf]STA a:Arg_DeltaX_Frac [96c2]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [96c5]JSR Sprite_CalcDistanceXToPlayer [96c8]CMP #$30 [96ca]BCS @_return2 [96cc]INC CurrentSprites_Phases,X [96cf]LDA #$40 [96d1]STA CurrentSprites_BehaviorData2,X [96d4]@_return2:; [$96d4] [96d4]RTS [96d5]@LAB_PRG14__96d5:; [$96d5] [96d5]JSR FUN_PRG14__9593 [96d8]LDA CurrentSprites_BehaviorData2,X [96db]CMP #$40 [96dd]BCC @_return3 [96df]LDA #$01 [96e1]STA CurrentSprites_Phases,X [96e4]LDA #$00 [96e6]STA CurrentSprites_BehaviorData2,X [96e9]@_return3:; [$96e9] [96e9]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused_CurlyTail ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80cf] ;============================================================================
[96ea]SpriteUpdateHandler_Enemy_Unused_CurlyTail:; [$96ea] [96ea]JSR CurrentSprite_UpdateFlipMask [96ed]LDA CurrentSprites_Phases,X [96f0]BNE @LAB_PRG14__96f6 [96f2]LDY #$00 [96f4]BEQ @LAB_PRG14__96f8 [96f6]@LAB_PRG14__96f6:; [$96f6] [96f6]LDY #$02 [96f8]@LAB_PRG14__96f8:; [$96f8] [96f8]LDA a:SpriteUpdateCounter [96fb]AND #$08 [96fd]BEQ @LAB_PRG14__9700 [96ff]INY [9700]@LAB_PRG14__9700:; [$9700] [9700]TYA [9701]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Ikeda ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d3] ;============================================================================
[9704]SpriteUpdateHandler_Enemy_Ikeda:; [$9704] [9704]JSR CurrentSprite_UpdateFlipMask [9707]LDY #$02 [9709]JSR Sprite_GetPreviousSpritePhase [970c]LSR A [970d]BCS @LAB_PRG14__9719 [970f]LDY #$00 [9711]LDA a:SpriteUpdateCounter [9714]AND #$04 [9716]BEQ @LAB_PRG14__9719 [9718]INY [9719]@LAB_PRG14__9719:; [$9719] [9719]TYA [971a]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused39 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a631] ;============================================================================
[971d]SpriteBehavior_EnemyUnused39:; [$971d] [971d]JSR Sprite_IsBehaviorNotReady [9720]BNE @LAB_PRG14__972d [9722]LDA #$00 [9724]STA CurrentSprites_Phases,X [9727]STA CurrentSprites_BehaviorData2,X [972a]JSR Sprite_SetBehaviorReady [972d]@LAB_PRG14__972d:; [$972d] [972d]JSR Sprites_SetCurrentSpriteCanMove [9730]BCC @LAB_PRG14__9735 [9732]JMP CurrentSprite_HandleFall [9735]@LAB_PRG14__9735:; [$9735] [9735]INC CurrentSprites_BehaviorData2,X [9738]LDA CurrentSprites_BehaviorData2,X [973b]CMP #$13 [973d]BEQ @LAB_PRG14__974b [973f]CMP #$56 [9741]BEQ @LAB_PRG14__974b [9743]CMP #$85 [9745]BEQ @LAB_PRG14__974b [9747]CMP #$c9 [9749]BNE @LAB_PRG14__974e [974b]@LAB_PRG14__974b:; [$974b] [974b]JSR FUN_PRG14__a0a0 [974e]@LAB_PRG14__974e:; [$974e] [974e]JSR BScript_Action_FacePlayerX [9751]LDA #$40 [9753]STA a:Arg_DeltaX_Frac [9756]LDA #$00 [9758]STA a:Arg_DeltaX_Full [975b]JMP Sprite_MoveHorizAndTurnAroundIfNeeded
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_MuppetGuy ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d5] ;============================================================================
[975e]SpriteUpdateHandler_Enemy_MuppetGuy:; [$975e] [975e]JSR CurrentSprite_UpdateFlipMask [9761]LDY #$00 [9763]LDA a:SpriteUpdateCounter [9766]AND #$10 [9768]BNE @LAB_PRG14__976c [976a]LDY #$01 [976c]@LAB_PRG14__976c:; [$976c] [976c]TYA [976d]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Lamprey ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80d7] ;============================================================================
[9770]SpriteUpdateHandler_Enemy_Lamprey:; [$9770] [9770]JSR CurrentSprite_UpdateFlipMask [9773]LDA a:SpriteUpdateCounter [9776]LSR A [9777]LSR A [9778]LSR A [9779]AND #$07 [977b]TAY [977c]LDA CurrentSprite_FlipMask [977e]EOR LAMPREY_HORIZ_FLIP_BITS,Y [9781]STA CurrentSprite_FlipMask [9783]LDA BYTE_ARRAY_PRG14__978b,Y [9786]TAY [9787]TYA [9788]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Lamprey ;
[978b]BYTE_ARRAY_PRG14__978b:; [$978b] [978b].byte $00; [0]: [978c].byte $01; [1]: [978d].byte $01; [2]: [978e].byte $00; [3]: [978f].byte $01; [4]: [9790].byte $01; [5]: [9791].byte $00; [6]: [9792].byte $01; [7]:
; ; XREFS: ; SpriteUpdateHandler_Enemy_Lamprey ;
[9793]LAMPREY_HORIZ_FLIP_BITS:; [$9793] [9793].byte $00; [0]: [9794].byte $00; [1]: [9795].byte $40; [2]: [9796].byte $40; [3]: [9797].byte $40; [4]: [9798].byte $00; [5]: [9799].byte $00; [6]: [979a].byte $40; [7]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Monodron ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80db] ;============================================================================
[979b]SpriteUpdateHandler_Enemy_Monodron:; [$979b] [979b]JSR CurrentSprite_UpdateFlipMask [979e]JSR Sprite_GetPreviousSpritePhase [97a1]AND #$03 [97a3]TAY [97a4]LDA SPRITE_MONODRON_APPEARANCE_PHASES,Y [97a7]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Monodron ;
[97aa]SPRITE_MONODRON_APPEARANCE_PHASES:; [$97aa] [97aa].byte $00; [0]: [97ab].byte $02; [1]: [97ac].byte $00; [2]: [97ad].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused43 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a633] ;============================================================================
[97ae]SpriteBehavior_EnemyUnused43:; [$97ae] [97ae]JSR Sprite_IsBehaviorNotReady [97b1]BNE @LAB_PRG14__97be [97b3]LDA #$00 [97b5]STA CurrentSprites_BehaviorData3,X [97b8]STA CurrentSprites_Phases,X [97bb]JSR Sprite_SetBehaviorReady [97be]@LAB_PRG14__97be:; [$97be] [97be]JSR BScript_Action_FacePlayerX [97c1]LDA CurrentSprites_BehaviorData3,X [97c4]LDY #$04 [97c6]JSR Sprites_CalcYFromGravity [97c9]LDY #$05 [97cb]JSR Sprites_CalcVerticalSpriteMovement [97ce]LDA a:Arg_DeltaY_Full [97d1]AND #$01 [97d3]STA a:Arg_DeltaY_Full [97d6]JSR Sprite_MoveVertical [97d9]INC CurrentSprites_BehaviorData3,X [97dc]LDA CurrentSprites_BehaviorData3,X [97df]AND #$1f [97e1]BNE @LAB_PRG14__97eb [97e3]LDA CurrentSprites_Flags,X [97e6]EOR #$80 [97e8]STA CurrentSprites_Flags,X [97eb]@LAB_PRG14__97eb:; [$97eb] [97eb]LDY #$00 [97ed]LDA Player_Flags [97ef]AND #$40 [97f1]BEQ @LAB_PRG14__97f4 [97f3]INY [97f4]@LAB_PRG14__97f4:; [$97f4] [97f4]LDA Player_PosX_Block [97f6]CLC [97f7]ADC BYTE_ARRAY_PRG14__9851,Y [97fa]SEC [97fb]SBC CurrentSprites_XPos_Full,X [97fd]BEQ @LAB_PRG14__9820 [97ff]LDA #$00 [9801]ROL A [9802]STA Temp_00 [9804]LDA CurrentSprites_Flags,X [9807]PHA [9808]AND #$fe [980a]ORA Temp_00 [980c]STA CurrentSprites_Flags,X [980f]LDA #$01 [9811]STA a:Arg_DeltaX_Full [9814]LDA #$00 [9816]STA a:Arg_DeltaX_Frac [9819]JSR Sprites_Something_SomethingAndMoveHoriz [981c]PLA [981d]STA CurrentSprites_Flags,X [9820]@LAB_PRG14__9820:; [$9820] [9820]LDA Player_PosY [9822]SEC [9823]SBC #$18 [9825]SEC [9826]SBC CurrentSprites_YPos,X [9828]BEQ @_return [982a]TAY [982b]LDA #$00 [982d]ROR A [982e]STA Temp_00 [9830]CPY #$20 [9832]BCC @_return [9834]LDA CurrentSprites_Flags,X [9837]PHA [9838]AND #$7f [983a]ORA Temp_00 [983c]STA CurrentSprites_Flags,X [983f]LDA #$01 [9841]STA a:Arg_DeltaY_Full [9844]LDA #$00 [9846]STA a:Arg_DeltaY_Frac [9849]JSR Sprite_MoveVertical [984c]PLA [984d]STA CurrentSprites_Flags,X [9850]@_return:; [$9850] [9850]RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused43 ;
[9851]BYTE_ARRAY_PRG14__9851:; [$9851] [9851].byte $20; [0]:
; ; XREFS: ; SpriteBehavior_EnemyUnused43 ;
[9852]BYTE_ARRAY_PRG14__9851_1_:; [$9852] [9852].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] [9853]JSR CurrentSprite_UpdateFlipMask [9856]LDY #$00 [9858]LDA a:SpriteUpdateCounter [985b]AND #$08 [985d]BEQ @LAB_PRG14__9861 [985f]LDY #$01 [9861]@LAB_PRG14__9861:; [$9861] [9861]TYA [9862]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Tamazutsu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a635] ;============================================================================
[9865]SpriteBehavior_Tamazutsu:; [$9865] [9865]JSR Sprite_IsBehaviorNotReady [9868]BNE @LAB_PRG14__9877 [986a]LDA #$3c [986c]STA CurrentSprites_BehaviorData2,X [986f]LDA #$00 [9871]STA CurrentSprites_Phases,X [9874]JSR Sprite_SetBehaviorReady [9877]@LAB_PRG14__9877:; [$9877] [9877]JSR BScript_Action_FacePlayerX [987a]LDY CurrentSprites_Phases,X [987d]BEQ @LAB_PRG14__9887 [987f]DEY [9880]BEQ @LAB_PRG14__988f [9882]DEY [9883]BEQ @LAB_PRG14__9897 [9885]BNE @LAB_PRG14__989f [9887]@LAB_PRG14__9887:; [$9887] [9887]JSR Sprite_SetVisible [988a]LDA #$0b [988c]JMP @LAB_PRG14__98a7 [988f]@LAB_PRG14__988f:; [$988f] [988f]JSR Sprite_SetVisible [9892]LDA #$3c [9894]JMP @LAB_PRG14__98a7 [9897]@LAB_PRG14__9897:; [$9897] [9897]JSR Sprites_HideSprite [989a]LDA #$0b [989c]JMP @LAB_PRG14__98a7 [989f]@LAB_PRG14__989f:; [$989f] [989f]JSR Sprite_SetVisible [98a2]LDA #$3c [98a4]JMP @LAB_PRG14__98a7 [98a7]@LAB_PRG14__98a7:; [$98a7] [98a7]DEC CurrentSprites_BehaviorData2,X [98aa]BNE RETURN_98B2 [98ac]INC CurrentSprites_Phases,X [98af]STA CurrentSprites_BehaviorData2,X
; ; XREFS: ; SpriteBehavior_Tamazutsu ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[98b2]RETURN_98B2:; [$98b2] [98b2]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Tamazutsu ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80df] ;============================================================================
[98b3]SpriteUpdateHandler_Enemy_Tamazutsu:; [$98b3] [98b3]LDA CurrentSprites_Phases,X [98b6]AND #$03 [98b8]STA CurrentSprites_Phases,X [98bb]JSR CurrentSprite_UpdateFlipMask [98be]LDY CurrentSprites_Phases,X [98c1]BEQ @LAB_PRG14__98cb [98c3]DEY [98c4]BEQ @LAB_PRG14__98dc [98c6]DEY [98c7]BEQ @LAB_PRG14__98e9 [98c9]BNE @LAB_PRG14__98f6 [98cb]@LAB_PRG14__98cb:; [$98cb] [98cb]LDA CurrentSprites_BehaviorData2,X [98ce]CMP #$1e [98d0]BCS RETURN_98B2 [98d2]LDY #$00 [98d4]AND #$08 [98d6]BEQ @LAB_PRG14__9900 [98d8]LDY #$02 [98da]BNE @LAB_PRG14__9900 [98dc]@LAB_PRG14__98dc:; [$98dc] [98dc]LDA CurrentSprites_BehaviorData2,X [98df]LSR A [98e0]LSR A [98e1]TAY [98e2]LDA BYTE_ARRAY_PRG14__9905,Y [98e5]TAY [98e6]JMP @LAB_PRG14__9900 [98e9]@LAB_PRG14__98e9:; [$98e9] [98e9]LDY #$0a [98eb]LDA CurrentSprites_BehaviorData2,X [98ee]AND #$08 [98f0]BEQ @LAB_PRG14__9900 [98f2]LDY #$0c [98f4]BNE @LAB_PRG14__9900 [98f6]@LAB_PRG14__98f6:; [$98f6] [98f6]LDA CurrentSprites_BehaviorData2,X [98f9]LSR A [98fa]LSR A [98fb]TAY [98fc]LDA BYTE_ARRAY_PRG14__9908,Y [98ff]TAY [9900]@LAB_PRG14__9900:; [$9900] [9900]TYA [9901]LSR A [9902]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[9905]BYTE_ARRAY_PRG14__9905:; [$9905] [9905].byte $08; [0]: [9906].byte $06; [1]: [9907].byte $04; [2]:
; ; XREFS: ; SpriteUpdateHandler_Enemy_Tamazutsu ;
[9908]BYTE_ARRAY_PRG14__9908:; [$9908] [9908].byte $04; [0]: [9909].byte $06; [1]: [990a].byte $08; [2]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Rokusutahn ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80a9] ;============================================================================
[990b]SpriteUpdateHandler_Boss_Rokusutahn:; [$990b] [990b]LDA a:SpriteUpdateCounter [990e]LSR A [990f]LSR A [9910]LSR A [9911]LSR A [9912]AND #$03 [9914]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document FUN_PRG14__9917 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BScript_Op_SwitchBehavior ;============================================================================
[9917]FUN_PRG14__9917:; [$9917] [9917]LDA #$00 [9919]STA CurrentSprites_HitBoxTypes,X [991c]SEC [991d]LDA CurrentSprites_YPos,X [991f]SBC #$10 [9921]STA a:Sprite12BodyPartHandler_3_ [9924]SBC #$10 [9926]STA a:Sprite12BodyPartHandler_4_ [9929]SBC #$10 [992b]STA a:Sprite12BodyPartHandler_5_ [992e]LDA CurrentSprites_XPos_Full,X [9930]STA a:Sprite12BodyPartHandler [9933]STA a:Sprite12BodyPartHandler_1_ [9936]STA a:Sprite12BodyPartHandler_2_ [9939]LDA #$00 [993b]STA CurrentSprites_BehaviorData2,X [993e]STA CurrentSprites_BehaviorData3,X [9941]LDA #$00 [9943]STA CurrentSprites_Phases,X [9946]RTS
;============================================================================ ; TODO: Document thunk_FUN_PRG14__9a3c ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused18__994a ;============================================================================
[9947]thunk_FUN_PRG14__9a3c:; [$9947] [9947]JMP FUN_PRG14__9a3c
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18__994a ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; CALL_FUN_PRG14__994a [$PRG14::9a2c] ;============================================================================
[994a]SpriteBehavior_EnemyUnused18__994a:; [$994a] [994a]LDA CurrentSprites_Phases,X [994d]CMP #$03 [994f]BNE thunk_FUN_PRG14__9a3c [9951]LDA CurrentSprites_InternalBehaviorStates,X [9954]AND #$03 [9956]LSR A [9957]BCS @LAB_PRG14__9983 [9959]BEQ @LAB_PRG14__996f [995b]INC a:Sprite12BodyPartHandler_2_ [995e]DEC a:Sprite12BodyPartHandler_5_ [9961]DEC CurrentSprites_BehaviorData2,X [9964]BNE @_return [9966]LDA #$3c [9968]STA CurrentSprites_BehaviorData2,X [996b]INC CurrentSprites_InternalBehaviorStates,X [996e]@_return:; [$996e] [996e]RTS [996f]@LAB_PRG14__996f:; [$996f] [996f]DEC a:Sprite12BodyPartHandler_2_ [9972]INC a:Sprite12BodyPartHandler_5_ [9975]DEC CurrentSprites_BehaviorData2,X [9978]BNE @_return1 [997a]LDA #$3c [997c]STA CurrentSprites_BehaviorData2,X [997f]INC CurrentSprites_InternalBehaviorStates,X [9982]@_return1:; [$9982] [9982]RTS [9983]@LAB_PRG14__9983:; [$9983] [9983]DEC CurrentSprites_BehaviorData2,X [9986]BNE @_return2 [9988]INC CurrentSprites_InternalBehaviorStates,X [998b]LDA #$08 [998d]STA CurrentSprites_BehaviorData2,X [9990]@_return2:; [$9990] [9990]RTS
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18__9991 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; CALL_FUN_PRG14__9a2f [$PRG14::9a2f] ;============================================================================
[9991]SpriteBehavior_EnemyUnused18__9991:; [$9991] [9991]LDA CurrentSprites_BehaviorData2,X [9994]BEQ Maybe_SpriteBody__99f3 [9996]LDA CurrentSprites_InternalBehaviorStates,X [9999]AND #$0f [999b]BNE @LAB_PRG14__99dc [999d]LDA CurrentSprites_InternalBehaviorStates,X [99a0]BNE @LAB_PRG14__99b6 [99a2]LDA CurrentSprites_XPos_Full,X [99a4]LSR A [99a5]LSR A [99a6]LSR A [99a7]LSR A [99a8]STA Temp_00 [99aa]LDA CurrentSprites_YPos,X [99ac]AND #$f0 [99ae]ORA Temp_00 [99b0]STA a:Something_UnusedSprite_ScreenBufferOffset [99b3]JMP @LAB_PRG14__99d1 [99b6]@LAB_PRG14__99b6:; [$99b6] [99b6]LSR A [99b7]LSR A [99b8]LSR A [99b9]LSR A [99ba]AND #$03 [99bc]TAY [99bd]DEY [99be]LDA Sprite12BodyPartHandler,Y [99c1]LSR A [99c2]LSR A [99c3]LSR A [99c4]LSR A [99c5]STA Temp_00 [99c7]LDA Sprite12BodyPartHandler_3_,Y [99ca]AND #$f0 [99cc]ORA Temp_00 [99ce]STA a:Something_UnusedSprite_ScreenBufferOffset [99d1]@LAB_PRG14__99d1:; [$99d1] [99d1]LDY Area_CurrentArea [99d3]LDA BYTE_ARRAY_PRG14__99ef,Y [99d6]STA a:Something_UnusedSprite_BlockOffset [99d9]JSR SpriteBehavior_EnemyUnused18_SomethingSetBlocks [99dc]@LAB_PRG14__99dc:; [$99dc] [99dc]LDX a:CurrentSpriteIndex [99df]INC CurrentSprites_InternalBehaviorStates,X [99e2]LDA CurrentSprites_InternalBehaviorStates,X [99e5]AND #$c0 [99e7]BEQ @_return [99e9]LDA #$ff [99eb]STA CurrentSprites_Entities,X [99ee]@_return:; [$99ee] [99ee]RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused18__9991 ;
[99ef]BYTE_ARRAY_PRG14__99ef:; [$99ef] [99ef].byte $00; [0]: [99f0].byte $08; [1]: [99f1].byte $00; [2]: [99f2].byte $00; [3]:
;============================================================================ ; TODO: Document Maybe_SpriteBody__99f3 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_EnemyUnused18__9991 ;============================================================================
[99f3]Maybe_SpriteBody__99f3:; [$99f3] [99f3]LDY #$03 [99f5]LDA CurrentSprites_XPos_Full,X [99f7]CLC [99f8]ADC #$0f [99fa]CMP a:Sprite12BodyPartHandler [99fd]BCC @LAB_PRG14__9a03 [99ff]INC a:Sprite12BodyPartHandler [9a02]DEY [9a03]@LAB_PRG14__9a03:; [$9a03] [9a03]LDA CurrentSprites_XPos_Full,X [9a05]CLC [9a06]ADC #$1f [9a08]CMP a:Sprite12BodyPartHandler_1_ [9a0b]BCC @LAB_PRG14__9a11 [9a0d]INC a:Sprite12BodyPartHandler_1_ [9a10]DEY [9a11]@LAB_PRG14__9a11:; [$9a11] [9a11]LDA CurrentSprites_XPos_Full,X [9a13]CLC [9a14]ADC #$2f [9a16]CMP a:Sprite12BodyPartHandler_2_ [9a19]BCC @LAB_PRG14__9a1f [9a1b]INC a:Sprite12BodyPartHandler_2_ [9a1e]DEY [9a1f]@LAB_PRG14__9a1f:; [$9a1f] [9a1f]CPY #$03 [9a21]BNE @LAB_PRG14__9a2b [9a23]INC CurrentSprites_BehaviorData2,X [9a26]LDA #$00 [9a28]STA CurrentSprites_InternalBehaviorStates,X [9a2b]@LAB_PRG14__9a2b:; [$9a2b] [9a2b]RTS
; ; XREFS: ; SpriteBehavior_EnemyUnused18 ;
[9a2c]CALL_FUN_PRG14__994a:; [$9a2c] [9a2c]JMP SpriteBehavior_EnemyUnused18__994a
; ; XREFS: ; SpriteBehavior_EnemyUnused18 ;
[9a2f]CALL_FUN_PRG14__9a2f:; [$9a2f] [9a2f]JMP SpriteBehavior_EnemyUnused18__9991
;============================================================================ ; TODO: Document SpriteBehavior_EnemyUnused18 ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f3] ;============================================================================
[9a32]SpriteBehavior_EnemyUnused18:; [$9a32] [9a32]LDY CurrentSprites_Phases,X [9a35]BMI CALL_FUN_PRG14__9a2f [9a37]LDA CurrentSprites_BehaviorData3,X [9a3a]BNE 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] [9a3c]LDA CurrentSprites_Phases,X [9a3f]AND #$03 [9a41]STA CurrentSprites_Phases,X [9a44]ASL A [9a45]TAY [9a46]LDA MAYBE_BODY_HANDLERS+1,Y [9a49]PHA [9a4a]LDA MAYBE_BODY_HANDLERS,Y [9a4d]PHA [9a4e]RTS
; ; XREFS: ; FUN_PRG14__9a3c ;
[9a4f]MAYBE_BODY_HANDLERS:; [$9a4f] [9a4f]pointer Maybe_BodyHandler__9a57-1; [0]: [9a51]pointer Maybe_BodyHandler__9a7a-1; [1]: [9a53]pointer Maybe_BodyHandler__9a7a-1; [2]: [9a55]pointer 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] [9a57]JSR FUN_PRG14__9a87 [9a5a]LDX BYTE_ARRAY_PRG14__9a91,Y [9a5d]DEX [9a5e]INC Sprite12BodyPartHandler,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document FUN_PRG14__9a61 ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; Maybe_BodyHandler__9a7a ;============================================================================
[9a61]FUN_PRG14__9a61:; [$9a61] [9a61]LDX a:CurrentSpriteIndex [9a64]INC CurrentSprites_BehaviorData2,X [9a67]LDA CurrentSprites_BehaviorData2,X [9a6a]CMP #$40 [9a6c]BCC @_return [9a6e]INC CurrentSprites_Phases,X [9a71]LDA #$00 [9a73]STA CurrentSprites_BehaviorData2,X [9a76]JMP FUN_PRG14__9aa1 [9a79]@_return:; [$9a79] [9a79]RTS
;============================================================================ ; 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] [9a7a]JSR FUN_PRG14__9a87 [9a7d]LDX BYTE_ARRAY_PRG14__9a99,Y [9a80]DEX [9a81]DEC Sprite12BodyPartHandler,X [9a84]JMP FUN_PRG14__9a61
;============================================================================ ; TODO: Document FUN_PRG14__9a87 ; ; INPUTS: ; X ; ; OUTPUTS: ; A ; ; XREFS: ; Maybe_BodyHandler__9a57 ; Maybe_BodyHandler__9a7a ;============================================================================
[9a87]FUN_PRG14__9a87:; [$9a87] [9a87]LDA CurrentSprites_BehaviorData2,X [9a8a]LSR A [9a8b]LSR A [9a8c]LSR A [9a8d]AND #$07 [9a8f]TAY [9a90]RTS
; ; XREFS: ; Maybe_BodyHandler__9a57 ;
[9a91]BYTE_ARRAY_PRG14__9a91:; [$9a91] [9a91].byte $00; [0]: [9a92].byte $01; [1]: [9a93].byte $02; [2]: [9a94].byte $03; [3]: [9a95].byte $02; [4]: [9a96].byte $03; [5]: [9a97].byte $03; [6]: [9a98].byte $00; [7]:
; ; XREFS: ; Maybe_BodyHandler__9a7a ;
[9a99]BYTE_ARRAY_PRG14__9a99:; [$9a99] [9a99].byte $00; [0]: [9a9a].byte $03; [1]: [9a9b].byte $03; [2]: [9a9c].byte $02; [3]: [9a9d].byte $03; [4]: [9a9e].byte $02; [5]: [9a9f].byte $01; [6]: [9aa0].byte $00; [7]:
;============================================================================ ; TODO: Document FUN_PRG14__9aa1 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; FUN_PRG14__9a61 ;============================================================================
[9aa1]FUN_PRG14__9aa1:; [$9aa1] [9aa1]LDA CurrentSprites_XPos_Full,X [9aa3]SEC [9aa4]SBC Player_PosX_Block [9aa6]BCS @LAB_PRG14__9aac [9aa8]EOR #$ff [9aaa]ADC #$01 [9aac]@LAB_PRG14__9aac:; [$9aac] [9aac]CMP #$40 [9aae]BCS @LAB_PRG14__9ac0 [9ab0]LDA #$01 [9ab2]STA CurrentSprites_BehaviorData3,X [9ab5]LDA #$00 [9ab7]STA CurrentSprites_InternalBehaviorStates,X [9aba]LDA #$08 [9abc]STA CurrentSprites_BehaviorData2,X [9abf]RTS [9ac0]@LAB_PRG14__9ac0:; [$9ac0] [9ac0]LDA #$00 [9ac2]STA CurrentSprites_BehaviorData3,X [9ac5]RTS
;============================================================================ ; TODO: Document FUN_PRG14__9ac6 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[9ac6]FUN_PRG14__9ac6:; [$9ac6] [9ac6]LDA #$80 [9ac8]STA CurrentSprites_Phases,X [9acb]LDA #$00 [9acd]STA CurrentSprites_BehaviorData2,X [9ad0]STA CurrentSprites_BehaviorData3,X [9ad3]LDA CurrentSprites_YPos,X [9ad5]SEC [9ad6]SBC #$30 [9ad8]STA a:Sprite12BodyPartHandler_5_ [9adb]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ab] ;============================================================================
[9adc]SpriteUpdateHandler_Enemy_Unused_SnakeRoundPart:; [$9adc] [9adc]JSR CurrentSprite_UpdateFlipMask [9adf]LDA #$04 [9ae1]JSR Sprite_EnterNextAppearancePhase [9ae4]LDX a:CurrentSpriteIndex [9ae7]LDA a:Sprite12BodyPartHandler [9aea]STA Arg_DrawSprite_PosX [9aec]LDA a:Sprite12BodyPartHandler_3_ [9aef]STA Arg_DrawSprite_PosY [9af1]LDA CurrentSprites_PPUOffsets,X [9af4]STA Sprites_PPUOffset [9af6]LDA #$04 [9af8]JSR Sprite_EnterNextAppearancePhase [9afb]LDX a:CurrentSpriteIndex [9afe]LDA a:Sprite12BodyPartHandler_1_ [9b01]STA Arg_DrawSprite_PosX [9b03]LDA a:Sprite12BodyPartHandler_4_ [9b06]STA Arg_DrawSprite_PosY [9b08]LDA CurrentSprites_PPUOffsets,X [9b0b]STA Sprites_PPUOffset [9b0d]LDA #$04 [9b0f]JSR Sprite_EnterNextAppearancePhase [9b12]LDX a:CurrentSpriteIndex [9b15]LDA a:Sprite12BodyPartHandler_2_ [9b18]STA Arg_DrawSprite_PosX [9b1a]LDA a:Sprite12BodyPartHandler_5_ [9b1d]STA Arg_DrawSprite_PosY [9b1f]LDA CurrentSprites_PPUOffsets,X [9b22]STA Sprites_PPUOffset [9b24]LDA CurrentSprites_BehaviorData3,X [9b27]BNE @LAB_PRG14__9b36 [9b29]LDY #$02 [9b2b]LDA a:SpriteUpdateCounter [9b2e]AND #$08 [9b30]BEQ @LAB_PRG14__9b41 [9b32]LDY #$03 [9b34]BNE @LAB_PRG14__9b41 [9b36]@LAB_PRG14__9b36:; [$9b36] [9b36]LDY #$00 [9b38]LDA a:SpriteUpdateCounter [9b3b]AND #$08 [9b3d]BEQ @LAB_PRG14__9b41 [9b3f]LDY #$01 [9b41]@LAB_PRG14__9b41:; [$9b41] [9b41]TYA [9b42]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ripasheiku ;============================================================================
[9b45]SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos:; [$9b45] [9b45]LDA a:SpriteUpdateCounter [9b48]AND #$3f [9b4a]CMP #$20 [9b4c]BNE @LAB_PRG14__9b68 [9b4e]LDA CurrentSprites_Flags,X [9b51]AND #$01 [9b53]TAY [9b54]LDA CurrentSprites_XPos_Full,X [9b56]CLC [9b57]ADC BYTE_ARRAY_PRG14__9b81,Y [9b5a]STA a:CurrentSprite_Arg_CastMagicX [9b5d]LDA CurrentSprites_YPos,X [9b5f]CLC [9b60]ADC #$20 [9b62]STA a:CurrentSprite_Arg_CastMagicY [9b65]JSR Sprite_CastMagic [9b68]@LAB_PRG14__9b68:; [$9b68] [9b68]JSR BScript_Action_FacePlayerX [9b6b]DEC CurrentSprites_BehaviorData2,X [9b6e]BNE @_return [9b70]LDA #$01 [9b72]STA CurrentSprites_Phases,X [9b75]LDA #$00 [9b77]STA CurrentSprites_BehaviorData2,X [9b7a]STA CurrentSprites_BehaviorData3,X [9b7d]JSR BScript_Action_FacePlayerX [9b80]@_return:; [$9b80] [9b80]RTS
; ; XREFS: ; SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ;
[9b81]BYTE_ARRAY_PRG14__9b81:; [$9b81] [9b81].byte $10; [0]: [9b82].byte $00; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_Ripasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5fb] ;============================================================================
[9b83]SpriteBehavior_Ripasheiku:; [$9b83] [9b83]LDA a:Sprite_IsBehaviorNotReady [9b86]BNE @LAB_PRG14__9b9a [9b88]LDA #$03 [9b8a]STA CurrentSprites_HitBoxTypes,X [9b8d]LDA #$1e [9b8f]STA CurrentSprites_BehaviorData2,X [9b92]LDA #$00 [9b94]STA CurrentSprites_Phases,X [9b97]JSR Sprite_SetBehaviorReady [9b9a]@LAB_PRG14__9b9a:; [$9b9a] [9b9a]LDY CurrentSprites_Phases,X [9b9d]BEQ @LAB_PRG14__9ba8 [9b9f]DEY [9ba0]BEQ @LAB_PRG14__9bbc [9ba2]DEY [9ba3]BNE SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos [9ba5]JMP @LAB_PRG14__9c0e [9ba8]@LAB_PRG14__9ba8:; [$9ba8] [9ba8]JSR BScript_Action_FacePlayerX [9bab]DEC CurrentSprites_BehaviorData2,X [9bae]BNE @_return [9bb0]INC CurrentSprites_Phases,X [9bb3]LDA #$00 [9bb5]STA CurrentSprites_BehaviorData2,X [9bb8]STA CurrentSprites_BehaviorData3,X [9bbb]@_return:; [$9bbb] [9bbb]RTS [9bbc]@LAB_PRG14__9bbc:; [$9bbc] [9bbc]JSR Sprite_MoveHorizOneBlockOrTurnAround [9bbf]LDA CurrentSprites_Flags,X [9bc2]AND #$7f [9bc4]STA CurrentSprites_Flags,X [9bc7]LDA CurrentSprites_YPos,X [9bc9]CMP #$30 [9bcb]BCC @LAB_PRG14__9bfe [9bcd]LDA CurrentSprites_BehaviorData3,X [9bd0]BPL @LAB_PRG14__9bde [9bd2]LDA #$04 [9bd4]STA a:Arg_DeltaY_Full [9bd7]LDA #$00 [9bd9]STA a:Arg_DeltaY_Frac [9bdc]BEQ @LAB_PRG14__9be8 [9bde]@LAB_PRG14__9bde:; [$9bde] [9bde]LDY #$03 [9be0]JSR Sprites_CalcYFromGravity [9be3]LDY #$05 [9be5]JSR Sprites_CalcVerticalSpriteMovement [9be8]@LAB_PRG14__9be8:; [$9be8] [9be8]JSR Sprite_MoveVertical [9beb]BCS @_return2 [9bed]INC CurrentSprites_BehaviorData3,X [9bf0]LDA CurrentSprites_BehaviorData3,X [9bf3]AND #$1f [9bf5]BNE @_return1 [9bf7]LDA #$ff [9bf9]STA CurrentSprites_BehaviorData3,X [9bfc]@_return1:; [$9bfc] [9bfc]RTS [9bfd]@_return2:; [$9bfd] [9bfd]RTS [9bfe]@LAB_PRG14__9bfe:; [$9bfe] [9bfe]LDA #$00 [9c00]STA CurrentSprites_BehaviorData2,X [9c03]LDA #$ff [9c05]STA CurrentSprites_BehaviorData3,X [9c08]INC CurrentSprites_Phases,X [9c0b]JMP BScript_Action_FacePlayerX [9c0e]@LAB_PRG14__9c0e:; [$9c0e] [9c0e]JSR Sprite_MoveHorizOneBlockOrTurnAround [9c11]LDA CurrentSprites_Flags,X [9c14]ORA #$80 [9c16]STA CurrentSprites_Flags,X [9c19]LDA CurrentSprites_BehaviorData3,X [9c1c]LDY #$02 [9c1e]JSR Sprites_CalcVerticalSpriteMovement [9c21]JSR Sprite_MoveVertical [9c24]BCS @LAB_PRG14__9c31 [9c26]LDA CurrentSprites_BehaviorData3,X [9c29]SEC [9c2a]SBC #$04 [9c2c]STA CurrentSprites_BehaviorData3,X [9c2f]BCS @_return3 [9c31]@LAB_PRG14__9c31:; [$9c31] [9c31]INC CurrentSprites_Phases,X [9c34]LDA #$00 [9c36]STA CurrentSprites_BehaviorData2,X [9c39]STA CurrentSprites_BehaviorData3,X [9c3c]STA CurrentSprites_InternalBehaviorStates,X [9c3f]JSR BScript_Action_FacePlayerX [9c42]@_return3:; [$9c42] [9c42]RTS
;============================================================================ ; TODO: Document Sprite_MoveHorizOneBlockOrTurnAround ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Ripasheiku ;============================================================================
[9c43]Sprite_MoveHorizOneBlockOrTurnAround:; [$9c43] [9c43]LDA #$01 [9c45]STA a:Arg_DeltaX_Full [9c48]LDA #$00 [9c4a]STA a:Arg_DeltaX_Frac [9c4d]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [9c50]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Ripasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e1] ;============================================================================
[9c51]SpriteUpdateHandler_Boss_Ripasheiku:; [$9c51] [9c51]JSR CurrentSprite_UpdateFlipMask [9c54]LDY #$00 [9c56]LDA CurrentSprites_Phases,X [9c59]BEQ @LAB_PRG14__9c6a [9c5b]CMP #$03 [9c5d]BEQ @LAB_PRG14__9c6e [9c5f]LDY #$01 [9c61]LDA a:SpriteUpdateCounter [9c64]AND #$08 [9c66]BEQ @LAB_PRG14__9c6a [9c68]LDY #$02 [9c6a]@LAB_PRG14__9c6a:; [$9c6a] [9c6a]TYA [9c6b]JMP Sprite_EnterNextAppearancePhase [9c6e]@LAB_PRG14__9c6e:; [$9c6e] [9c6e]LDY #$01 [9c70]LDA a:SpriteUpdateCounter [9c73]AND #$20 [9c75]BEQ @LAB_PRG14__9c6a [9c77]LDY #$03 [9c79]BNE @LAB_PRG14__9c6a
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Zoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e3] ;============================================================================
[9c7b]SpriteUpdateHandler_Boss_Zoradohna:; [$9c7b] [9c7b]JSR CurrentSprite_UpdateFlipMask [9c7e]LDA a:SpriteUpdateCounter [9c81]LSR A [9c82]LSR A [9c83]LSR A [9c84]AND #$03 [9c86]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Borabohra ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ff] ;============================================================================
[9c89]SpriteBehavior_Borabohra:; [$9c89] [9c89]JSR Sprite_IsBehaviorNotReady [9c8c]BNE @LAB_PRG14__9c9e [9c8e]LDA #$02 [9c90]STA CurrentSprites_HitBoxTypes,X [9c93]LDA #$00 [9c95]STA CurrentSprites_BehaviorData2,X [9c98]STA CurrentSprites_Phases,X [9c9b]JSR Sprite_SetBehaviorReady [9c9e]@LAB_PRG14__9c9e:; [$9c9e] [9c9e]LDA CurrentSprites_Phases,X [9ca1]LSR A [9ca2]BCS @LAB_PRG14__9cb5 [9ca4]INC CurrentSprites_BehaviorData2,X [9ca7]LDA CurrentSprites_BehaviorData2,X [9caa]CMP #$14 [9cac]BCC @_return1 [9cae]INC CurrentSprites_Phases,X [9cb1]JSR BScript_Action_FacePlayerX [9cb4]@_return1:; [$9cb4] [9cb4]RTS [9cb5]@LAB_PRG14__9cb5:; [$9cb5] [9cb5]LDA CurrentSprites_BehaviorData2,X [9cb8]LDY #$02 [9cba]JSR Sprites_CalcYFromGravity [9cbd]LDY #$02 [9cbf]JSR Sprites_CalcHorizSpriteMovement [9cc2]JSR Sprites_Something_SomethingAndMoveHoriz [9cc5]INC CurrentSprites_BehaviorData2,X [9cc8]AND #$7f [9cca]BNE @_return2 [9ccc]JSR BScript_Action_FacePlayerX [9ccf]@_return2:; [$9ccf] [9ccf]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Borabohra ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e5] ;============================================================================
[9cd0]SpriteUpdateHandler_Boss_Borabohra:; [$9cd0] [9cd0]JSR CurrentSprite_UpdateFlipMask [9cd3]LDA CurrentSprites_Phases,X [9cd6]LSR A [9cd7]BCS @LAB_PRG14__9ce2 [9cd9]LDA CurrentSprites_BehaviorData2,X [9cdc]LSR A [9cdd]LSR A [9cde]TAY [9cdf]JMP @LAB_PRG14__9ced [9ce2]@LAB_PRG14__9ce2:; [$9ce2] [9ce2]LDA a:SpriteUpdateCounter [9ce5]LSR A [9ce6]LSR A [9ce7]AND #$06 [9ce9]CLC [9cea]ADC #$08 [9cec]TAY [9ced]@LAB_PRG14__9ced:; [$9ced] [9ced]TYA [9cee]LSR A [9cef]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Pakukame ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a601] ;============================================================================
[9cf2]SpriteBehavior_Pakukame:; [$9cf2] [9cf2]JSR Sprite_IsBehaviorNotReady [9cf5]BNE @LAB_PRG14__9d07 [9cf7]LDA #$00 [9cf9]STA CurrentSprites_Phases,X [9cfc]STA CurrentSprites_BehaviorData2,X [9cff]LDA #$04 [9d01]STA CurrentSprites_HitBoxTypes,X [9d04]JSR Sprite_SetBehaviorReady [9d07]@LAB_PRG14__9d07:; [$9d07] [9d07]LDA CurrentSprites_Phases,X [9d0a]CMP #$01 [9d0c]BCS @LAB_PRG14__9d2b [9d0e]INC CurrentSprites_BehaviorData2,X [9d11]LDA CurrentSprites_BehaviorData2,X [9d14]CMP #$40 [9d16]BCC @_return1 [9d18]JSR Sprites_HasMaxOnScreen [9d1b]BCS @_return1 [9d1d]JSR SpriteBehavior_Pakukame__9d78 [9d20]BCS @_return1 [9d22]INC CurrentSprites_Phases,X [9d25]LDA #$12 [9d27]JSR Sound_PlayEffect [9d2a]@_return1:; [$9d2a] [9d2a]RTS [9d2b]@LAB_PRG14__9d2b:; [$9d2b] [9d2b]LDA a:SpriteUpdateCounter [9d2e]AND #$07 [9d30]BNE @_return2 [9d32]INC CurrentSprites_Phases,X [9d35]LDA CurrentSprites_Phases,X [9d38]CMP #$05 [9d3a]BCC @LAB_PRG14__9d45 [9d3c]LDA #$00 [9d3e]STA CurrentSprites_Phases,X [9d41]STA CurrentSprites_BehaviorData2,X [9d44]@_return2:; [$9d44] [9d44]RTS [9d45]@LAB_PRG14__9d45:; [$9d45] [9d45]CMP #$03 [9d47]BNE @_return2 [9d49]JSR Sprites_HasMaxOnScreen [9d4c]BCS @_return2 [9d4e]LDA CurrentSprites_YPos,X [9d50]ADC #$10 [9d52]STA CurrentSprites_YPos,Y [9d55]LDA CurrentSprites_XPos_Full,X [9d57]ADC #$08 [9d59]STA CurrentSprites_XPos_Full,Y [9d5c]LDA #$9e [9d5e]STA CurrentSprites_PPUOffsets,Y [9d61]LDA #$00 [9d63]STA CurrentSprites_Flags,Y [9d66]LDA #$09 [9d68]STA CurrentSprites_Entities,Y [9d6b]TAX [9d6c]LDA SPRITE_ENTITIES_HP,X [9d6f]STA CurrentSprites_HP,Y [9d72]LDX a:CurrentSpriteIndex [9d75]JMP Sprite_Maybe_ResetState
;============================================================================ ; TODO: Document SpriteBehavior_Pakukame__9d78 ; ; INPUTS: ; None. ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_Pakukame ;============================================================================
[9d78]SpriteBehavior_Pakukame__9d78:; [$9d78] [9d78]LDY #$07 [9d7a]LDA #$00 [9d7c]STA Temp_00 [9d7e]@LAB_PRG14__9d7e:; [$9d7e] [9d7e]LDA CurrentSprites_Entities,Y [9d81]CMP #$09 [9d83]BNE @LAB_PRG14__9d8f [9d85]INC Temp_00 [9d87]LDA Temp_00 [9d89]CMP #$03 [9d8b]BCC @LAB_PRG14__9d8f [9d8d]SEC [9d8e]RTS [9d8f]@LAB_PRG14__9d8f:; [$9d8f] [9d8f]DEY [9d90]BPL @LAB_PRG14__9d7e [9d92]CLC [9d93]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Pakukame ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e7] ;============================================================================
[9d94]SpriteUpdateHandler_Boss_Pakukame:; [$9d94] [9d94]LDY #$00 [9d96]LDA CurrentSprites_Phases,X [9d99]BEQ @LAB_PRG14__9d9f [9d9b]LDY CurrentSprites_Phases,X [9d9e]DEY [9d9f]@LAB_PRG14__9d9f:; [$9d9f] [9d9f]LDA BYTE_ARRAY_PRG14__9da5,Y [9da2]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_Pakukame ;
[9da5]BYTE_ARRAY_PRG14__9da5:; [$9da5] [9da5].byte $00; [0]: [9da6].byte $01; [1]: [9da7].byte $02; [2]: [9da8].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a603] ;============================================================================
[9da9]SpriteBehavior_Zorugeriru:; [$9da9] [9da9]JSR Sprite_IsBehaviorNotReady [9dac]BNE @LAB_PRG14__9dbe [9dae]LDA #$04 [9db0]STA CurrentSprites_HitBoxTypes,X [9db3]LDA #$00 [9db5]STA CurrentSprites_BehaviorData2,X [9db8]STA CurrentSprites_Phases,X [9dbb]JSR Sprite_SetBehaviorReady [9dbe]@LAB_PRG14__9dbe:; [$9dbe] [9dbe]LDA CurrentSprites_Phases,X [9dc1]LSR A [9dc2]BCS @LAB_PRG14__9de1 [9dc4]DEC CurrentSprites_BehaviorData2,X [9dc7]LDA CurrentSprites_BehaviorData2,X [9dca]AND #$0f [9dcc]BNE @_return1 [9dce]JSR Sprites_HasMaxOnScreen [9dd1]BCS @_return1 [9dd3]JSR SpriteBehavior_Zorugeriru__9df7 [9dd6]BCS @_return1 [9dd8]INC CurrentSprites_Phases,X [9ddb]LDA #$00 [9ddd]STA CurrentSprites_BehaviorData2,X [9de0]@_return1:; [$9de0] [9de0]RTS [9de1]@LAB_PRG14__9de1:; [$9de1] [9de1]INC CurrentSprites_BehaviorData2,X [9de4]LDA CurrentSprites_BehaviorData2,X [9de7]CMP #$20 [9de9]BCC @_return2 [9deb]INC CurrentSprites_Phases,X [9dee]LDA #$3c [9df0]STA CurrentSprites_BehaviorData2,X [9df3]JMP SpriteBehavior_Zorugeriru__9e13 [9df6]@_return2:; [$9df6] [9df6]RTS
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru__9df7 ; ; INPUTS: ; None. ; ; OUTPUTS: ; C ; ; XREFS: ; SpriteBehavior_Zorugeriru ;============================================================================
[9df7]SpriteBehavior_Zorugeriru__9df7:; [$9df7] [9df7]LDY #$07 [9df9]LDA #$00 [9dfb]STA Temp_00 [9dfd]@LAB_PRG14__9dfd:; [$9dfd] [9dfd]LDA CurrentSprites_Entities,Y [9e00]CMP #$03 [9e02]BNE @LAB_PRG14__9e0e [9e04]INC Temp_00 [9e06]LDA Temp_00 [9e08]CMP #$04 [9e0a]BCC @LAB_PRG14__9e0e [9e0c]SEC [9e0d]RTS [9e0e]@LAB_PRG14__9e0e:; [$9e0e] [9e0e]DEY [9e0f]BPL @LAB_PRG14__9dfd [9e11]CLC
; ; XREFS: ; SpriteBehavior_Zorugeriru__9e13 ;
[9e12]RETURN_9E12:; [$9e12] [9e12]RTS
;============================================================================ ; TODO: Document SpriteBehavior_Zorugeriru__9e13 ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Zorugeriru ;============================================================================
[9e13]SpriteBehavior_Zorugeriru__9e13:; [$9e13] [9e13]JSR Sprites_HasMaxOnScreen [9e16]BCS RETURN_9E12 [9e18]LDA #$03 [9e1a]STA CurrentSprites_Entities,Y [9e1d]LDA #$00 [9e1f]STA CurrentSprites_Phases,Y [9e22]STA CurrentSprites_Flags,Y [9e25]LDA #$ff [9e27]STA CurrentSprites_HitByMagicBehavior,Y [9e2a]LDA CurrentSprites_XPos_Full,X [9e2c]CLC [9e2d]ADC #$10 [9e2f]STA Temp_00 [9e31]LDA Player_PosX_Block [9e33]CMP CurrentSprites_XPos_Full,X [9e35]BCC @LAB_PRG14__9e3e [9e37]CMP Temp_00 [9e39]BCS @LAB_PRG14__9e3e [9e3b]SEC [9e3c]SBC #$10 [9e3e]@LAB_PRG14__9e3e:; [$9e3e] [9e3e]STA CurrentSprites_XPos_Full,Y [9e41]LDA #$20 [9e43]STA CurrentSprites_YPos,Y [9e46]LDA CurrentSprites_PPUOffsets,X [9e49]STA CurrentSprites_PPUOffsets,Y [9e4c]JMP Sprite_Maybe_ResetState
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_Zorugeriru ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80e9] ;============================================================================
[9e4f]SpriteUpdateHandler_Boss_Zorugeriru:; [$9e4f] [9e4f]JSR CurrentSprite_UpdateFlipMask [9e52]LDY #$00 [9e54]LDA CurrentSprites_Phases,X [9e57]LSR A [9e58]BCC @LAB_PRG14__9e63 [9e5a]LDA a:SpriteUpdateCounter [9e5d]LSR A [9e5e]LSR A [9e5f]LSR A [9e60]AND #$03 [9e62]TAY [9e63]@LAB_PRG14__9e63:; [$9e63] [9e63]LDA BYTE_ARRAY_PRG14__9e69,Y [9e66]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_Zorugeriru ;
[9e69]BYTE_ARRAY_PRG14__9e69:; [$9e69] [9e69].byte $00; [0]: [9e6a].byte $01; [1]: [9e6b].byte $02; [2]: [9e6c].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_Garbled3 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ed] ;============================================================================
[9e6d]SpriteBehavior_Garbled3:; [$9e6d] [9e6d]JSR Sprite_IsBehaviorNotReady [9e70]BNE @LAB_PRG14__9e82 [9e72]LDA #$00 [9e74]STA CurrentSprites_HitBoxTypes,X [9e77]LDA #$00 [9e79]STA CurrentSprites_BehaviorData3,X [9e7c]STA CurrentSprites_Phases,X [9e7f]JSR Sprite_SetBehaviorReady [9e82]@LAB_PRG14__9e82:; [$9e82] [9e82]LDY CurrentSprites_Phases,X [9e85]DEY [9e86]BEQ @LAB_PRG14__9ebc [9e88]DEY [9e89]BEQ @LAB_PRG14__9ed9 [9e8b]LDA CurrentSprites_Flags,X [9e8e]ORA #$80 [9e90]STA CurrentSprites_Flags,X [9e93]LDA CurrentSprites_BehaviorData3,X [9e96]LDY #$05 [9e98]JSR Sprites_CalcVerticalSpriteMovement [9e9b]JSR Sprite_MoveVertical [9e9e]BCS @LAB_PRG14__9eae [9ea0]INC CurrentSprites_BehaviorData3,X [9ea3]LDA CurrentSprites_BehaviorData3,X [9ea6]CMP #$41 [9ea8]BCC @_return1 [9eaa]DEC CurrentSprites_BehaviorData3,X [9ead]RTS [9eae]@LAB_PRG14__9eae:; [$9eae] [9eae]INC CurrentSprites_Phases,X [9eb1]LDA #$05 [9eb3]STA CurrentSprites_BehaviorData2,X [9eb6]LDA #$07 [9eb8]JSR Sound_PlayEffect [9ebb]@_return1:; [$9ebb] [9ebb]RTS [9ebc]@LAB_PRG14__9ebc:; [$9ebc] [9ebc]LDA CurrentSprites_BehaviorData2,X [9ebf]AND #$01 [9ec1]ASL A [9ec2]ASL A [9ec3]SEC [9ec4]SBC #$02 [9ec6]CLC [9ec7]ADC CurrentSprites_YPos,X [9ec9]STA CurrentSprites_YPos,X [9ecb]DEC CurrentSprites_BehaviorData2,X [9ece]BNE @_return2 [9ed0]LDA #$0f [9ed2]STA CurrentSprites_BehaviorData2,X [9ed5]INC CurrentSprites_Phases,X [9ed8]@_return2:; [$9ed8] [9ed8]RTS [9ed9]@LAB_PRG14__9ed9:; [$9ed9] [9ed9]DEC CurrentSprites_BehaviorData2,X [9edc]BNE @_return3 [9ede]LDA #$ff [9ee0]STA CurrentSprites_Entities,X [9ee3]@_return3:; [$9ee3] [9ee3]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Garbled03 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::808d] ;============================================================================
[9ee4]SpriteUpdateHandler_Garbled03:; [$9ee4] [9ee4]JSR CurrentSprite_UpdateFlipMask [9ee7]LDY #$03 [9ee9]LDA CurrentSprites_Phases,X [9eec]CMP #$02 [9eee]BCC @LAB_PRG14__9eff [9ef0]LDA CurrentSprites_BehaviorData2,X [9ef3]CMP #$0a [9ef5]BCS @LAB_PRG14__9eff [9ef7]LDY #$03 [9ef9]CMP #$05 [9efb]BCS @LAB_PRG14__9eff [9efd]LDY #$05 [9eff]@LAB_PRG14__9eff:; [$9eff] [9eff]TYA [9f00]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a605] ;============================================================================
[9f03]SpriteBehavior_KingGrieve:; [$9f03] [9f03]JSR Sprite_IsBehaviorNotReady [9f06]BNE @LAB_PRG14__9f1d [9f08]LDA #$05 [9f0a]STA CurrentSprites_HitBoxTypes,X [9f0d]LDA #$ff [9f0f]STA CurrentSprites_BehaviorData3,X [9f12]LDA #$00 [9f14]STA CurrentSprites_BehaviorData2,X [9f17]STA CurrentSprites_Phases,X [9f1a]JSR Sprite_SetBehaviorReady [9f1d]@LAB_PRG14__9f1d:; [$9f1d] [9f1d]LDA CurrentSprites_Phases,X [9f20]AND #$03 [9f22]TAY [9f23]BEQ @LAB_PRG14__9f2e [9f25]DEY [9f26]BEQ SpriteBehavior_KingGrieve_9f65 [9f28]DEY [9f29]BEQ SpriteBehavior_KingGrieve_MoveDown [9f2b]JMP SpriteBehavior_KingGrieve_9f86 [9f2e]@LAB_PRG14__9f2e:; [$9f2e] [9f2e]LDA #$01 [9f30]STA a:Arg_DeltaX_Full [9f33]LDA #$00 [9f35]STA a:Arg_DeltaX_Frac [9f38]JSR Sprites_Something_SomethingAndMoveHoriz [9f3b]LDA CurrentSprites_Flags,X [9f3e]ORA #$80 [9f40]STA CurrentSprites_Flags,X [9f43]LDA CurrentSprites_BehaviorData3,X [9f46]LDY #$02 [9f48]JSR Sprites_CalcVerticalSpriteMovement [9f4b]JSR Sprite_MoveVertical [9f4e]BCS @LAB_PRG14__9f5c [9f50]LDA CurrentSprites_BehaviorData3,X [9f53]SEC [9f54]SBC #$02 [9f56]STA CurrentSprites_BehaviorData3,X [9f59]BCC @LAB_PRG14__9f5c [9f5b]RTS [9f5c]@LAB_PRG14__9f5c:; [$9f5c] [9f5c]INC CurrentSprites_Phases,X [9f5f]LDA #$3c [9f61]STA CurrentSprites_BehaviorData2,X [9f64]RTS
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve_9f65 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve ;============================================================================
[9f65]SpriteBehavior_KingGrieve_9f65:; [$9f65] [9f65]LDA a:SpriteUpdateCounter [9f68]AND #$0f [9f6a]BNE SpriteBehavior_KingGrieve_9f86 [9f6c]LDA CurrentSprites_Flags,X [9f6f]AND #$01 [9f71]TAY [9f72]LDA CurrentSprites_XPos_Full,X [9f74]CLC [9f75]ADC BYTE_ARRAY_PRG14__9f9c,Y [9f78]STA a:CurrentSprite_Arg_CastMagicX [9f7b]LDA CurrentSprites_YPos,X [9f7d]CLC [9f7e]ADC #$04 [9f80]STA a:CurrentSprite_Arg_CastMagicY [9f83]JSR 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] [9f86]JSR BScript_Action_FacePlayerX [9f89]DEC CurrentSprites_BehaviorData2,X [9f8c]BNE @LAB_PRG14__9f9b [9f8e]INC CurrentSprites_Phases,X [9f91]LDA #$ff [9f93]STA CurrentSprites_BehaviorData3,X [9f96]LDA #$00 [9f98]STA CurrentSprites_BehaviorData2,X [9f9b]@LAB_PRG14__9f9b:; [$9f9b] [9f9b]RTS
; ; XREFS: ; SpriteBehavior_KingGrieve_9f65 ;
[9f9c]BYTE_ARRAY_PRG14__9f9c:; [$9f9c] [9f9c].byte $00; [0]: [9f9d].byte $30; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_KingGrieve_MoveDown ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve ;============================================================================
[9f9e]SpriteBehavior_KingGrieve_MoveDown:; [$9f9e] [9f9e]LDA CurrentSprites_Flags,X [9fa1]AND #$7f [9fa3]STA CurrentSprites_Flags,X [9fa6]LDA #$00 [9fa8]STA a:Arg_DeltaY_Frac [9fab]LDA #$01 [9fad]STA a:Arg_DeltaY_Full [9fb0]JSR Sprite_MoveVertical [9fb3]BCS @LAB_PRG14__9fbb [9fb5]LDA CurrentSprites_YPos,X [9fb7]CMP #$10 [9fb9]BCS @LAB_PRG14__9fc3 [9fbb]@LAB_PRG14__9fbb:; [$9fbb] [9fbb]INC CurrentSprites_Phases,X [9fbe]LDA #$1e [9fc0]STA CurrentSprites_BehaviorData2,X [9fc3]@LAB_PRG14__9fc3:; [$9fc3] [9fc3]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_KingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80eb] ;============================================================================
[9fc4]SpriteUpdateHandler_Boss_KingGrieve:; [$9fc4] [9fc4]JSR CurrentSprite_UpdateFlipMask [9fc7]LDY #$02 [9fc9]LDA CurrentSprites_Phases,X [9fcc]AND #$03 [9fce]BEQ @LAB_PRG14__9fd9 [9fd0]LDA a:SpriteUpdateCounter [9fd3]LSR A [9fd4]LSR A [9fd5]LSR A [9fd6]AND #$03 [9fd8]TAY [9fd9]@LAB_PRG14__9fd9:; [$9fd9] [9fd9]LDA BYTE_ARRAY_PRG14__9fdf,Y [9fdc]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Boss_KingGrieve ;
[9fdf]BYTE_ARRAY_PRG14__9fdf:; [$9fdf] [9fdf].byte $00; [0]: [9fe0].byte $01; [1]:
; ; XREFS: ; SpriteUpdateHandler_Boss_KingGrieve ;
[9fe1]BYTE_ARRAY_PRG14__9fdf_2_:; [$9fe1] [9fe1].byte $02; [2]: [9fe2].byte $01; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a607] ;============================================================================
[9fe3]SpriteBehavior_ShadowEura:; [$9fe3] [9fe3]JSR Sprite_IsBehaviorNotReady [9fe6]BNE @LAB_PRG14__a007 [9fe8]LDA #$06 [9fea]STA CurrentSprites_HitBoxTypes,X [9fed]LDA #$00 [9fef]STA CurrentSprites_InternalBehaviorStates,X [9ff2]STA CurrentSprites_BehaviorData3,X [9ff5]STA CurrentSprites_Phases,X [9ff8]LDA #$14 [9ffa]STA CurrentSprites_BehaviorData2,X [9ffd]JSR BScript_Action_FacePlayerX [a000]JSR Sprite_SetBehaviorReady [a003]LDA #$0a [a005]STA Music_Current [a007]@LAB_PRG14__a007:; [$a007] [a007]JSR BScript_Action_FacePlayerX [a00a]LDA CurrentSprites_Phases,X [a00d]LSR A [a00e]BCS @LAB_PRG14__a053 [a010]INC CurrentSprites_BehaviorData3,X [a013]LDA CurrentSprites_BehaviorData3,X [a016]AND #$07 [a018]BNE @LAB_PRG14__a052 [a01a]INC CurrentSprites_InternalBehaviorStates,X [a01d]LDA CurrentSprites_InternalBehaviorStates,X [a020]CMP #$0a [a022]BCC @LAB_PRG14__a029 [a024]LDA #$00 [a026]STA CurrentSprites_InternalBehaviorStates,X [a029]@LAB_PRG14__a029:; [$a029] [a029]PHA [a02a]CMP #$03 [a02c]BEQ @LAB_PRG14__a032 [a02e]CMP #$08 [a030]BNE @LAB_PRG14__a035 [a032]@LAB_PRG14__a032:; [$a032] [a032]JSR SpriteBehavior_ShadowEura__a077 [a035]@LAB_PRG14__a035:; [$a035] [a035]PLA [a036]TAY [a037]LDA BYTE_ARRAY_PRG14__a064,Y [a03a]STA a:Arg_DeltaX_Full [a03d]LDA #$00 [a03f]STA a:Arg_DeltaX_Frac [a042]JSR Sprites_Something_SomethingAndMoveHoriz [a045]DEC CurrentSprites_BehaviorData2,X [a048]BNE @LAB_PRG14__a052 [a04a]INC CurrentSprites_Phases,X [a04d]LDA #$1e [a04f]STA CurrentSprites_BehaviorData2,X [a052]@LAB_PRG14__a052:; [$a052] [a052]RTS [a053]@LAB_PRG14__a053:; [$a053] [a053]JSR BScript_Action_FacePlayerX [a056]DEC CurrentSprites_BehaviorData2,X [a059]BNE @_return [a05b]INC CurrentSprites_Phases,X [a05e]LDA #$14 [a060]STA CurrentSprites_BehaviorData2,X [a063]@_return:; [$a063] [a063]RTS
; ; XREFS: ; SpriteBehavior_ShadowEura ;
[a064]BYTE_ARRAY_PRG14__a064:; [$a064] [a064].byte $00; [0]: [a065].byte $00; [1]: [a066].byte $08; [2]: [a067].byte $08; [3]: [a068].byte $08; [4]: [a069].byte $00; [5]: [a06a].byte $00; [6]: [a06b].byte $08; [7]: [a06c].byte $08; [8]: [a06d].byte $08; [9]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_Boss_ShadowEura ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80ed] ;============================================================================
[a06e]SpriteUpdateHandler_Boss_ShadowEura:; [$a06e] [a06e]JSR CurrentSprite_UpdateFlipMask [a071]LDA CurrentSprites_InternalBehaviorStates,X [a074]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura__a077 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ShadowEura ;============================================================================
[a077]SpriteBehavior_ShadowEura__a077:; [$a077] [a077]LDA CurrentSprites_Flags,X [a07a]AND #$01 [a07c]TAY [a07d]LDA CurrentSprites_XPos_Full,X [a07f]CLC [a080]ADC BYTE_ARRAY_PRG14__a091,Y [a083]STA a:CurrentSprite_Arg_CastMagicX [a086]LDA CurrentSprites_YPos,X [a088]CLC [a089]ADC #$10 [a08b]STA a:CurrentSprite_Arg_CastMagicY [a08e]JMP SpriteBehavior_ShadowEura__a12d
; ; XREFS: ; SpriteBehavior_ShadowEura__a077 ;
[a091]BYTE_ARRAY_PRG14__a091:; [$a091] [a091].byte $00; [0]: [a092].byte $20; [1]:
;============================================================================ ; TODO: Document SpriteBehavior_ExecutionHood__a093 ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ExecutionHood ;============================================================================
[a093]SpriteBehavior_ExecutionHood__a093:; [$a093] [a093]JSR Sprites_HasMaxOnScreen [a096]BCS RETURN_A0CA [a098]LDA CurrentSprites_YPos,X [a09a]STA CurrentSprites_YPos,Y [a09d]JMP 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] [a0a0]JSR Sprites_HasMaxOnScreen [a0a3]BCS RETURN_A0CA [a0a5]LDA CurrentSprites_YPos,X [a0a7]CLC [a0a8]ADC #$0c [a0aa]STA 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] [a0ad]LDA #$51 [a0af]STA CurrentSprites_Entities,Y [a0b2]LDA CurrentSprites_XPos_Full,X [a0b4]CLC [a0b5]ADC #$04 [a0b7]STA CurrentSprites_XPos_Full,Y [a0ba]LDA CurrentSprites_Flags,X [a0bd]AND #$01 [a0bf]STA CurrentSprites_Flags,Y [a0c2]LDA #$00 [a0c4]STA CurrentSprites_PPUOffsets,Y [a0c7]JMP Sprite_Maybe_ResetState
; ; XREFS: ; FUN_PRG14__a0a0 ; SpriteBehavior_ExecutionHood__a093 ;
[a0ca]RETURN_A0CA:; [$a0ca] [a0ca]RTS
;============================================================================ ; TODO: Document SpriteBehavior_EnemyMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61d] ; _thunk_SpriteBehavior__a0cb ;============================================================================
[a0cb]SpriteBehavior_EnemyMagic:; [$a0cb] [a0cb]JSR Sprite_IsBehaviorNotReady [a0ce]BNE @LAB_PRG14__a0d3 [a0d0]JSR Sprite_SetBehaviorReady [a0d3]@LAB_PRG14__a0d3:; [$a0d3] [a0d3]LDA #$02 [a0d5]STA a:Arg_DeltaX_Full [a0d8]LDA #$00 [a0da]STA a:Arg_DeltaX_Frac [a0dd]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [a0e0]BCC @_return [a0e2]LDA #$ff [a0e4]STA CurrentSprites_Entities,X [a0e7]@_return:; [$a0e7] [a0e7]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Magic_81 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8129] ;============================================================================
[a0e8]SpriteUpdateHandler_Magic_81:; [$a0e8] [a0e8]LDA #$00 [a0ea]STA CurrentSprite_FlipMask [a0ec]LDA a:SpriteUpdateCounter [a0ef]LSR A [a0f0]LSR A [a0f1]AND #$01 [a0f3]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document Sprite_CastMagic ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_KingGrieve_9f65 ; SpriteBehavior_Ripasheiku_CastMagicOrUpdatePos ;============================================================================
[a0f6]Sprite_CastMagic:; [$a0f6] [a0f6]JSR Sprites_HasMaxOnScreen [a0f9]BCS @_return [a0fb]LDA #$0a [a0fd]STA CurrentSprites_Entities,Y [a100]LDA a:CurrentSprite_Arg_CastMagicX [a103]STA CurrentSprites_XPos_Full,Y [a106]LDA a:CurrentSprite_Arg_CastMagicY [a109]STA CurrentSprites_YPos,Y [a10c]LDA CurrentSprites_Flags,X [a10f]AND #$01 [a111]STA CurrentSprites_Flags,Y [a114]LDA #$80 [a116]STA CurrentSprites_PPUOffsets,Y [a119]JMP Sprite_Maybe_ResetState [a11c]@_return:; [$a11c] [a11c]RTS
;============================================================================ ; TODO: Document _thunk_SpriteBehavior__a0cb ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a61f] ;============================================================================
[a11d]_thunk_SpriteBehavior__a0cb:; [$a11d] [a11d]JMP SpriteBehavior_EnemyMagic
;============================================================================ ; TODO: Document SpriteUpdateHandler_TODO_Garbled10 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::809b] ;============================================================================
[a120]SpriteUpdateHandler_TODO_Garbled10:; [$a120] [a120]JSR CurrentSprite_UpdateFlipMask [a123]LDA a:SpriteUpdateCounter [a126]LSR A [a127]LSR A [a128]AND #$01 [a12a]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_ShadowEura__a12d ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_ShadowEura__a077 ;============================================================================
[a12d]SpriteBehavior_ShadowEura__a12d:; [$a12d] [a12d]JSR Sprites_HasMaxOnScreen [a130]BCS @_return [a132]LDA #$53 [a134]STA CurrentSprites_Entities,Y [a137]LDA a:CurrentSprite_Arg_CastMagicX [a13a]STA CurrentSprites_XPos_Full,Y [a13d]LDA a:CurrentSprite_Arg_CastMagicY [a140]STA CurrentSprites_YPos,Y [a143]LDA CurrentSprites_Flags,X [a146]AND #$01 [a148]STA CurrentSprites_Flags,Y [a14b]LDA #$00 [a14d]STA CurrentSprites_PPUOffsets,Y [a150]JMP Sprite_Maybe_ResetState [a153]@_return:; [$a153] [a153]RTS
;============================================================================ ; TODO: Document SpriteBehavior_Unknown_29 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a621] ;============================================================================
[a154]SpriteBehavior_Unknown_29:; [$a154] [a154]JSR Sprite_IsBehaviorNotReady [a157]BNE @LAB_PRG14__a183 [a159]LDA #$00 [a15b]STA CurrentSprites_InternalBehaviorStates,X [a15e]LDA CurrentSprites_Flags,X [a161]AND #$01 [a163]PHA [a164]JSR SpriteBehavior_Unknown_29_SomeSetup [a167]ASL CurrentSprites_BehaviorState_XFrac,X [a16a]ROL CurrentSprites_BehaviorState_XFull,X [a16d]ASL CurrentSprites_BehaviorState_YFrac,X [a170]ROL CurrentSprites_BehaviorState_YFull,X [a173]PLA [a174]STA Temp_00 [a176]LDA CurrentSprites_Flags,X [a179]AND #$fe [a17b]ORA Temp_00 [a17d]STA CurrentSprites_Flags,X [a180]JSR Sprite_SetBehaviorReady [a183]@LAB_PRG14__a183:; [$a183] [a183]LDA CurrentSprites_BehaviorState_XFull,X [a186]STA a:Arg_DeltaX_Full [a189]LDA CurrentSprites_BehaviorState_XFrac,X [a18c]STA a:Arg_DeltaX_Frac [a18f]JSR Sprites_Something_SomethingAndMoveHoriz [a192]BCS @LAB_PRG14__a1bc [a194]LDA CurrentSprites_BehaviorState_YFull,X [a197]STA a:Arg_DeltaY_Full [a19a]LDA CurrentSprites_BehaviorState_YFrac,X [a19d]STA a:Arg_DeltaY_Frac [a1a0]JSR Sprite_MoveVertical [a1a3]BCS @LAB_PRG14__a1bc [a1a5]LDA a:SpriteUpdateCounter [a1a8]AND #$03 [a1aa]BNE @_return [a1ac]INC CurrentSprites_InternalBehaviorStates,X [a1af]LDA CurrentSprites_InternalBehaviorStates,X [a1b2]CMP #$03 [a1b4]BCC @_return [a1b6]LDA #$00 [a1b8]STA CurrentSprites_InternalBehaviorStates,X [a1bb]@_return:; [$a1bb] [a1bb]RTS [a1bc]@LAB_PRG14__a1bc:; [$a1bc] [a1bc]LDA #$ff [a1be]STA CurrentSprites_Entities,X [a1c1]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_Magic_83 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::812d] ;============================================================================
[a1c2]SpriteUpdateHandler_Magic_83:; [$a1c2] [a1c2]LDA #$00 [a1c4]STA CurrentSprite_FlipMask [a1c6]LDA CurrentSprites_InternalBehaviorStates,X [a1c9]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document FUN_PRG14__a1cc ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ;============================================================================
[a1cc]FUN_PRG14__a1cc:; [$a1cc] [a1cc]JSR Sprites_HasMaxOnScreen [a1cf]BCS @_return [a1d1]LDA #$54 [a1d3]STA CurrentSprites_Entities,Y [a1d6]LDA a:CurrentSprite_Arg_CastMagicX [a1d9]STA CurrentSprites_XPos_Full,Y [a1dc]LDA a:CurrentSprite_Arg_CastMagicY [a1df]STA CurrentSprites_YPos,Y [a1e2]LDA CurrentSprites_Flags,X [a1e5]AND #$01 [a1e7]ORA #$80 [a1e9]STA CurrentSprites_Flags,Y [a1ec]LDA #$00 [a1ee]STA CurrentSprites_PPUOffsets,Y [a1f1]JMP Sprite_Maybe_ResetState [a1f4]@_return:; [$a1f4] [a1f4]RTS
;============================================================================ ; TODO: Document SpriteUpdateHandler_EnemyMagic ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::812f] ;============================================================================
[a1f5]SpriteUpdateHandler_EnemyMagic:; [$a1f5] [a1f5]JSR CurrentSprite_UpdateFlipMask [a1f8]LDA a:SpriteUpdateCounter [a1fb]LSR A [a1fc]LSR A [a1fd]AND #$03 [a1ff]JMP 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] [a202]TXA [a203]PHA [a204]LDA CurrentSprites_Entities,Y [a207]ASL A [a208]TAX [a209]LDA SPRITE_BSCRIPTS,X [a20c]STA CurrentSprites_BehaviorAddrs_L,Y [a20f]LDA SPRITE_BSCRIPTS+1,X [a212]STA CurrentSprites_BehaviorAddrs_U,Y [a215]LDA #$ff [a217]STA CurrentSprites_Behaviors,Y [a21a]STA CurrentSprites_HitByMagicBehavior,Y [a21d]LDX CurrentSprites_Entities,Y [a220]LDA SPRITE_ENTITIES_HITBOX_TYPES,X [a223]STA CurrentSprites_HitBoxTypes,Y [a226]LDA #$00 [a228]STA CurrentSprites_Phases,Y [a22b]LDA CurrentSprites_Flags,Y [a22e]AND #$bf [a230]STA CurrentSprites_Flags,Y [a233]PLA [a234]TAX [a235]RTS
;============================================================================ ; 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] [a236]LDY #$07; Y = 7 (our loop counter) [a238]@_loop:; [$a238] [a238]LDA CurrentSprites_Entities,Y; A = sprite entity at X [a23b]CMP #$ff; Is it 0xFF (unpopulated)? [a23d]BNE @_isPopulated; If not, jump to prepare the next loop.
; ; There's an unpopulated sprite. Return a false result. ;
[a23f]CLC; Set C = 0 [a240]RTS; And return it. [a241]@_isPopulated:; [$a241] [a241]DEY; Y-- [a242]BPL @_loop; If >= 0, loop.
; ; All slots are populated. Return a true result. ;
[a244]SEC; Set C = 1 [a245]RTS; And return it.
;============================================================================ ; TODO: Document SpriteBehavior_Ointment ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a639] ;============================================================================
[a246]SpriteBehavior_Ointment:; [$a246] [a246]JSR Sprite_IsBehaviorNotReady [a249]BNE Sprite_FallIfNeeded [a24b]LDA a:DurationOintment [a24e]BMI Sprite_SetReadyAndFallIfNeeded
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior_a25f_ClearEntity ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ;============================================================================
[a250]SpriteBehavior_a25f_ClearEntity:; [$a250] [a250]LDA #$ff [a252]STA CurrentSprites_Entities,X [a255]RTS
;============================================================================ ; TODO: Document Sprite_SetReadyAndFallIfNeeded ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ; SpriteBehavior_Ointment ;============================================================================
[a256]Sprite_SetReadyAndFallIfNeeded:; [$a256] [a256]JSR Sprite_SetBehaviorReady
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprite_FallIfNeeded ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Glove ; SpriteBehavior_Ointment ;============================================================================
[a259]Sprite_FallIfNeeded:; [$a259] [a259]JSR Sprites_SetCurrentSpriteCanMove [a25c]JMP CurrentSprite_HandleFall
;============================================================================ ; TODO: Document SpriteBehavior_Glove ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63b] ;============================================================================
[a25f]SpriteBehavior_Glove:; [$a25f] [a25f]JSR Sprite_IsBehaviorNotReady [a262]BNE Sprite_FallIfNeeded [a264]LDA a:DurationGlove [a267]BMI Sprite_SetReadyAndFallIfNeeded [a269]BPL 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] [a26b]JSR CurrentSprite_UpdateFlipMask [a26e]LDY #$00 [a270]LDA CurrentSprites_Phases,X [a273]CMP #$02 [a275]BEQ @LAB_PRG14__a280 [a277]LDA a:SpriteUpdateCounter [a27a]LSR A [a27b]LSR A [a27c]LSR A [a27d]AND #$03 [a27f]TAY [a280]@LAB_PRG14__a280:; [$a280] [a280]LDA BYTE_ARRAY_PRG14__a286,Y [a283]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_NPC_Walking ;
[a286]BYTE_ARRAY_PRG14__a286:; [$a286] [a286].byte $00; [0]: [a287].byte $01; [1]: [a288].byte $00; [2]: [a289].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] [a28a]JMP 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] [a28d]JMP SpriteUpdateHandler_NPC_Walking
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_ArmorSalesman ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f5] ;============================================================================
[a290]SpriteUpdateHandler_NPC_ArmorSalesman:; [$a290] [a290]LDA #$00 [a292]STA CurrentSprite_FlipMask [a294]LDA a:SpriteUpdateCounter [a297]LSR A [a298]LSR A [a299]LSR A [a29a]LSR A [a29b]AND #$01 [a29d]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_MartialArts ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f7] ;============================================================================
[a2a0]SpriteUpdateHandler_NPC_MartialArts:; [$a2a0] [a2a0]JSR CurrentSprite_UpdateFlipMask [a2a3]LDA a:SpriteUpdateCounter [a2a6]LSR A [a2a7]LSR A [a2a8]LSR A [a2a9]LSR A [a2aa]AND #$01 [a2ac]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_Priest ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80f9] ;============================================================================
[a2af]SpriteUpdateHandler_NPC_Priest:; [$a2af] [a2af]JSR CurrentSprite_UpdateFlipMask [a2b2]LDA a:SpriteUpdateCounter [a2b5]LSR A [a2b6]LSR A [a2b7]LSR A [a2b8]LSR A [a2b9]AND #$01 [a2bb]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_King ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80fb] ;============================================================================
[a2be]SpriteUpdateHandler_NPC_King:; [$a2be] [a2be]LDA #$40 [a2c0]STA CurrentSprite_FlipMask [a2c2]LDY CurrentSprites_Phases,X [a2c5]DEY [a2c6]LDA a:SpriteUpdateCounter [a2c9]LSR A [a2ca]LSR A [a2cb]LSR A [a2cc]LSR A [a2cd]AND #$01 [a2cf]CLC [a2d0]ADC BYTE_ARRAY_PRG14__a2d6,Y [a2d3]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_NPC_King ;
[a2d6]BYTE_ARRAY_PRG14__a2d6:; [$a2d6] [a2d6].byte $00; [0]: [a2d7].byte $02; [1]:
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_MagicTeacher ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::80fd] ;============================================================================
[a2d8]SpriteUpdateHandler_NPC_MagicTeacher:; [$a2d8] [a2d8]JSR CurrentSprite_UpdateFlipMask [a2db]LDA a:SpriteUpdateCounter [a2de]LSR A [a2df]LSR A [a2e0]LSR A [a2e1]LSR A [a2e2]AND #$01 [a2e4]JMP 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] [a2e7]LDA #$40 [a2e9]STA 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] [a2eb]LDA a:SpriteUpdateCounter [a2ee]LSR A [a2ef]LSR A [a2f0]LSR A [a2f1]LSR A [a2f2]AND #$01 [a2f4]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_NPC_Doctor ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::810d] ;============================================================================
[a2f7]SpriteUpdateHandler_NPC_Doctor:; [$a2f7] [a2f7]LDA #$00 [a2f9]STA CurrentSprite_FlipMask [a2fb]JMP 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] [a2fe]JSR CurrentSprite_UpdateFlipMask [a301]JMP 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] [a304]JSR CurrentSprite_UpdateFlipMask [a307]JMP 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] [a30a]LDA #$00 [a30c]STA CurrentSprite_FlipMask [a30e]LDA #$00 [a310]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteUpdateHandler_Bread ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_UPDATE_HANDLERS [$PRG14::8089] ;============================================================================
[a313]SpriteUpdateHandler_Bread:; [$a313] [a313]LDA #$00 [a315]STA Sprites_PPUOffset [a317]STA CurrentSprite_FlipMask [a319]LDA #$00 [a31b]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_Fountain ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a659] ;============================================================================
[a31e]SpriteBehavior_Fountain:; [$a31e] [a31e]JSR Sprite_IsBehaviorNotReady [a321]BNE @_checkQuest [a323]JSR Sprites_MaybeResetPhaseAndEnable [a326]@_checkQuest:; [$a326] [a326]LDA a:Quests [a329]AND #$07 [a32b]CMP #$07 [a32d]BNE @_setVisible [a32f]JMP Sprites_HideSprite [a332]@_setVisible:; [$a332] [a332]JMP 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] [a335]LDA #$00 [a337]STA CurrentSprite_FlipMask [a339]LDA a:SpriteUpdateCounter [a33c]LSR A [a33d]LSR A [a33e]AND #$03 [a340]TAY [a341]LDA SPRITE_FOUNTAIN_PHASES,Y [a344]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; SpriteUpdateHandler_Effect_Fountain ;
[a347]SPRITE_FOUNTAIN_PHASES:; [$a347] [a347].byte $04; [0]: [a348].byte $05; [1]: [a349].byte $06; [2]: [a34a].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] [a34b]LDA #$00 [a34d]STA CurrentSprite_FlipMask [a34f]LDA #$00 [a351]JMP Sprite_EnterNextAppearancePhase
;============================================================================ ; TODO: Document SpriteBehavior_BattleSuitDroppedByZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63d] ;============================================================================
[a354]SpriteBehavior_BattleSuitDroppedByZoradohna:; [$a354] [a354]JSR Sprite_IsBehaviorNotReady [a357]BNE @_checkOnScreen [a359]LDA a:SelectedArmor [a35c]CMP #$03 [a35e]BEQ Sprites_ClearAllEntities [a360]LDY a:NumberOfArmors [a363]@_checkArmorLoop:; [$a363] [a363]DEY [a364]BMI @_setReady [a366]LDA ArmorInventory,Y [a369]CMP #$03 [a36b]BEQ Sprites_ClearAllEntities [a36d]BNE @_checkArmorLoop [a36f]@_setReady:; [$a36f] [a36f]LDA #$00 [a371]STA CurrentSprites_Phases,X [a374]JSR Sprite_SetBehaviorReady [a377]@_checkOnScreen:; [$a377] [a377]LDA #$2e [a379]JSR Maybe_IsSpriteEntityNotOnScreen [a37c]BCC @_setVisible [a37e]JMP Sprites_HideSprite [a381]@_setVisible:; [$a381] [a381]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_BattleHelmetDroppedByZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a63f] ;============================================================================
[a384]SpriteBehavior_BattleHelmetDroppedByZoradohna:; [$a384] [a384]JSR Sprite_IsBehaviorNotReady [a387]BNE @_checkOnScreen [a389]LDA a:SelectedShield [a38c]CMP #$03 [a38e]BEQ Sprites_ClearAllEntities [a390]LDY a:NumberOfShields [a393]@_checkShieldLoop:; [$a393] [a393]DEY [a394]BMI @_setReady [a396]LDA ShieldInventory,Y [a399]CMP #$03 [a39b]BEQ Sprites_ClearAllEntities [a39d]BNE @_checkShieldLoop [a39f]@_setReady:; [$a39f] [a39f]LDA #$00 [a3a1]STA CurrentSprites_Phases,X [a3a4]JSR Sprite_SetBehaviorReady [a3a7]@_checkOnScreen:; [$a3a7] [a3a7]LDA #$2e [a3a9]JSR Maybe_IsSpriteEntityNotOnScreen [a3ac]BCC @_setVisible [a3ae]JMP Sprites_HideSprite [a3b1]@_setVisible:; [$a3b1] [a3b1]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document Sprites_ClearAllEntities ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_BattleHelmetDroppedByZoradohna ; SpriteBehavior_BattleSuitDroppedByZoradohna ; SpriteBehavior_DragonSlayerDroppedByKingGrieve ;============================================================================
[a3b4]Sprites_ClearAllEntities:; [$a3b4] [a3b4]LDY #$07 [a3b6]@_loop:; [$a3b6] [a3b6]LDA #$ff [a3b8]STA CurrentSprites_Entities,Y [a3bb]DEY [a3bc]BPL @_loop [a3be]RTS
;============================================================================ ; TODO: Document SpriteBehavior_DragonSlayerDroppedByKingGrieve ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a641] ;============================================================================
[a3bf]SpriteBehavior_DragonSlayerDroppedByKingGrieve:; [$a3bf] [a3bf]JSR Sprite_IsBehaviorNotReady [a3c2]BNE @_checkOnScreen [a3c4]LDA a:Player_CurWeapon [a3c7]CMP #$03 [a3c9]BEQ Sprites_ClearAllEntities [a3cb]LDY a:NumberOfWeapons [a3ce]@_checkWeaponLoop:; [$a3ce] [a3ce]DEY [a3cf]BMI @_setReady [a3d1]LDA WeaponInventory,Y [a3d4]CMP #$03 [a3d6]BEQ Sprites_ClearAllEntities [a3d8]BNE @_checkWeaponLoop [a3da]@_setReady:; [$a3da] [a3da]LDA #$00 [a3dc]STA CurrentSprites_Phases,X [a3df]JSR Sprite_SetBehaviorReady [a3e2]@_checkOnScreen:; [$a3e2] [a3e2]LDA #$32 [a3e4]JSR Maybe_IsSpriteEntityNotOnScreen [a3e7]BCC @_setVisible [a3e9]JMP Sprites_HideSprite [a3ec]@_setVisible:; [$a3ec] [a3ec]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_MattockDroppedFromRipasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a643] ;============================================================================
[a3ef]SpriteBehavior_MattockDroppedFromRipasheiku:; [$a3ef] [a3ef]JSR Sprite_IsBehaviorNotReady [a3f2]BNE @_checkOnScreen [a3f4]LDA a:Quests [a3f7]AND #$10 [a3f9]BEQ @_setReady [a3fb]JMP Sprites_Remove [a3fe]@_setReady:; [$a3fe] [a3fe]LDA #$00 [a400]STA CurrentSprites_Phases,X [a403]JSR Sprite_SetBehaviorReady [a406]@_checkOnScreen:; [$a406] [a406]LDA #$2d [a408]JSR Maybe_IsSpriteEntityNotOnScreen [a40b]BCC @_setVisible [a40d]JMP Sprites_HideSprite [a410]@_setVisible:; [$a410] [a410]JMP 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] [a413]JSR Sprite_IsBehaviorNotReady; Is the sprite behavior disabled? [a416]BNE @_checkOnScreen [a418]LDA a:Quests [a41b]AND #$08 [a41d]BEQ @_setReady [a41f]JMP Sprites_Remove [a422]@_setReady:; [$a422] [a422]LDA #$00 [a424]STA CurrentSprites_Phases,X [a427]JSR Sprite_SetBehaviorReady [a42a]@_checkOnScreen:; [$a42a] [a42a]LDA #$31 [a42c]JSR Maybe_IsSpriteEntityNotOnScreen [a42f]BCC @_setVisible [a431]JMP Sprites_HideSprite [a434]@_setVisible:; [$a434] [a434]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_BlackOnyxDropFromZoradohna ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a647] ;============================================================================
[a437]SpriteBehavior_BlackOnyxDropFromZoradohna:; [$a437] [a437]JSR Sprite_IsBehaviorNotReady [a43a]BNE @_checkOnScreen [a43c]LDA a:SpecialItems [a43f]AND #$01 [a441]BEQ @_setReady [a443]JMP Sprites_Remove [a446]@_setReady:; [$a446] [a446]LDA #$00 [a448]STA CurrentSprites_Phases,X [a44b]JSR Sprite_SetBehaviorReady [a44e]@_checkOnScreen:; [$a44e] [a44e]LDA #$2e [a450]JSR Maybe_IsSpriteEntityNotOnScreen [a453]BCC @_setVisible [a455]JMP Sprites_HideSprite [a458]@_setVisible:; [$a458] [a458]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_PendantDroppedFromRipasheiku ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a649] ;============================================================================
[a45b]SpriteBehavior_PendantDroppedFromRipasheiku:; [$a45b] [a45b]JSR Sprite_IsBehaviorNotReady [a45e]BNE @_checkOnScreen [a460]LDA a:SpecialItems [a463]AND #$02 [a465]BEQ @_setReady [a467]JMP Sprites_Remove [a46a]@_setReady:; [$a46a] [a46a]LDA #$00 [a46c]STA CurrentSprites_Phases,X [a46f]JSR Sprite_SetBehaviorReady [a472]@_checkOnScreen:; [$a472] [a472]LDA #$2d [a474]JSR Maybe_IsSpriteEntityNotOnScreen [a477]BCC @_setVisible [a479]JMP Sprites_HideSprite [a47c]@_setVisible:; [$a47c] [a47c]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_ShowMagicalRod ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a661] ;============================================================================
[a47f]SpriteBehavior_ShowMagicalRod:; [$a47f] [a47f]LDA a:SpecialItems [a482]AND #$04 [a484]BEQ @_return [a486]JMP Sprites_Remove [a489]@_return:; [$a489] [a489]RTS
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_50 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64b] ;============================================================================
[a48a]SpriteBehavior_RandomlyShowItem_50:; [$a48a] [a48a]JSR Sprite_IsBehaviorNotReady [a48d]BNE @LAB_PRG14__a49a [a48f]JSR Screen_Is3Of4Visits [a492]BCC @LAB_PRG14__a497 [a494]JMP Sprites_Remove [a497]@LAB_PRG14__a497:; [$a497] [a497]JSR Sprites_MaybeResetPhaseAndEnable [a49a]@LAB_PRG14__a49a:; [$a49a] [a49a]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_51 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64d] ;============================================================================
[a49d]SpriteBehavior_RandomlyShowItem_51:; [$a49d] [a49d]JSR Sprite_IsBehaviorNotReady [a4a0]BNE @LAB_PRG14__a4ad [a4a2]JSR Screen_Is3Of4Visits [a4a5]BCC @LAB_PRG14__a4aa [a4a7]JMP Sprites_Remove [a4aa]@LAB_PRG14__a4aa:; [$a4aa] [a4aa]JSR Sprites_MaybeResetPhaseAndEnable [a4ad]@LAB_PRG14__a4ad:; [$a4ad] [a4ad]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_52 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a64f] ;============================================================================
[a4b0]SpriteBehavior_RandomlyShowItem_52:; [$a4b0] [a4b0]JSR Sprite_IsBehaviorNotReady [a4b3]BNE @LAB_PRG14__a4c0 [a4b5]JSR Screen_Is3Of4Visits [a4b8]BCC @LAB_PRG14__a4bd [a4ba]JMP Sprites_Remove [a4bd]@LAB_PRG14__a4bd:; [$a4bd] [a4bd]JSR Sprites_MaybeResetPhaseAndEnable [a4c0]@LAB_PRG14__a4c0:; [$a4c0] [a4c0]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_53 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a651] ;============================================================================
[a4c3]SpriteBehavior_RandomlyShowItem_53:; [$a4c3] [a4c3]JSR Sprite_IsBehaviorNotReady [a4c6]BNE @LAB_PRG14__a4d3 [a4c8]JSR Screen_Is3Of4Visits [a4cb]BCC @LAB_PRG14__a4d0 [a4cd]JMP Sprites_Remove [a4d0]@LAB_PRG14__a4d0:; [$a4d0] [a4d0]JSR Sprites_MaybeResetPhaseAndEnable [a4d3]@LAB_PRG14__a4d3:; [$a4d3] [a4d3]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_54 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a653] ;============================================================================
[a4d6]SpriteBehavior_RandomlyShowItem_54:; [$a4d6] [a4d6]JSR Sprite_IsBehaviorNotReady [a4d9]BNE @LAB_PRG14__a4e6 [a4db]JSR Screen_Is3Of4Visits [a4de]BCC @LAB_PRG14__a4e3 [a4e0]JMP Sprites_Remove [a4e3]@LAB_PRG14__a4e3:; [$a4e3] [a4e3]JSR Sprites_MaybeResetPhaseAndEnable [a4e6]@LAB_PRG14__a4e6:; [$a4e6] [a4e6]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_56 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a657] ;============================================================================
[a4e9]SpriteBehavior_RandomlyShowItem_56:; [$a4e9] [a4e9]JSR Sprite_IsBehaviorNotReady [a4ec]BNE @LAB_PRG14__a4f9 [a4ee]JSR Screen_Is3Of4Visits [a4f1]BCC @LAB_PRG14__a4f6 [a4f3]JMP Sprites_Remove [a4f6]@LAB_PRG14__a4f6:; [$a4f6] [a4f6]JSR Sprites_MaybeResetPhaseAndEnable [a4f9]@LAB_PRG14__a4f9:; [$a4f9] [a4f9]JMP Sprite_ShowIfNoEnemies
;============================================================================ ; TODO: Document SpriteBehavior_RandomlyShowItem_55 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a655] ;============================================================================
[a4fc]SpriteBehavior_RandomlyShowItem_55:; [$a4fc] [a4fc]JSR Sprite_IsBehaviorNotReady [a4ff]BNE @LAB_PRG14__a50c [a501]JSR Screen_Is3Of4Visits [a504]BCC @LAB_PRG14__a509 [a506]JMP Sprites_Remove [a509]@LAB_PRG14__a509:; [$a509] [a509]JSR Sprites_MaybeResetPhaseAndEnable [a50c]@LAB_PRG14__a50c:; [$a50c] [a50c]JMP Sprite_ShowIfNoEnemies [a50f]RTS
;============================================================================ ; 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] [a510]JSR Sprites_HasAnyEnemyOnScreen; Are there any enemies on screen? [a513]BCC @_hideSprite; If so, jump to hide the sprite. [a515]JMP Sprite_SetVisible; Else, show the sprite. [a518]@_hideSprite:; [$a518] [a518]JMP 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] [a51b]LDA #$00 [a51d]STA CurrentSprites_Phases,X [a520]JMP 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] [a523]LDA #$ff [a525]STA CurrentSprites_Entities,X; Unset the sprite entity. [a528]RTS
;============================================================================ ; 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] [a529]INC a:Screen_TrackedVisitCount; Increment the visit count. [a52c]LDA a:Screen_TrackedVisitCount; Load it. [a52f]CMP #$04; Is it < 4? [a531]BCC @_returnTrue; If so, jump to return true. [a533]LDA #$00; Else, reset the track to 0. [a535]STA a:Screen_TrackedVisitCount; And store as the new count. [a538]CLC; Set C = 0 (false result). [a539]RTS [a53a]@_returnTrue:; [$a53a] [a53a]SEC; Set C = 1 (true result). [a53b]RTS
;============================================================================ ; 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] [a53c]LDY #$07; Y = 7 (loop counter) [a53e]@_loop:; [$a53e] [a53e]LDA CurrentSprites_Entities,Y; A = Sprite entity at Y [a541]CMP #$ff; Is it unset? [a543]BEQ @_prepareNextLoop; If it's set, jump to prepare for next loop. [a545]TAX; X = A [a546]LDA SPRITE_CATEGORIES_BY_ENTITY,X; A = Sprite category for entity X [a549]BNE @_prepareNextLoop; If not an enemy, jump to prepare for next loop. [a54b]LDX a:CurrentSpriteIndex; Else, restore the X register. [a54e]SEC; Set C = 1 (true result). [a54f]RTS [a550]@_prepareNextLoop:; [$a550] [a550]DEY; Y-- [a551]BPL @_loop; If Y >= 0, loop. [a553]LDX a:CurrentSpriteIndex; Else, restore the X register. [a556]CLC; Set C = 0 (false result). [a557]RTS
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfFortress ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65b] ;============================================================================
[a558]SpriteBehavior_SpringOfFortress:; [$a558] [a558]JSR Sprite_IsBehaviorNotReady [a55b]BNE @LAB_PRG14__a560 [a55d]JSR Sprites_MaybeResetPhaseAndEnable [a560]@LAB_PRG14__a560:; [$a560] [a560]LDA CurrentSprites_Phases,X [a563]BNE SpriteBehavior_Springs_UpdateFlowing [a565]LDA a:Quests [a568]AND #$01 [a56a]BNE SpriteBehavior_Springs_UpdateFlowing [a56c]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfSky ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65d] ;============================================================================
[a56f]SpriteBehavior_SpringOfSky:; [$a56f] [a56f]JSR Sprite_IsBehaviorNotReady [a572]BNE @LAB_PRG14__a577 [a574]JSR Sprites_MaybeResetPhaseAndEnable [a577]@LAB_PRG14__a577:; [$a577] [a577]LDA CurrentSprites_Phases,X [a57a]BNE SpriteBehavior_Springs_UpdateFlowing [a57c]LDA a:Quests [a57f]AND #$02 [a581]BNE SpriteBehavior_Springs_UpdateFlowing [a583]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_SpringOfJoker ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a65f] ;============================================================================
[a586]SpriteBehavior_SpringOfJoker:; [$a586] [a586]JSR Sprite_IsBehaviorNotReady [a589]BNE @LAB_PRG14__a58e [a58b]JSR Sprites_MaybeResetPhaseAndEnable [a58e]@LAB_PRG14__a58e:; [$a58e] [a58e]LDA CurrentSprites_Phases,X [a591]BNE SpriteBehavior_Springs_UpdateFlowing [a593]LDA a:Quests [a596]AND #$04 [a598]BNE SpriteBehavior_Springs_UpdateFlowing [a59a]JMP Sprite_SetVisible
;============================================================================ ; TODO: Document SpriteBehavior_Springs_UpdateFlowing ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_SpringOfFortress ; SpriteBehavior_SpringOfJoker ; SpriteBehavior_SpringOfSky ;============================================================================
[a59d]SpriteBehavior_Springs_UpdateFlowing:; [$a59d] [a59d]JSR Sprites_HideSprite [a5a0]LDA CurrentSprites_Phases,X [a5a3]BNE @LAB_PRG14__a5b0 [a5a5]INC CurrentSprites_Phases,X [a5a8]LDA #$00 [a5aa]STA CurrentSprites_BehaviorData2,X [a5ad]STA CurrentSprites_BehaviorData3,X [a5b0]@LAB_PRG14__a5b0:; [$a5b0] [a5b0]LDA CurrentSprites_Phases,X [a5b3]CMP #$01 [a5b5]BNE Sprite_SetPhase2 [a5b7]INC CurrentSprites_BehaviorData3,X [a5ba]LDA CurrentSprites_BehaviorData3,X [a5bd]AND #$03 [a5bf]BNE RETURN_A5CB [a5c1]INC CurrentSprites_BehaviorData2,X [a5c4]LDA CurrentSprites_BehaviorData2,X [a5c7]CMP #$04 [a5c9]BCS Sprite_SetPhase2
; ; XREFS: ; SpriteBehavior_Springs_UpdateFlowing ; SpriteUpdateHandler_Effect_Spring ;
[a5cb]RETURN_A5CB:; [$a5cb] [a5cb]RTS
;============================================================================ ; TODO: Document Sprite_SetPhase2 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_Springs_UpdateFlowing ;============================================================================
[a5cc]Sprite_SetPhase2:; [$a5cc] [a5cc]LDA #$02 [a5ce]STA CurrentSprites_Phases,X [a5d1]RTS
;============================================================================ ; 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] [a5d2]LDA CurrentSprites_Phases,X [a5d5]BEQ RETURN_A5CB [a5d7]CMP #$01 [a5d9]BEQ @LAB_PRG14__a5de [a5db]JMP SpriteUpdateHandler_Effect_Fountain [a5de]@LAB_PRG14__a5de:; [$a5de] [a5de]JSR CurrentSprite_UpdateFlipMask [a5e1]LDA CurrentSprites_BehaviorData2,X [a5e4]JMP Sprite_EnterNextAppearancePhase
; ; XREFS: ; Sprites_UpdateBehavior ;
[a5e7]SPRITE_BEHAVIORS:; [$a5e7] [a5e7]pointer SpriteBehavior_MoveTowardPlayer-1; [0]: Common [a5e9]pointer SpriteBehavior_Wait-1; [1]: Common [a5eb]pointer SpriteBehavior_BounceAndExpire-1; [2]: Item: Dropped coin [a5ed]pointer SpriteBehavior_Garbled3-1; [3]: [a5ef]pointer SpriteBehavior_WalkForward-1; [4]: Common [a5f1]pointer SpriteBehavior_Return-1; [5]: [a5f3]pointer SpriteBehavior_EnemyUnused18-1; [6]: [a5f5]pointer SpriteBehavior_EnemyDeath-1; [7]: [a5f7]pointer SpriteBehavior_EnemyDeath-1; [8]: [a5f9]pointer SpriteBehavior_Hop-1; [9]: Enemy: Monodron [a5fb]pointer SpriteBehavior_Ripasheiku-1; [10]: Boss: Dragon boss guy [a5fd]pointer SpriteBehavior_Return-1; [11]: [a5ff]pointer SpriteBehavior_Borabohra-1; [12]: [a601]pointer SpriteBehavior_Pakukame-1; [13]: [a603]pointer SpriteBehavior_Zorugeriru-1; [14]: [a605]pointer SpriteBehavior_KingGrieve-1; [15]: [a607]pointer SpriteBehavior_ShadowEura-1; [16]: [a609]pointer SpriteBehavior_SomethingEyeball_17-1; [17]: [a60b]pointer SpriteBehavior_SomethingZoradohna_18-1; [18]: [a60d]pointer SpriteBehavior_MoveVertically-1; [19]: [a60f]pointer SpriteBehavior__a8d7-1; [20]: [a611]pointer SpriteBehavior_Fall-1; [21]: Common [a613]pointer SpriteBehavior_NecronAides-1; [22]: Enemy: Necron Aides [a615]pointer SpriteBehavior_Bihoruda-1; [23]: Enemy: Bihoruda [a617]pointer SpriteBehavior_Lilith-1; [24]: Enemy: Lilith [a619]pointer SpriteBehavior_Yuinaru-1; [25]: Enemy: Yuinaru [a61b]pointer SpriteBehavior_Nash-1; [26]: Enemy: Nash [a61d]pointer SpriteBehavior_EnemyMagic-1; [27]: [a61f]pointer _thunk_SpriteBehavior__a0cb-1; [28]: [a621]pointer SpriteBehavior_Unknown_29-1; [29]: [a623]pointer _thunk_Sprite_ClearBehaviorReadyAndSetSubtypeBit7-1; [30]: [a625]pointer SpriteBehavior_FlashScreenHitPlayer-1; [31]: [a627]pointer SpriteBehavior_GiantBees-1; [32]: Enemy: Giant Bees [a629]pointer SpriteBehavior_Naga-1; [33]: Enemy: Naga [a62b]pointer SpriteBehavior_Yareeka-1; [34]: Enemy: Yareeka [a62d]pointer SpriteBehavior_Magman-1; [35]: Enemy: Magman [a62f]pointer SpriteBehavior_EnemyUnused36-1; [36]: Enemy: Unused 36 [a631]pointer SpriteBehavior_EnemyUnused39-1; [37]: Enemy: Unused 39 [a633]pointer SpriteBehavior_EnemyUnused43-1; [38]: Enemy: Unused 43 [a635]pointer SpriteBehavior_Tamazutsu-1; [39]: Enemy: Tamazutsu [a637]pointer SpriteBehavior_SirGawaineWolfman-1; [40]: Enemy: Sir Gawaine Enemy: Wolfman [a639]pointer SpriteBehavior_Ointment-1; [41]: Item: Ointment [a63b]pointer SpriteBehavior_Glove-1; [42]: Item: Glove [a63d]pointer SpriteBehavior_BattleSuitDroppedByZoradohna-1; [43]: Item: Battle Suit [a63f]pointer SpriteBehavior_BattleHelmetDroppedByZoradohna-1; [44]: Item: Battle Helmet [a641]pointer SpriteBehavior_DragonSlayerDroppedByKingGrieve-1; [45]: Item: Dragon Slayer [a643]pointer SpriteBehavior_MattockDroppedFromRipasheiku-1; [46]: Item: Mattock [a645]pointer SpriteBehavior_WingBootsDroppedByZorugeriru-1; [47]: Item: Wing Boots [a647]pointer SpriteBehavior_BlackOnyxDropFromZoradohna-1; [48]: Item: Black Onyx [a649]pointer SpriteBehavior_PendantDroppedFromRipasheiku-1; [49]: Item: Pendant [a64b]pointer SpriteBehavior_RandomlyShowItem_50-1; [50]: [a64d]pointer SpriteBehavior_RandomlyShowItem_51-1; [51]: [a64f]pointer SpriteBehavior_RandomlyShowItem_52-1; [52]: [a651]pointer SpriteBehavior_RandomlyShowItem_53-1; [53]: [a653]pointer SpriteBehavior_RandomlyShowItem_54-1; [54]: [a655]pointer SpriteBehavior_RandomlyShowItem_55-1; [55]: [a657]pointer SpriteBehavior_RandomlyShowItem_56-1; [56]: [a659]pointer SpriteBehavior_Fountain-1; [57]: Spring of Fountain [a65b]pointer SpriteBehavior_SpringOfFortress-1; [58]: Spring of Fortress [a65d]pointer SpriteBehavior_SpringOfSky-1; [59]: Spring of Sky [a65f]pointer SpriteBehavior_SpringOfJoker-1; [60]: Spring of Joker [a661]pointer SpriteBehavior_ShowMagicalRod-1; [61]: Item: Magical Rod [a663]pointer SpriteBehavior_BossDeath-1; [62]: Effect: Boss Death [a665]pointer SpriteBehavior_BuzzAround-1; [63]: Enemy: Hornet [a667]pointer SpriteBehavior_Ishiisu-1; [64]: Enemy: Ishiisu [a669]pointer 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] [a66b]LDA a:DurationHourGlass [a66e]BMI @LAB_PRG14__a679 [a670]LDY CurrentSprites_Entities,X [a673]LDA SPRITE_CATEGORIES_BY_ENTITY,Y [a676]BNE @LAB_PRG14__a679
; ; This is an enemy sprite, and the Hour Glass is active. ; Don't run any behavior updates. ;
[a678]RTS
; ; Set the currently-processing sprite behavior address to ; the one from the current sprites map. ;
[a679]@LAB_PRG14__a679:; [$a679] [a679]LDX a:CurrentSpriteIndex [a67c]LDA CurrentSprites_BehaviorAddrs_L,X [a67f]STA Sprites_ReadInfoAddr [a681]LDA CurrentSprites_BehaviorAddrs_U,X [a684]STA Sprites_ReadInfoAddr_U [a686]JSR BScripts_LoadNextOp [a689]LDA CurrentSprites_Behaviors,X [a68c]ASL A [a68d]TAY [a68e]CPY #$84 [a690]BCS @_updateCurrentSprites [a692]LDA #$a6 [a694]PHA [a695]LDA #$a0 [a697]PHA [a698]LDA SPRITE_BEHAVIORS+1,Y [a69b]PHA [a69c]LDA SPRITE_BEHAVIORS,Y [a69f]PHA [a6a0]RTS
; ; Update the map of current sprites to sprite behavior addresses ; with the updated address. ;
[a6a1]@_updateCurrentSprites:; [$a6a1] [a6a1]LDX a:CurrentSpriteIndex [a6a4]LDA Sprites_ReadInfoAddr [a6a6]STA CurrentSprites_BehaviorAddrs_L,X [a6a9]LDA Sprites_ReadInfoAddr_U [a6ab]STA 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] [a6ae]RTS
;============================================================================ ; 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] [a6af]LDA CurrentSprites_BehaviorArg1,X [a6b2]BEQ SpriteBehavior_Return [a6b4]DEC CurrentSprites_BehaviorArg1,X [a6b7]BNE SpriteBehavior_Return [a6b9]JMP 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] [a6bc]LDY #$00 [a6be]LDA (Sprites_ReadInfoAddr),Y [a6c0]CMP #$ff [a6c2]BEQ @LAB_PRG14__a6cf [a6c4]ASL A [a6c5]TAY [a6c6]LDA BSCRIPT_OP_HANDLERS+1,Y [a6c9]PHA [a6ca]LDA BSCRIPT_OP_HANDLERS,Y [a6cd]PHA [a6ce]RTS [a6cf]@LAB_PRG14__a6cf:; [$a6cf] [a6cf]LDA CurrentSprites_Behaviors,X [a6d2]AND #$7f [a6d4]STA CurrentSprites_Behaviors,X [a6d7]RTS
; ; XREFS: ; BScripts_LoadNextOp ;
[a6d8]BSCRIPT_OP_HANDLERS:; [$a6d8] [a6d8]pointer BScript_Op_SwitchBehavior-1; [0]: [a6da]pointer BScript_Op_MaybeDisableAndGoTo-1; [1]: [a6dc]pointer BScript_Op_RunAction-1; [2]: [a6de]pointer BScript_Op_CheckDistanceToPlayer-1; [3]: [a6e0]pointer BScript_Op_FinishBehavior-1; [4]: [a6e2]pointer BScript_Op_GoTo-1; [5]: [a6e4]pointer BScript_Op_AddToSpriteData-1; [6]: [a6e6]pointer 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] [a6e8]LDA CurrentSprites_Behaviors,X [a6eb]BMI @LAB_PRG14__a6f0 [a6ed]JMP RETURN_A771 [a6f0]@LAB_PRG14__a6f0:; [$a6f0] [a6f0]LDY #$01 [a6f2]LDA (Sprites_ReadInfoAddr),Y [a6f4]STA CurrentSprites_Phases,X [a6f7]LDA #$02 [a6f9]JSR Sprites_IncrementScriptAddr [a6fc]JMP BScripts_LoadNextOp
;============================================================================ ; TODO: Document BScript_Op_SwitchBehavior ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6d8] ;============================================================================
[a6ff]BScript_Op_SwitchBehavior:; [$a6ff] [a6ff]LDA CurrentSprites_Behaviors,X [a702]BMI @LAB_PRG14__a707 [a704]JMP RETURN_A771 [a707]@LAB_PRG14__a707:; [$a707] [a707]INC CurrentSprites_Phases,X [a70a]LDA #$01 [a70c]JSR Sprites_IncrementScriptAddr [a70f]LDY #$00 [a711]LDA (Sprites_ReadInfoAddr),Y [a713]STA CurrentSprites_Behaviors,X [a716]INY [a717]LDA (Sprites_ReadInfoAddr),Y [a719]STA CurrentSprites_BehaviorArg1,X [a71c]LDA #$02 [a71e]JSR Sprites_IncrementScriptAddr [a721]LDA CurrentSprites_Behaviors,X [a724]CMP #$06 [a726]BNE @_return [a728]JMP FUN_PRG14__9917 [a72b]@_return:; [$a72b] [a72b]RTS
;============================================================================ ; TODO: Document BScript_Op_MaybeDisableAndGoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6da] ;============================================================================
[a72c]BScript_Op_MaybeDisableAndGoTo:; [$a72c] [a72c]LDA CurrentSprites_Behaviors,X [a72f]BMI Sprites_MaybeDisableAndGoTo [a731]JMP RETURN_A771
;============================================================================ ; TODO: Document Sprites_MaybeDisableAndGoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BScript_Op_MaybeDisableAndGoTo ;============================================================================
[a734]Sprites_MaybeDisableAndGoTo:; [$a734] [a734]LDA #$01 [a736]JSR Sprites_IncrementScriptAddr [a739]LDY #$00 [a73b]LDA (Sprites_ReadInfoAddr),Y [a73d]PHA [a73e]INY [a73f]LDA (Sprites_ReadInfoAddr),Y [a741]STA Sprites_ReadInfoAddr_U [a743]PLA [a744]STA Sprites_ReadInfoAddr [a746]JSR Sprite_FinishBehavior [a749]JMP BScripts_LoadNextOp
;============================================================================ ; TODO: Document BScript_Op_GoTo ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6e2] ;============================================================================
[a74c]BScript_Op_GoTo:; [$a74c] [a74c]LDA CurrentSprites_Behaviors,X [a74f]BMI @LAB_PRG14__a754 [a751]JMP RETURN_A771 [a754]@LAB_PRG14__a754:; [$a754] [a754]LDA #$01 [a756]JSR Sprites_IncrementScriptAddr [a759]LDY #$00 [a75b]LDA (Sprites_ReadInfoAddr),Y [a75d]PHA [a75e]INY [a75f]LDA (Sprites_ReadInfoAddr),Y [a761]STA Sprites_ReadInfoAddr_U [a763]PLA [a764]STA Sprites_ReadInfoAddr [a766]LDA #$00 [a768]STA CurrentSprites_Phases,X [a76b]JSR Sprite_FinishBehavior [a76e]JMP BScripts_LoadNextOp
; ; XREFS: ; BScript_Op_GoTo ; BScript_Op_MaybeDisableAndGoTo ; BScript_Op_RunAction ; BScript_Op_SetPhase ; BScript_Op_SwitchBehavior ;
[a771]RETURN_A771:; [$a771] [a771]RTS
;============================================================================ ; TODO: Document BScript_Op_RunAction ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; BSCRIPT_OP_HANDLERS [$PRG14::a6dc] ;============================================================================
[a772]BScript_Op_RunAction:; [$a772] [a772]LDA CurrentSprites_Behaviors,X [a775]BPL RETURN_A771 [a777]LDY #$01 [a779]LDA (Sprites_ReadInfoAddr),Y [a77b]ASL A [a77c]TAY [a77d]LDA #$a7 [a77f]PHA [a780]LDA #$8b [a782]PHA [a783]LDA BSCRIPT_ACTIONS+1,Y [a786]PHA [a787]LDA BSCRIPT_ACTIONS,Y [a78a]PHA [a78b]RTS
;============================================================================ ; TODO: Document Sprites_Maybe_Skip2AndLoadNextAction ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ;============================================================================
[a78c]Sprites_Maybe_Skip2AndLoadNextAction:; [$a78c] [a78c]LDA #$02 [a78e]JSR Sprites_IncrementScriptAddr [a791]JMP BScripts_LoadNextOp
; ; XREFS: ; BScript_Op_RunAction ;
[a794]BSCRIPT_ACTIONS:; [$a794] [a794]pointer BScript_Action_FacePlayerX-1; [0]: Face Player (X) [a796]pointer BScript_Action_FlipXDirection-1; [1]: Flip X Direction [a798]pointer BScript_Action_FacePlayerY-1; [2]: Face Player (Y) [a79a]pointer BScript_Action_FlipYDirection-1; [3]: Flip Y Direction [a79c]pointer BScript_Action_RandomlyFlipXDirection-1; [4]: Randomly Flip X Direction [a79e]pointer BScript_Action_RandomlyFlipYDirection-1; [5]: Randomly Flip Y Direction [a7a0]pointer BScript_Action_RiseUp-1; [6]: Rise Up [a7a2]pointer 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] [a7a4]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a7a7]AND #$7f; Clear the Falling bit. [a7a9]STA CurrentSprites_Flags,X; Store it. [a7ac]RTS
;============================================================================ ; 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] [a7ad]JSR GetRandom; Load a random value. [a7b0]LDX a:CurrentSpriteIndex; X = Current sprite index. [a7b3]CMP #$80; Is the random value < 128? [a7b5]BCS @_setFaceRight; If so, jump to set facing right. [a7b7]LDA CurrentSprites_Flags,X; Load the sprite flags. [a7ba]AND #$fe; Clear the Facing Right bit. [a7bc]STA CurrentSprites_Flags,X; Store it. [a7bf]RTS [a7c0]@_setFaceRight:; [$a7c0] [a7c0]LDA CurrentSprites_Flags,X; Load the sprite flags. [a7c3]ORA #$01; Set the Facing Right bit. [a7c5]STA CurrentSprites_Flags,X; Store it. [a7c8]RTS
;============================================================================ ; 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] [a7c9]JSR GetRandom; Load a random value. [a7cc]LDX a:CurrentSpriteIndex; X = Current sprite index. [a7cf]CMP #$80; Is the random value < 128? [a7d1]BCS @_setFalling; If so, jump to set falling. [a7d3]LDA CurrentSprites_Flags,X; Load the sprite flags. [a7d6]AND #$7f; Clear the falling bit. [a7d8]STA CurrentSprites_Flags,X; Store it. [a7db]RTS [a7dc]@_setFalling:; [$a7dc] [a7dc]LDA CurrentSprites_Flags,X; Load the sprite flags. [a7df]ORA #$80; Set the falling bit. [a7e1]STA CurrentSprites_Flags,X; Store it. [a7e4]RTS
;============================================================================ ; 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] [a7e5]LDY #$01; Y = 1 (op direction argument) [a7e7]LDA (Sprites_ReadInfoAddr),Y; Read the direction to check. [a7e9]ASL A; Convert to a word boundary for the lookup table. [a7ea]TAY; Y = A [a7eb]LDA SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS+1,Y; Load the lower byte of the subcommand address. [a7ee]PHA; Push to the stack. [a7ef]LDA SPRITEOP_CHECKDISTANCETOPLAYER_SUBCOMMANDS,Y; Load the upper byte of the subcommand address. [a7f2]PHA; Push to the stack. [a7f3]RTS
;============================================================================ ; 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] [a7f4]pointer SpriteOp_CheckDistanceToPlayer_X-1; [0]: [a7f6]pointer 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] [a7f8]LDA CurrentSprites_Behaviors,X; A = Sprite behavior [a7fb]BPL @_checkDistance; If the behavior is ready, jump to check.
; ; The behavior is not ready, so skip this check and all ; arguments. ;
[a7fd]LDA #$07; 7 = bytes to skip. [a7ff]JSR Sprites_IncrementScriptAddr; Skip them. [a802]JMP 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] [a805]JSR Sprite_CalcDistanceXToPlayer; Calculate the distance between the sprite and player. [a808]LDY #$02; Y = 2 (op distance argument) [a80a]CMP (Sprites_ReadInfoAddr),Y; Is distance < argument? [a80c]BCC @_isLessThan; If so, jump.
; ; The calculated distance is >= the distance argument. ; Choose the second address. ;
[a80e]LDY #$04; Y = 4 [a810]INY; Y++ (5) [a811]LDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a813]PHA; Push to the stack. [a814]INY; Y++ (6) [a815]LDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a817]STA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a819]PLA; Pop the lower byte. [a81a]STA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a81c]RTS; Return.
; ; The calculated distance is < the distance argument. ; Choose the first address. ;
[a81d]@_isLessThan:; [$a81d] [a81d]INY; Y++ (3) [a81e]LDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a820]PHA; Push to the stack. [a821]INY; Y++ (4) [a822]LDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a824]STA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a826]PLA; Pop the lower byte. [a827]STA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a829]RTS; 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] [a82a]LDA CurrentSprites_Behaviors,X; A = Sprite behavior [a82d]BPL @_checkDistance; If the behavior is ready, jump to check.
; ; The behavior is not ready, so skip this check and all ; arguments. ;
[a82f]LDA #$07; 7 = bytes to skip. [a831]JSR Sprites_IncrementScriptAddr; Skip them. [a834]JMP 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] [a837]JSR Sprite_CalcDistanceYToPlayer; Calculate the distance between the sprite and player. [a83a]LDY #$02; Y = 2 (op distance argument) [a83c]CMP (Sprites_ReadInfoAddr),Y; Is distance < argument? [a83e]BCC @_isLessThan; If so, jump.
; ; The calculated distance is >= the distance argument. ; Choose the first address. ;
[a840]LDY #$04; Y = 4 (byte before second address)
; ; Load the jump address for the script based on Y above. ;
[a842]@_isLessThan:; [$a842] [a842]INY; Y++ (target jump address) [a843]LDA (Sprites_ReadInfoAddr),Y; A = lower byte of jump address. [a845]PHA; Push to the stack. [a846]INY; Y++ [a847]LDA (Sprites_ReadInfoAddr),Y; A = upper byte of jump address. [a849]STA Sprites_ReadInfoAddr_U; Store as the new upper byte of the read address. [a84b]PLA; Pop the lower byte. [a84c]STA Sprites_ReadInfoAddr; Store as the new lower byte of the read address. [a84e]RTS; 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:; [$a84f]
; ; Load the address from parameter 1. ;
[a84f]LDY #$01; Y = 1 (argument 1, byte 1) [a851]LDA (Sprites_ReadInfoAddr),Y; Load the lower byte. [a853]STA Temp_Addr_L; Store as the lower byte of the address to write to. [a855]INY; Y++ (argument 1, byte 2) [a856]LDA (Sprites_ReadInfoAddr),Y; Load the upper byte. [a858]STA Temp_Addr_U; Store as the upper byte of the address to write to.
; ; Load the value to set from parameter 2. ;
[a85a]INY; Y++ (argument 2) [a85b]LDA (Sprites_ReadInfoAddr),Y; Load the value.
; ; Set the value in the address. ;
[a85d]PHA; Push the new value to the stack. [a85e]TXA; A = X (sprite index) [a85f]TAY; Y = A [a860]PLA; Pop the new value from the stack. [a861]CLC [a862]ADC (Temp_Addr_L),Y; Add the value from the address to our argument value. [a864]STA (Temp_Addr_L),Y; Store it as the new value.
; ; Jump to the next op and load it. ;
[a866]LDA #$04; A = 4 (number of bytes to skip) [a868]JSR Sprites_IncrementScriptAddr; Skip over those bytes. [a86b]JMP 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] [a86e]LDA #$01; A = 1 (number of bytes to skip) [a870]JSR Sprites_IncrementScriptAddr; Skip over the byte. [a873]JSR Sprite_FinishBehavior; Finish the current behavior. [a876]JMP 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] [a879]CLC; C = 0 [a87a]ADC Sprites_ReadInfoAddr; A = offset + lower byte of the behavior address If overflow, C = 1 [a87c]STA Sprites_ReadInfoAddr; Store it. [a87e]LDA Sprites_ReadInfoAddr_U; A = upper byte of the behavior address [a880]ADC #$00; Add carry, if set. [a882]STA Sprites_ReadInfoAddr_U; Store it. [a884]RTS
;============================================================================ ; 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] [a885]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a888]AND #$40; Set Z = ready not set. [a88a]RTS
;============================================================================ ; 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] [a88b]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a88e]AND #$bf; Clear the Ready flag. [a890]STA CurrentSprites_Flags,X; Store it. [a893]RTS
;============================================================================ ; 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] [a894]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a897]ORA #$40; Set the Ready flag. [a899]STA CurrentSprites_Flags,X; Store it. [a89c]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[a89d]CurrentSpriteFlags_SetBit5:; [$a89d] [a89d]LDA CurrentSprites_Flags,X [a8a0]ORA #$20 [a8a2]STA CurrentSprites_Flags,X [a8a5]RTS
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[a8a6]Sprite_ClearFlags:; [$a8a6] [a8a6]LDA #$00 [a8a8]STA CurrentSprites_Flags,X [a8ab]RTS
;============================================================================ ; 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] [a8ac]JSR Sprite_SetBehaviorNotReady [a8af]LDA CurrentSprites_Behaviors,X [a8b2]ORA #$80 [a8b4]STA CurrentSprites_Behaviors,X [a8b7]RTS
;============================================================================ ; 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] [a8b8]LDA CurrentSprites_Phases,X; Load the current phase. [a8bb]SEC [a8bc]SBC #$01; Subtract 1 [a8be]RTS; 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] [a8bf]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a8c2]ORA #$10; Set the visibility flag. [a8c4]STA CurrentSprites_Flags,X; And save it. [a8c7]RTS
;============================================================================ ; 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] [a8c8]LDA CurrentSprites_Flags,X; Load the sprite's flags. [a8cb]AND #$10; Check the visible flag. [a8cd]RTS; 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] [a8ce]LDA CurrentSprites_Flags,X; Load the flags for the given sprite. [a8d1]AND #$ef; Clear the visible flag. [a8d3]STA CurrentSprites_Flags,X; Set the new flags. [a8d6]RTS
;============================================================================ ; TODO: Document SpriteBehavior__a8d7 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60f] ;============================================================================
[a8d7]SpriteBehavior__a8d7:; [$a8d7] [a8d7]JSR Sprite_IsBehaviorNotReady [a8da]BNE SpriteBehavior__a91e [a8dc]LDY #$00 [a8de]LDA (Sprites_ReadInfoAddr),Y [a8e0]STA CurrentSprites_BehaviorData2,X [a8e3]INY [a8e4]LDA (Sprites_ReadInfoAddr),Y [a8e6]STA CurrentSprites_BehaviorData3,X [a8e9]LDA #$02 [a8eb]JSR Sprites_IncrementScriptAddr [a8ee]JSR Sprite_SetBehaviorReady [a8f1]LDA CurrentSprites_Flags,X [a8f4]ORA #$02 [a8f6]STA CurrentSprites_Flags,X [a8f9]JMP SpriteBehavior__a91e
;============================================================================ ; TODO: Document SpriteBehavior_MoveTowardPlayer ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5e7] ;============================================================================
[a8fc]SpriteBehavior_MoveTowardPlayer:; [$a8fc] [a8fc]JSR Sprite_IsBehaviorNotReady [a8ff]BNE SpriteBehavior__a91e [a901]LDY #$00 [a903]LDA (Sprites_ReadInfoAddr),Y [a905]STA CurrentSprites_BehaviorData2,X [a908]INY [a909]LDA (Sprites_ReadInfoAddr),Y [a90b]STA CurrentSprites_BehaviorData3,X [a90e]LDA #$02 [a910]JSR Sprites_IncrementScriptAddr [a913]JSR Sprite_SetBehaviorReady [a916]LDA CurrentSprites_Flags,X [a919]AND #$fd [a91b]STA CurrentSprites_Flags,X
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document SpriteBehavior__a91e ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SpriteBehavior_MoveTowardPlayer ; SpriteBehavior__a8d7 ;============================================================================
[a91e]SpriteBehavior__a91e:; [$a91e] [a91e]JSR Sprites_SetCurrentSpriteCanMove [a921]BCC @LAB_PRG14__a92e [a923]JSR CurrentSprite_HandleFall [a926]LDA CurrentSprites_Flags,X [a929]AND #$02 [a92b]BEQ @LAB_PRG14__a92e [a92d]RTS [a92e]@LAB_PRG14__a92e:; [$a92e] [a92e]LDA CurrentSprites_BehaviorData2,X [a931]STA a:Arg_DeltaX_Frac [a934]LDA CurrentSprites_BehaviorData3,X [a937]STA a:Arg_DeltaX_Full [a93a]JSR Sprites_Something_SomethingAndMoveHoriz [a93d]JSR Sprites_CountdownBehavior [a940]RTS
;============================================================================ ; TODO: Document SpriteBehavior_WalkForward ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5ef] ;============================================================================
[a941]SpriteBehavior_WalkForward:; [$a941] [a941]JSR Sprite_IsBehaviorNotReady [a944]BNE @LAB_PRG14__a95b [a946]LDY #$00 [a948]LDA (Sprites_ReadInfoAddr),Y [a94a]STA CurrentSprites_BehaviorData2,X [a94d]INY [a94e]LDA (Sprites_ReadInfoAddr),Y [a950]STA CurrentSprites_BehaviorData3,X [a953]LDA #$02 [a955]JSR Sprites_IncrementScriptAddr [a958]JSR Sprite_SetBehaviorReady [a95b]@LAB_PRG14__a95b:; [$a95b] [a95b]JSR Sprites_SetCurrentSpriteCanMove [a95e]BCC @LAB_PRG14__a966 [a960]JSR BScript_Action_FlipXDirection [a963]JMP CurrentSprite_HandleFall [a966]@LAB_PRG14__a966:; [$a966] [a966]LDA CurrentSprites_BehaviorData2,X [a969]STA a:Arg_DeltaX_Frac [a96c]LDA CurrentSprites_BehaviorData3,X [a96f]STA a:Arg_DeltaX_Full [a972]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [a975]JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Fall ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a611] ;============================================================================
[a978]SpriteBehavior_Fall:; [$a978] [a978]JSR Sprite_IsBehaviorNotReady [a97b]BNE @LAB_PRG14__a980 [a97d]JSR Sprite_SetBehaviorReady [a980]@LAB_PRG14__a980:; [$a980] [a980]JSR Sprites_SetCurrentSpriteCanMove [a983]BCC Call_Sprites_CountdownBehavior [a985]JSR CurrentSprite_HandleFall [a988]JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Wait ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5e9] ;============================================================================
[a98b]SpriteBehavior_Wait:; [$a98b] [a98b]JSR Sprite_IsBehaviorNotReady [a98e]BNE Call_Sprites_CountdownBehavior [a990]JSR Sprite_SetBehaviorReady
; ; XREFS: ; SpriteBehavior_Fall ; SpriteBehavior_Wait ;
[a993]Call_Sprites_CountdownBehavior:; [$a993] [a993]JMP Sprites_CountdownBehavior [a996]RTS
;============================================================================ ; TODO: Document SpriteBehavior_SomethingEyeball_17 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a609] ;============================================================================
[a997]SpriteBehavior_SomethingEyeball_17:; [$a997] [a997]JSR Sprite_IsBehaviorNotReady [a99a]BNE @_ready [a99c]LDY #$00 [a99e]LDA (Sprites_ReadInfoAddr),Y [a9a0]STA CurrentSprites_BehaviorState_XFrac,X [a9a3]INY [a9a4]LDA (Sprites_ReadInfoAddr),Y [a9a6]STA CurrentSprites_BehaviorState_XFull,X [a9a9]INY [a9aa]LDA (Sprites_ReadInfoAddr),Y [a9ac]STA CurrentSprites_BehaviorState_YFrac,X [a9af]INY [a9b0]LDA (Sprites_ReadInfoAddr),Y [a9b2]STA CurrentSprites_BehaviorState_YFull,X [a9b5]LDA #$04 [a9b7]JSR Sprites_IncrementScriptAddr [a9ba]JSR Sprite_SetBehaviorReady [a9bd]@_ready:; [$a9bd] [a9bd]LDA CurrentSprites_BehaviorState_XFrac,X [a9c0]STA a:Arg_DeltaX_Frac [a9c3]LDA CurrentSprites_BehaviorState_XFull,X [a9c6]STA a:Arg_DeltaX_Full [a9c9]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeHoriz [a9cc]LDA CurrentSprites_BehaviorState_YFrac,X [a9cf]STA a:Arg_DeltaY_Frac [a9d2]LDA CurrentSprites_BehaviorState_YFull,X [a9d5]STA a:Arg_DeltaY_Full [a9d8]JSR Sprite_Maybe_TurnAroundIfAtScreenEdgeVert [a9db]JMP Sprites_CountdownBehavior
;============================================================================ ; TODO: Document SpriteBehavior_Hop ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f9] ;============================================================================
[a9de]SpriteBehavior_Hop:; [$a9de] [a9de]JSR Sprite_IsBehaviorNotReady [a9e1]BNE @LAB_PRG14__aa14 [a9e3]LDY #$00 [a9e5]LDA (Sprites_ReadInfoAddr),Y [a9e7]STA CurrentSprites_BehaviorState_XFrac,X [a9ea]INY [a9eb]LDA (Sprites_ReadInfoAddr),Y [a9ed]STA CurrentSprites_BehaviorState_XFull,X [a9f0]INY [a9f1]LDA (Sprites_ReadInfoAddr),Y [a9f3]STA CurrentSprites_InternalBehaviorStates,X [a9f6]LDA #$03 [a9f8]JSR Sprites_IncrementScriptAddr [a9fb]LDA #$00 [a9fd]STA CurrentSprites_BehaviorArg1,X [aa00]JSR Sprite_SetBehaviorReady [aa03]LDA CurrentSprites_Flags,X [aa06]AND #$7f [aa08]STA CurrentSprites_Flags,X [aa0b]LDY CurrentSprites_InternalBehaviorStates,X [aa0e]LDA SPRITE_BEHAVIOUR_HOP_START_TICKS,Y [aa11]STA CurrentSprites_BehaviorData3,X [aa14]@LAB_PRG14__aa14:; [$aa14] [aa14]LDA CurrentSprites_BehaviorState_XFull,X [aa17]STA a:Arg_DeltaX_Full [aa1a]LDA CurrentSprites_BehaviorState_XFrac,X [aa1d]STA a:Arg_DeltaX_Frac [aa20]JSR Sprites_Something_SomethingAndMoveHoriz [aa23]LDY CurrentSprites_InternalBehaviorStates,X [aa26]LDA SPRITE_BEHAVIOR_HOP_GRAVITY,Y [aa29]TAY [aa2a]LDA CurrentSprites_BehaviorData3,X [aa2d]JSR Sprites_CalcYFromGravity [aa30]PHA [aa31]LDY CurrentSprites_InternalBehaviorStates,X [aa34]LDA SPRITE_BEHAVIOR_HOP_JUMP_STRENGTH,Y [aa37]TAY [aa38]PLA [aa39]JSR Sprites_CalcVerticalSpriteMovement [aa3c]JSR Sprite_MoveVertical [aa3f]BCC @LAB_PRG14__aa49 [aa41]LDA CurrentSprites_Flags,X [aa44]BPL @LAB_PRG14__aa49 [aa46]JMP Sprite_FinishBehavior [aa49]@LAB_PRG14__aa49:; [$aa49] [aa49]INC CurrentSprites_BehaviorData3,X [aa4c]LDY CurrentSprites_InternalBehaviorStates,X [aa4f]LDA SPRITE_BEHAVIOR_HOP_GRAVITY,Y [aa52]TAY [aa53]LDA CurrentSprites_BehaviorData3,X [aa56]AND SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [aa59]BNE @_return [aa5b]LDA CurrentSprites_Flags,X [aa5e]BMI @LAB_PRG14__aa63
; ; Begin falling. ;
[aa60]JMP BScript_Action_FlipYDirection [aa63]@LAB_PRG14__aa63:; [$aa63] [aa63]LDY CurrentSprites_InternalBehaviorStates,X [aa66]LDA CurrentSprites_BehaviorData3,X [aa69]CMP SPRITE_BEHAVIOR_HOP_GROUND_TICKS,Y [aa6c]BCC @_return [aa6e]DEC CurrentSprites_BehaviorData3,X [aa71]@_return:; [$aa71] [aa71]RTS
; ; XREFS: ; SpriteBehavior_Hop ;
[aa72]SPRITE_BEHAVIOUR_HOP_START_TICKS:; [$aa72] [aa72].byte $40; [0]: [aa73].byte $20; [1]: [aa74].byte $10; [2]: Monodron [aa75].byte $08; [3]: [aa76].byte $10; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa77]SPRITE_BEHAVIOR_HOP_GRAVITY:; [$aa77] [aa77].byte $02; [0]: [aa78].byte $03; [1]: [aa79].byte $04; [2]: [aa7a].byte $05; [3]: [aa7b].byte $04; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa7c]SPRITE_BEHAVIOR_HOP_JUMP_STRENGTH:; [$aa7c] [aa7c].byte $04; [0]: [aa7d].byte $05; [1]: [aa7e].byte $06; [2]: [aa7f].byte $07; [3]: [aa80].byte $07; [4]:
; ; XREFS: ; SpriteBehavior_Hop ;
[aa81]SPRITE_BEHAVIOR_HOP_GROUND_TICKS:; [$aa81] [aa81].byte $c0; [0]: [aa82].byte $60; [1]: [aa83].byte $30; [2]: [aa84].byte $18; [3]: [aa85].byte $30; [4]:
;============================================================================ ; TODO: Document SpriteBehavior_SomethingZoradohna_18 ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60b] ;============================================================================
[aa86]SpriteBehavior_SomethingZoradohna_18:; [$aa86] [aa86]JSR Sprite_IsBehaviorNotReady [aa89]BNE @LAB_PRG14__aaae [aa8b]LDY #$00 [aa8d]LDA (Sprites_ReadInfoAddr),Y [aa8f]STA CurrentSprites_BehaviorState_XFrac,X [aa92]INY [aa93]LDA (Sprites_ReadInfoAddr),Y [aa95]STA CurrentSprites_BehaviorState_XFull,X [aa98]INY [aa99]LDA (Sprites_ReadInfoAddr),Y [aa9b]STA CurrentSprites_InternalBehaviorStates,X [aa9e]LDA #$03 [aaa0]JSR Sprites_IncrementScriptAddr [aaa3]JSR Sprite_SetBehaviorReady [aaa6]LDA CurrentSprites_Flags,X [aaa9]ORA #$80 [aaab]STA CurrentSprites_Flags,X [aaae]@LAB_PRG14__aaae:; [$aaae] [aaae]LDA CurrentSprites_BehaviorState_XFull,X [aab1]STA a:Arg_DeltaX_Full [aab4]LDA CurrentSprites_BehaviorState_XFrac,X [aab7]STA a:Arg_DeltaX_Frac [aaba]JSR Sprite_MoveHorizAndTurnAroundIfNeeded [aabd]LDY CurrentSprites_InternalBehaviorStates,X [aac0]LDA BYTE_ARRAY_PRG14__aaf2,Y [aac3]TAY [aac4]LDA CurrentSprites_BehaviorData3,X [aac7]JSR Sprites_CalcYFromGravity [aaca]PHA [aacb]LDY CurrentSprites_InternalBehaviorStates,X [aace]LDA BYTE_ARRAY_PRG14__aaf6,Y [aad1]TAY [aad2]PLA [aad3]JSR Sprites_CalcVerticalSpriteMovement [aad6]JSR Sprite_MoveVertical [aad9]INC CurrentSprites_BehaviorData3,X [aadc]LDY CurrentSprites_InternalBehaviorStates,X [aadf]LDA BYTE_ARRAY_PRG14__aaf2,Y [aae2]TAY [aae3]DEY [aae4]LDA CurrentSprites_BehaviorData3,X [aae7]AND SPRITE_BEHAVIOR_HOP_PEAK_TICKS,Y [aaea]BNE @LAB_PRG14__aaef [aaec]JMP BScript_Action_FlipYDirection [aaef]@LAB_PRG14__aaef:; [$aaef] [aaef]JMP Sprites_CountdownBehavior
; ; XREFS: ; SpriteBehavior_SomethingZoradohna_18 ;
[aaf2]BYTE_ARRAY_PRG14__aaf2:; [$aaf2] [aaf2].byte $03; [0]: [aaf3].byte $04; [1]: [aaf4].byte $05; [2]: [aaf5].byte $06; [3]:
; ; XREFS: ; SpriteBehavior_SomethingZoradohna_18 ;
[aaf6]BYTE_ARRAY_PRG14__aaf6:; [$aaf6] [aaf6].byte $03; [0]: [aaf7].byte $05; [1]: [aaf8].byte $05; [2]: [aaf9].byte $07; [3]:
;============================================================================ ; TODO: Document SpriteBehavior_MoveVertically ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a60d] ;============================================================================
[aafa]SpriteBehavior_MoveVertically:; [$aafa] [aafa]JSR Sprite_IsBehaviorNotReady [aafd]BNE @LAB_PRG14__ab14 [aaff]LDY #$00 [ab01]LDA (Sprites_ReadInfoAddr),Y [ab03]STA CurrentSprites_BehaviorState_YFrac,X [ab06]INY [ab07]LDA (Sprites_ReadInfoAddr),Y [ab09]STA CurrentSprites_BehaviorState_YFull,X [ab0c]LDA #$02 [ab0e]JSR Sprites_IncrementScriptAddr [ab11]JSR Sprite_SetBehaviorReady [ab14]@LAB_PRG14__ab14:; [$ab14] [ab14]LDA CurrentSprites_BehaviorState_YFrac,X [ab17]STA a:Arg_DeltaY_Frac [ab1a]LDA CurrentSprites_BehaviorState_YFull,X [ab1d]STA a:Arg_DeltaY_Full [ab20]JSR Sprite_MoveVertAndFlipIfNeeded [ab23]JMP 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] [ab26]JSR Sprite_IsBehaviorNotReady [ab29]BNE @LAB_PRG14__ab39 [ab2b]LDA #$02 [ab2d]STA CurrentSprites_BehaviorData2,X [ab30]LDA PPU_Mask [ab32]ORA #$01 [ab34]STA PPU_Mask [ab36]JSR Sprite_SetBehaviorReady [ab39]@LAB_PRG14__ab39:; [$ab39] [ab39]DEC CurrentSprites_BehaviorData2,X [ab3c]BNE @_return [ab3e]LDA PPU_Mask [ab40]AND #$fe [ab42]STA PPU_Mask [ab44]LDA #$04 [ab46]JSR Sound_PlayEffect [ab49]LDA #$3c [ab4b]STA Player_InvincibilityPhase [ab4d]LDA Player_StatusFlag [ab4f]ORA #$02 [ab51]STA Player_StatusFlag [ab53]LDA #$00 [ab55]STA a:Arg_PlayerHealthDelta_L [ab58]LDA #$0a [ab5a]STA a:Arg_PlayerHealthDelta_U [ab5d]JSR Player_ReduceHP [ab60]LDX a:CurrentSpriteIndex [ab63]JMP Sprite_FinishBehavior [ab66]@_return:; [$ab66] [ab66]RTS
;============================================================================ ; TODO: Document SpriteBehavior_BossDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a663] ;============================================================================
[ab67]SpriteBehavior_BossDeath:; [$ab67] [ab67]JSR Sprite_IsBehaviorNotReady [ab6a]BNE @LAB_PRG14__ab77 [ab6c]LDA #$00 [ab6e]STA CurrentSprites_BehaviorData2,X [ab71]STA CurrentSprites_Phases,X [ab74]JSR Sprite_SetBehaviorReady [ab77]@LAB_PRG14__ab77:; [$ab77] [ab77]INC CurrentSprites_BehaviorData2,X [ab7a]LDA CurrentSprites_BehaviorData2,X [ab7d]CMP #$08 [ab7f]BCC @_return [ab81]INC CurrentSprites_Phases,X [ab84]LDY CurrentSprites_Phases,X [ab87]CPY #$0a [ab89]BCS @LAB_PRG14__abb0 [ab8b]LDA CurrentSprites_XPos_Full,X [ab8d]CLC [ab8e]ADC BYTE_ARRAY_PRG14__abb6,Y [ab91]STA CurrentSprites_XPos_Full,X [ab93]LDA CurrentSprites_YPos,X [ab95]CLC [ab96]ADC BYTE_ARRAY_PRG14__abc1,Y [ab99]STA CurrentSprites_YPos,X [ab9b]LDA #$00 [ab9d]STA CurrentSprites_BehaviorData2,X [aba0]LDA #$03 [aba2]JSR Sound_PlayEffect [aba5]LDA CurrentSprites_Phases,X [aba8]CMP #$05 [abaa]BCS @_return [abac]JMP Sprite_HandleDeathDropIfPossible [abaf]@_return:; [$abaf] [abaf]RTS [abb0]@LAB_PRG14__abb0:; [$abb0] [abb0]LDA #$ff [abb2]STA CurrentSprites_Entities,X [abb5]RTS
; ; XREFS: ; SpriteBehavior_BossDeath ;
[abb6]BYTE_ARRAY_PRG14__abb6:; [$abb6] [abb6].byte $00; [0]: [abb7].byte $20; [1]: [abb8].byte $f0; [2]: [abb9].byte $f0; [3]: [abba].byte $20; [4]: [abbb].byte $e0; [5]: [abbc].byte $20; [6]: [abbd].byte $f0; [7]: [abbe].byte $f0; [8]: [abbf].byte $20; [9]: [abc0].byte $e0; [10]:
; ; XREFS: ; SpriteBehavior_BossDeath ;
[abc1]BYTE_ARRAY_PRG14__abc1:; [$abc1] [abc1].byte $00; [0]: [abc2].byte $20; [1]: [abc3].byte $f0; [2]: [abc4].byte $10; [3]: [abc5].byte $e0; [4]: [abc6].byte $00; [5]: [abc7].byte $20; [6]: [abc8].byte $f0; [7]: [abc9].byte $10; [8]: [abca].byte $e0; [9]: [abcb].byte $00; [10]:
;============================================================================ ; TODO: Document SpriteBehavior_EnemyDeath ; ; INPUTS: ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; SPRITE_BEHAVIORS [$PRG14::a5f5] ; SPRITE_BEHAVIORS [$PRG14::a5f7] ;============================================================================
[abcc]SpriteBehavior_EnemyDeath:; [$abcc] [abcc]JSR Sprite_IsBehaviorNotReady [abcf]BNE @LAB_PRG14__abd9 [abd1]LDA #$00 [abd3]STA CurrentSprites_BehaviorData2,X [abd6]JSR Sprite_SetBehaviorReady [abd9]@LAB_PRG14__abd9:; [$abd9] [abd9]INC CurrentSprites_BehaviorData2,X [abdc]LDA CurrentSprites_BehaviorData2,X [abdf]CMP #$08 [abe1]BCC @LAB_PRG14__abeb [abe3]JSR Sprite_HandleDeathDropIfPossible [abe6]LDA #$ff [abe8]STA CurrentSprites_Entities,X [abeb]@LAB_PRG14__abeb:; [$abeb] [abeb]RTS
;============================================================================ ; 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] [abec]LDA #$64; 0x64 == Boss death effect. [abee]JMP 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] [abf1]LDA #$13; 0x13 == Enemy death effect. [abf3]JMP 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] [abf6]LDA #$14
; ; v-- Fall through --v ;
;============================================================================ ; TODO: Document Sprite_SetDeathEntity ; ; INPUTS: ; A ; X ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_ShowBigEnemyDeathByMagicOrWeapon ; Sprite_ShowNormalEnemyDeathByWeapon ;============================================================================
[abf8]Sprite_SetDeathEntity:; [$abf8] [abf8]PHA [abf9]LDA CurrentSprites_Entities,X [abfc]STA CurrentSprites_InternalBehaviorStates,X [abff]PLA [ac00]STA CurrentSprites_Entities,X [ac03]ASL A [ac04]TAY [ac05]LDA SPRITE_BSCRIPTS,Y [ac08]STA CurrentSprites_BehaviorAddrs_L,X [ac0b]LDA SPRITE_BSCRIPTS+1,Y [ac0e]STA CurrentSprites_BehaviorAddrs_U,X [ac11]LDA #$ff [ac13]STA CurrentSprites_Behaviors,X [ac16]STA CurrentSprites_HitByMagicBehavior,X [ac19]LDA #$00 [ac1b]STA CurrentSprites_BehaviorData2,X [ac1e]JMP 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] [ac21]JSR Sprites_HasMaxOnScreen; Check if there's room for sprites on the screen. [ac24]BCS @_return; If not, return. [ac26]JSR Sprite_RunDeathDropHandler; There's room, so run the drop handler to possibly spawn a drop. [ac29]LDX a:CurrentSpriteIndex; Restore the current sprite index to X. [ac2c]@_return:; [$ac2c] [ac2c]RTS
;============================================================================ ; TODO: Document Sprite_RunDeathDropHandler ; ; INPUTS: ; X ; Y ; ; OUTPUTS: ; TODO ; ; XREFS: ; Sprite_HandleDeathDropIfPossible ;============================================================================
[ac2d]Sprite_RunDeathDropHandler:; [$ac2d] [ac2d]STY Temp_00; Store the new sprite entity temporarily. [ac2f]LDY CurrentSprites_InternalBehaviorStates,X; Load the internal behavior state of the dead sprite. [ac32]LDA SPRITE_ENTITY_DROP_VALUES_INDEX,Y; Load the index of the drop value for this new sprite. [ac35]CMP #$ff [ac37]BEQ @_return [ac39]CMP #$40 [ac3b]BCS @_return [ac3d]STA Temp_01 [ac3f]TAY [ac40]LDA SPRITE_DROP_VALUES,Y [ac43]LDY Temp_00 [ac45]STA CurrentSprites_Values,Y [ac48]LDA CurrentSprites_XPos_Full,X [ac4a]STA CurrentSprites_XPos_Full,Y [ac4d]LDA CurrentSprites_YPos,X [ac4f]STA CurrentSprites_YPos,Y [ac52]LDA #$00 [ac54]STA CurrentSprites_HitCounter,Y [ac57]LDA #$ff [ac59]STA CurrentSprites_HitByMagicBehavior,Y [ac5c]LDY #$00 [ac5e]LDA Temp_01 [ac60]CMP #$30 [ac62]BCC @LAB_PRG14__ac66 [ac64]INY [ac65]INY [ac66]@LAB_PRG14__ac66:; [$ac66] [ac66]LDA SPRITE_DROP_HANDLERS+1,Y [ac69]PHA [ac6a]LDA SPRITE_DROP_HANDLERS,Y [ac6d]PHA [ac6e]LDY Temp_00 [ac70]@_return:; [$ac70] [ac70]RTS
;============================================================================ ; XXX Address lookup table for next handlers ; ; ; XREFS: ; Sprite_RunDeathDropHandler ;============================================================================
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[ac71]SPRITE_DROP_HANDLERS:; [$ac71] [ac71]pointer Sprites_ReplaceWithCoinDrop-1; Sprites_ReplaceWithCoinDrop [$PRG14::ac71]
; ; XREFS: ; Sprite_RunDeathDropHandler ;
[ac73]SPRITE_DROP_HANDLERS_LAST:; [$ac73] [ac73]pointer Sprite_ReplaceWithBreadDrop-1; Sprite_ReplaceWithBreadDrop [$PRG14::ac73]
;============================================================================ ; 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] [ac75]LDA #$10 [ac77]JSR Sound_PlayEffect [ac7a]TYA [ac7b]TAX [ac7c]LDA #$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:; [$ac7e]
; ; Set the sprite entity. ;
[ac7e]STA CurrentSprites_Entities,X; Set the provided sprite entity at the given index.
; ; Set the sprite behavior address. ;
[ac81]ASL A; Convert the sprite entity to a word boundary for the behavior addresses. [ac82]TAY; Y = A [ac83]LDA SPRITE_BSCRIPTS,Y; Load the lower byte of the sprite behavior for this entity. [ac86]STA CurrentSprites_BehaviorAddrs_L,X; Set it as the current behavior for this sprite. [ac89]LDA SPRITE_BSCRIPTS+1,Y; Load the upper byte. [ac8c]STA CurrentSprites_BehaviorAddrs_U,X; And set that.
; ; Set the sprite subtype to 0xFF (unset). ;
[ac8f]LDA #$ff; A = 0xFF [ac91]STA CurrentSprites_Behaviors,X; Set it as the subtype.
; ; Set the sprite hitbox. ;
[ac94]LDY #$02; Y = 2 [ac96]LDA SPRITE_ENTITIES_HITBOX_TYPES,Y; A = hitbox type for Y. [ac99]STA CurrentSprites_HitBoxTypes,X; Set as the hitbox.
; ; Disable sprite behaviors. ;
[ac9c]JMP 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] [ac9f]TYA; A = Y (sprite index) [aca0]TAX; X = A [aca1]LDA #$01; A = 1 [aca3]JMP Sprite_ReplaceWithDroppedItem
;============================================================================ ; MAYBE DEADCODE ;============================================================================
[aca6]Sprite_ReplaceWithMattock:; [$aca6] [aca6]JSR @_Sprites_ReplaceWithMattock_HasMaxOnScreen; Check if all sprite slots are populated. [aca9]BCS @_return; If so, return.
; ; There are unpopulated slots. Populate at the given index. ;
[acab]LDA #$50; A = Mattock sprite ID. [acad]STA CurrentSprites_Entities,X; Store as the entity at this index. [acb0]ASL A; Normalize to a word boundary. [acb1]TAY; Y = A
; ; Set the behavior address for the Mattock to ; BSCRIPTS_OBJ_MATTOCK. ;
[acb2]LDA SPRITE_BSCRIPTS,Y; A = 0x1B. [acb5]STA CurrentSprites_BehaviorAddrs_L,X; Set as lower byte. [acb8]LDA SPRITE_BSCRIPTS+1,Y; A = 0xB2. [acbb]STA CurrentSprites_BehaviorAddrs_U,X; Set as upper byte.
; ; Set the subtype to 0xFF (unset). ;
[acbe]LDA #$ff; A = 0xFF [acc0]STA CurrentSprites_Behaviors,X; Set subtype to A.
; ; Set the hitbox of the sprite. ;
[acc3]LDY CurrentSprites_Entities,X; Y = sprite entity. [acc6]LDA SPRITE_ENTITIES_HITBOX_TYPES,Y; A = hitbox type for Y. [acc9]STA CurrentSprites_HitBoxTypes,X; Store as the hitbox type.
; ; Set the Y position of the sprite to 32. ;
[accc]LDA #$20; A = 32 [acce]STA CurrentSprites_YPos,X; Set as X position.
; ; Set the X position of the sprite as 120. ;
[acd0]LDA #$78; A = 120 [acd2]STA CurrentSprites_XPos_Full,X; Set as X position.
; ; Set the PPU address for the sprite. ;
[acd4]LDA #$90; A = 0x90 [acd6]STA CurrentSprites_PPUOffsets,X; Set as the PPU address. [acd9]JMP Sprite_SetBehaviorNotReady; Disable behaviors for the sprite. [acdc]@_return:; [$acdc] [acdc]RTS
;============================================================================ ; 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] [acdd]LDX #$07; X = 7 (our loop counter) [acdf]@_loop:; [$acdf] [acdf]LDA CurrentSprites_Entities,X; A = sprite entity at X [ace2]CMP #$ff; Is it 0xFF (unpopulated)? [ace4]BNE @_isPopulated; If not, jump to prepare the next loop.
; ; There's an unpopulated sprite. Return a false result. ;
[ace6]CLC; Set C = 0 [ace7]RTS; And return it. [ace8]@_isPopulated:; [$ace8] [ace8]DEX; X-- [ace9]BPL @_loop; If >= 0, loop.
; ; All slots are populated. Return a true result. ;
[aceb]SEC; Set C = 1 [acec]RTS; 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] [aced].byte $0a; [0]: [acee].byte $0f; [1]: [acef].byte $12; [2]: [acf0].byte $14; [3]: [acf1].byte $16; [4]: [acf2].byte $1a; [5]: [acf3].byte $20; [6]: [acf4].byte $35; [7]: [acf5].byte $38; [8]: [acf6].byte $3b; [9]: [acf7].byte $3f; [10]: [acf8].byte $40; [11]: [acf9].byte $43; [12]: [acfa].byte $48; [13]: [acfb].byte $4a; [14]: [acfc].byte $4e; [15]: [acfd].byte $55; [16]: [acfe].byte $5a; [17]: [acff].byte $62; [18]: [ad00].byte $64; [19]: [ad01].byte $73; [20]: [ad02].byte $78; [21]: [ad03].byte $80; [22]: [ad04].byte $88; [23]: [ad05].byte $96; [24]: [ad06].byte $b4; [25]: [ad07].byte $be; [26]: [ad08].byte $c8; [27]: [ad09].byte $dc; [28]: [ad0a].byte $e6; [29]: [ad0b].byte $f0; [30]: [ad0c].byte $fa; [31]: [ad0d].byte $00; [32]: [ad0e].byte $00; [33]: [ad0f].byte $00; [34]: [ad10].byte $00; [35]: [ad11].byte $00; [36]: [ad12].byte $00; [37]: [ad13].byte $00; [38]: [ad14].byte $00; [39]: [ad15].byte $00; [40]: [ad16].byte $00; [41]: [ad17].byte $00; [42]: [ad18].byte $00; [43]: [ad19].byte $00; [44]: [ad1a].byte $00; [45]: [ad1b].byte $00; [46]: [ad1c].byte $00; [47]: [ad1d].byte $02; [48]: [ad1e].byte $04; [49]: [ad1f].byte $08; [50]: [ad20].byte $10; [51]: [ad21].byte $0e; [52]: [ad22].byte $14; [53]: [ad23].byte $19; [54]: [ad24].byte $1e; [55]: [ad25].byte $1f; [56]: [ad26].byte $28; [57]: [ad27].byte $32; [58]: [ad28].byte $37; [59]: [ad29].byte $3c; [60]: [ad2a].byte $40; [61]: [ad2b].byte $46; [62]: [ad2c].byte $4c; [63]:
;============================================================================ ; A mapping of sprite entity IDs to behavior state addresses. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[ad2d]SPRITE_BSCRIPTS:; [$ad2d] [ad2d]pointer BSCRIPTS_NOOP; [0]:
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[ad2f]SPRITE_BSCRIPTS_1_:; [$ad2f] [ad2f]pointer BSCRIPTS_OBJ_BREAD; [1]: Dropped: Bread
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[ad31]SPRITE_BSCRIPTS_2_:; [$ad31] [ad31]pointer BSCRIPTS_OBJ_COIN; [2]: Dropped: Coin [ad33]pointer SPRITE_BEHAVIORS_GARBLED_03; [3]: Enemy: ? [ad35]pointer BSCRIPTS_ENEMY_RAIDEN; [4]: Enemy: Raiden [ad37]pointer BSCRIPTS_ENEMY_NECRON_AIDES; [5]: Enemy: Necron Aides [ad39]pointer BSCRIPTS_ENEMY_ZOMBIE; [6]: Enemy: Zombie [ad3b]pointer BSCRIPTS_ENEMY_HORNET; [7]: Enemy: Hornet [ad3d]pointer BSCRIPTS_ENEMY_BIHORUDA; [8]: Enemy: Bihoruda [ad3f]pointer BSCRIPTS_ENEMY_LILITH; [9]: Enemy: Lilith [ad41]pointer BSCRIPTS_GARBLED_10; [10]: Magic: ? [ad43]pointer BSCRIPTS_ENEMY_YUINARU; [11]: Enemy: Yuinaru [ad45]pointer BSCRIPTS_ENEMY_SNOWMAN; [12]: Enemy: Snowman [ad47]pointer BSCRIPTS_ENEMY_NASH; [13]: Enemy: Nash [ad49]pointer BSCRIPTS_ENEMY_FIRE_GIANT; [14]: Enemy: Fire Giant [ad4b]pointer BSCRIPTS_ENEMY_ISHIISU; [15]: Enemy: Ishiisu [ad4d]pointer BSCRIPTS_ENEMY_EXECUTION_HOOD; [16]: Enemy: Execution Hood [ad4f]pointer BSCRIPTS_BOSS_ROKUSUTAHN; [17]: Boss: Rokusutahn [ad51]pointer BSCRIPTS_ENEMY_UNUSED_18; [18]: Boss: unused (round body of snake boss)
; ; XREFS: ; Sprite_SetDeathEntity ;
[ad53]SPRITE_BSCRIPTS_19_:; [$ad53] [ad53]pointer BSCRIPTS_LIGHTNING_BALL_19; [19]: Effect: Enemy death
; ; XREFS: ; Sprite_SetDeathEntity ;
[ad55]SPRITE_BSCRIPTS_20_:; [$ad55] [ad55]pointer BSCRIPTS_ENEMY_CHARRON; [20]: Effect: Lightning ball [ad57]pointer BSCRIPTS_ENEMY_UNUSED_21; [21]: Enemy: Charron [ad59]pointer BSCRIPTS_NOOP; [22]: Enemy: ? (Unused) [ad5b]pointer BSCRIPTS_ENEMY_GERIBUTA; [23]: Enemy: Geributa [ad5d]pointer BSCRIPTS_ENEMY_SUGATA; [24]: Enemy: Sugata [ad5f]pointer BSCRIPTS_ENEMY_GRIMLOCK; [25]: Enemy: Grimlock [ad61]pointer BSCRIPTS_ENEMY_GIANT_BEES; [26]: Enemy: Giant Bees [ad63]pointer BSCRIPTS_ENEMY_MYCONID; [27]: Enemy: Myconid [ad65]pointer BSCRIPTS_ENEMY_NAGA; [28]: Enemy: Naga [ad67]pointer BSCRIPTS_ENEMY_UNUSED_29; [29]: Enemy: Skeleton Knight (unused) [ad69]pointer BSCRIPTS_ENEMY_GIANT_STRIDER; [30]: Enemy: Giant Strider [ad6b]pointer BSCRIPTS_ENEMY_SIR_GAWAINE_WOLFMAN; [31]: Enemy: Sir Gawaine [ad6d]pointer BSCRIPTS_ENEMY_MASKMAN; [32]: Enemy: Maskman [ad6f]pointer BSCRIPTS_ENEMY_SIR_GAWAINE_WOLFMAN; [33]: Enemy: Wolfman [ad71]pointer BSCRIPTS_ENEMY_YAREEKA; [34]: Enemy: Yareeka [ad73]pointer BSCRIPTS_ENEMY_MAGMAN; [35]: Enemy: Magman [ad75]pointer BSCRIPTS_ENEMY_UNUSED_36; [36]: Enemy: Curly-tailed guy with spear (unused) [ad77]pointer BSCRIPTS_NOOP; [37]: Enemy: ? (unused) [ad79]pointer BSCRIPTS_ENEMY_IKEDA; [38]: Enemy: Ikeda [ad7b]pointer BSCRIPTS_ENEMY_UNUSED_39; [39]: Enemy: Muppet guy (unused) [ad7d]pointer BSCRIPTS_ENEMY_LAMPREY; [40]: Enemy: Lamprey [ad7f]pointer BSCRIPTS_NOOP; [41]: Enemy: ? (unused) [ad81]pointer BSCRIPTS_ENEMY_MONODRON; [42]: Enemy: Monodron [ad83]pointer BSCRIPTS_ENEMY_UNUSED_43; [43]: Enemy: Winged skeleton (unused) [ad85]pointer BSCRIPTS_ENEMY_TAMAZUTSU; [44]: Enemy: Tamazutsu [ad87]pointer BSCRIPTS_BOSS_RIPASHEIKU; [45]: Boss: Ripasheiku [ad89]pointer BSCRIPTS_BOSS_ZORADOHNA; [46]: Boss: Zoradohna [ad8b]pointer BSCRIPTS_BOSS_BORABOHRA; [47]: Boss: Borabohra [ad8d]pointer BSCRIPTS_BOSS_PAKUKAME; [48]: Boss: Pakukame [ad8f]pointer BSCRIPTS_BOSS_ZORUGERIRU; [49]: Boss: Zorugeriru [ad91]pointer BSCRIPTS_BOSS_KING_GRIEVE; [50]: Boss: King Grieve [ad93]pointer BSCRIPTS_BOSS_SHADOW_EURA; [51]: Boss: Shadow Eura [ad95]pointer BSCRIPTS_NPC_WALKING_MAN; [52]: NPC: Walking Man 1 [ad97]pointer BSCRIPTS_NPC_UNUSED_BLUE_LADY; [53]: NPC: Blue lady (unused) [ad99]pointer BSCRIPTS_NPC_UNUSED_CHILD; [54]: NPC: Child (unused) [ad9b]pointer BSCRIPTS_NPC_ARMOR_SALESMAN; [55]: NPC: Armor Salesman [ad9d]pointer BSCRIPTS_NPC_MARTIAL_ARTS; [56]: NPC: Martial Artist [ad9f]pointer BSCRIPTS_NPC_PRIEST; [57]: NPC: Priest [ada1]pointer BSCRIPTS_NPC_KING; [58]: NPC: King [ada3]pointer BSCRIPTS_NPC_MAGIC_TEACHER; [59]: NPC: Magic Teacher [ada5]pointer BSCRIPTS_NPC_KEY_SALESMAN; [60]: NPC: Key Salesman [ada7]pointer BSCRIPTS_NPC_SMOKING_MAN; [61]: NPC: Smoking Man [ada9]pointer BSCRIPTS_NPC_MAN_IN_CHAIR; [62]: NPC: Man in Chair [adab]pointer BSCRIPTS_NPC_SITTING_MAN; [63]: NPC: Sitting Man [adad]pointer BSCRIPTS_NPC_MEAT_SALESMAN; [64]: NPC: Meat Salesman [adaf]pointer BSCRIPTS_NPC_LADY_BLUE_DRESS_WITH_CUP; [65]: NPC: Lady in Blue Dress with Cup [adb1]pointer BSCRIPTS_NPC_KINGS_GUARD; [66]: NPC: Guard [adb3]pointer BSCRIPTS_NPC_DOCTOR; [67]: NPC: Doctor [adb5]pointer BSCRIPTS_NPC_WALKING_WOMAN_01; [68]: NPC: Walking Woman 1 [adb7]pointer BSCRIPTS_NPC_WALKING_WOMAN_02; [69]: NPC: Walking Woman 2 [adb9]pointer BSCRIPTS_ENEMY_UNUSED_EYEBALL; [70]: Enemy: Eyeball (unused) [adbb]pointer BSCRIPTS_ENEMY_ZOZURA; [71]: Enemy: Zozura [adbd]pointer BSCRIPTS_OBJ_GLOVE; [72]: Item: Glove [adbf]pointer BSCRIPTS_OBJ_BLACK_ONYX; [73]: Item: Black Onyx [adc1]pointer BSCRIPTS_OBJ_PENDANT; [74]: Item: Pendant [adc3]pointer BSCRIPTS_OBJ_POTIONLIKE; [75]: Item: Red Potion [adc5]pointer BSCRIPTS_OBJ_POTIONLIKE; [76]: Item: Poison [adc7]pointer BSCRIPTS_OBJ_POTIONLIKE; [77]: Item: Elixir [adc9]pointer BSCRIPTS_OBJ_OINTMENT; [78]: Item: Ointment [adcb]pointer BSCRIPTS_OBJ_POTIONLIKE; [79]: Trigger: Intro
; ; XREFS: ; Sprite_ReplaceWithMattock ;
[adcd]SPRITE_BSCRIPTS_80_:; [$adcd] [adcd]pointer BSCRIPTS_OBJ_MATTOCK; [80]: Item: Mattock
; ; XREFS: ; Sprite_Maybe_ResetState ;
[adcf]SPRITE_BSCRIPTS_81_:; [$adcf] [adcf]pointer BSCRIPTS_GARBLED_81; [81]: Magic: ? [add1]pointer BSCRIPTS_FOUNTAIN; [82]: Effect: Fountain [add3]pointer SPRITE_BEHAVIORS_UNKNOWN_83; [83]: Magic: ? [add5]pointer BSCRIPTS_GARBLED_81; [84]: Magic: Enemy Fireball [add7]pointer BSCRIPTS_OBJ_WINGBOOTS; [85]: Item: Wing Boots [add9]pointer BSCRIPTS_OBJ_HOURGLASS; [86]: Item: Hour Glass [addb]pointer BSCRIPTS_OBJ_MAGICAL_ROD; [87]: Item: Magical Rod [addd]pointer BSCRIPTS_OBJ_BATTLE_SUIT; [88]: Item: Battle Suit [addf]pointer BSCRIPTS_OBJ_BATTLE_HELMET; [89]: Item: Battle Helmet [ade1]pointer BSCRIPTS_OBJ_DRAGON_SLAYER; [90]: Item: Dragon Slayer [ade3]pointer BSCRIPTS_OBJ_MATTOCK_QUEST; [91]: Item: Mattock [ade5]pointer BSCRIPTS_OBJ_WINGSBOOTS_QUEST; [92]: Item: Wing Boots (from quest) [ade7]pointer BSCRIPTS_OBJ_RED_POTION_RANDOM; [93]: Item: Red Potion [ade9]pointer BSCRIPTS_OBJ_POISON; [94]: Item: Poison [adeb]pointer BSCRIPTS_OBJ_GLOVE_RANDOM; [95]: Item: Glove [aded]pointer BSCRIPTS_OBJ_OINTMENT_RANDOM; [96]: Item: Ointment [adef]pointer BSCRIPTS_SPRING_OF_FORTRESS; [97]: Effect: Spring of Trunk [adf1]pointer BSCRIPTS_SPRING_OF_SKY; [98]: Effect: Spring of Sky [adf3]pointer BSCRIPTS_SPRING_OF_JOKER; [99]: Effect: Spring of Tower [adf5]pointer 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] [adf7].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] [adf8].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [adf9].byte SPRITE_BEHAVIOR_HOP; |- Hop [adfa].byte $00; |- (unused) [adfb].byte $00; |- 0 pixels [adfc].byte $00; |- 3 blocks [adfd].byte $03; '- Hop mode 3 [adfe].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [adff].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [ae00].byte $ff; |- For 255 ticks [ae01].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] [ae02].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae03].byte SPRITE_BEHAVIOR_GARBLED_3; [$ae03] SpriteBehavior [ae04].byte $00; [$ae04] byte .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] [ae06].byte SPRITE_OP_SWITCH_BEHAVIOR; [$ae06] SpriteOp [ae07].byte SPRITE_BEHAVIOR_UNKNOWN_29; [$ae07] SpriteBehavior [ae08].byte $00; [$ae08] byte .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] [ae0a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae0b].byte SPRITE_BEHAVIOR_BUZZ_AROUND; |- Buzz around [ae0c].byte $00; '- (unused) [ae0d].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] [ae0e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae0f].byte SPRITE_BEHAVIOR_BIHORUDA; [$ae0f] SpriteBehavior [ae10].byte $00; [$ae10] byte .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] [ae12].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae13].byte SPRITE_BEHAVIOR_LILITH; [$ae13] SpriteBehavior [ae14].byte $00; [$ae14] byte .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] [ae16].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae17].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [ae18].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae19].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae1a].byte $14; |- For 20 ticks [ae1b].byte $00; |- 0 pixels [ae1c].byte $01; '- 1 block [ae1d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae1e].byte SPRITE_BEHAVIOR_HOP; |- Hop [ae1f].byte $00; |- (unused) [ae20].byte $00; |- 0 pixels X [ae21].byte $02; |- 2 pixels X [ae22].byte $02; '- Hop mode 2 [ae23].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae24].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae25].byte $00; |- For 0 ticks [ae26].byte $00; |- 0 pixels [ae27].byte $01; '- 1 block [ae28]@_checkDistanceLoop:; [$ae28] [ae28].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance [ae29].byte $00; |- X direction [ae2a].byte $30; |- If < 48 [ae2b]pointer @_isNearPlayer; |- Then @_isNearPlayer [ae2d]pointer @_checkDistanceLoop; '- Else, @_checkDistanceLoop [ae2f]@_isNearPlayer:; [$ae2f] [ae2f].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae30].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae31].byte SPRITE_BEHAVIOR_FALL; |- Fall [ae32].byte $07; '- For 7 ticks [ae33].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae34].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae35].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae36].byte SPRITE_BEHAVIOR_HOP; |- Hop [ae37].byte $00; |- (unused) [ae38].byte $40; |- 64 pixels X [ae39].byte $00; |- 0 blocks X [ae3a].byte $00; '- Hop mode 0 [ae3b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae3c].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae3d].byte $14; |- For 20 ticks [ae3e].byte $e0; |- 224 pixels [ae3f].byte $00; '- 0 blocks [ae40].byte SPRITE_OP_GOTO; Op: Goto [ae41]pointer 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] [ae43].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae44].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [ae45].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae46].byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- TODO: Move X/Y [ae47].byte $00; |- For 0 ticks [ae48].byte $00; |- 0 pixels X [ae49].byte $01; |- 1 block X [ae4a].byte $00; |- 0 pixels Y [ae4b].byte $00; '- 0 blocks Y [ae4c]@_waitNearPlayerX:; [$ae4c] [ae4c].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae4d].byte $00; |- X direction [ae4e].byte $30; |- If < 48 [ae4f]pointer @_isNearPlayerX; |- Then @_isNearPlayerX [ae51]pointer @_waitNearPlayerX; '- Else @_waitNearPlayerX [ae53]@_isNearPlayerX:; [$ae53] [ae53].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae54].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae55].byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae56].byte $0a; '- For 10 ticks [ae57].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae58].byte SPRITE_ACTION_FACE_PLAYER_Y; '- Face player (Y) [ae59].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae5a].byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae5b].byte $00; |- For 0 ticks [ae5c].byte $00; |- 0 pixels X [ae5d].byte $00; |- 0 blocks X [ae5e].byte $00; |- 0 pixels Y [ae5f].byte $01; '- 1 block Y [ae60]@_waitNearPlayerY:; [$ae60] [ae60].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae61].byte $01; |- Y direction [ae62].byte $08; |- If < 8 [ae63]pointer @_isNearPlayerY; |- Then @_isNearPlayerY [ae65]pointer @_waitNearPlayerY; '- Then @_waitNearPlayerY [ae67]@_isNearPlayerY:; [$ae67] [ae67].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae68].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae69].byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae6a].byte $0a; '- For 10 ticks [ae6b].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae6c].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae6d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae6e].byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae6f].byte $32; |- For 50 ticks [ae70].byte $00; |- 0 pixels X [ae71].byte $01; |- 1 block X [ae72].byte $00; |- 0 pixels Y [ae73].byte $00; '- 0 blocks Y [ae74].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae75].byte SPRITE_ACTION_FLIP_Y_DIRECTION; '- Flip Y direction [ae76].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae77].byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae78].byte $32; |- For 50 ticks [ae79].byte $00; |- 0 pixels X [ae7a].byte $00; |- 0 blocks X [ae7b].byte $00; |- 0 pixels Y [ae7c].byte $01; '- 1 block Y [ae7d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae7e].byte SPRITE_BEHAVIOR_WAIT; |- Wait [ae7f].byte $0a; '- For 10 ticks [ae80].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae81].byte SPRITE_ACTION_RANDOMLY_FLIP_Y_DIRECTION; '- Randomly flip Y direction [ae82].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae83].byte SPRITE_BEHAVIOR_MAYBE_MOVE_XY; |- Move X/Y [ae84].byte $0a; |- For 10 ticks [ae85].byte $00; |- 0 pixels X [ae86].byte $00; |- 0 blocks X [ae87].byte $00; |- 0 pixels Y [ae88].byte $01; '- 1 block Y [ae89].byte SPRITE_OP_GOTO; Op: Goto [ae8a]pointer 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] [ae8c].byte SPRITE_OP_RUN_ACTION; Op: Run action [ae8d].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [ae8e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae8f].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [ae90].byte $00; |- For 0 ticks [ae91].byte $00; |- 0 pixels [ae92].byte $01; '- 1 block [ae93]@_waitNearPlayerX:; [$ae93] [ae93].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [ae94].byte $00; |- X direction [ae95].byte $40; |- If < 64 pixels [ae96]pointer @_isNearPlayerX; |- Then _isNearPlayerX [ae98]pointer @_waitNearPlayerX; '- Else _waitNearPlayerX [ae9a]@_isNearPlayerX:; [$ae9a] [ae9a].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [ae9b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [ae9c].byte SPRITE_BEHAVIOR_HOP; |- Hop [ae9d].byte $00; |- (unused) [ae9e].byte $00; |- 0 pixels X [ae9f].byte $01; |- 1 blocks X [aea0].byte $01; '- Hop mode 1 [aea1].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aea2].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [aea3].byte $0a; |- For 10 ticks [aea4].byte $08; |- 8 pixels [aea5].byte $00; '- 0 blocks [aea6].byte SPRITE_OP_RUN_ACTION; Op: Run action [aea7].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aea8].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aea9].byte SPRITE_BEHAVIOR_HOP; |- Hop [aeaa].byte $00; |- (unused) [aeab].byte $c0; |- 192 pixels X [aeac].byte $00; |- 0 blocks X [aead].byte $02; '- Hop mode 2 [aeae].byte SPRITE_OP_GOTO; Op: Goto [aeaf]pointer 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] [aeb1].byte SPRITE_OP_RUN_ACTION; Op: Run action [aeb2].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aeb3].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeb4].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aeb5].byte $3c; |- For 60 ticks [aeb6].byte $60; |- 96 pixels [aeb7].byte $00; '- 0 blocks [aeb8].byte SPRITE_OP_GOTO; Op: Goto [aeb9]pointer 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].byte SPRITE_OP_RUN_ACTION; Op: Run action [aebc].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aebd].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aebe].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aebf].byte $3c; |- For 60 ticks [aec0].byte $60; |- 96 pixels [aec1].byte $00; '- 0 blocks [aec2].byte SPRITE_OP_RUN_ACTION; Op: Run action [aec3].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aec4].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aec5].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aec6].byte $14; |- For 20 ticks [aec7].byte $60; |- 96 pixels [aec8].byte $00; '- 0 blocks [aec9].byte SPRITE_OP_GOTO; Op: Goto [aeca]pointer 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] [aecc].byte SPRITE_OP_RUN_ACTION; Op: Run action [aecd].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly change X direction [aece].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aecf].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [aed0].byte $05; '- For 5 ticks [aed1].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aed2].byte SPRITE_BEHAVIOR_HOP; |- Hop [aed3].byte $00; |- (unused) [aed4].byte $00; |- X fractional amount [aed5].byte $01; |- X full amount [aed6].byte $02; '- Hop mode 2 [aed7].byte SPRITE_OP_RUN_ACTION; Op: Run Action [aed8].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aed9].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeda].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [aedb].byte $14; '- For 20 ticks [aedc].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aedd].byte SPRITE_BEHAVIOR_HOP; |- Hop [aede].byte $00; |- (unused) [aedf].byte $80; |- X fractional amount [aee0].byte $01; |- X full amount [aee1].byte $02; '- Hop mode 2 [aee2].byte SPRITE_OP_GOTO; Op: Goto [aee3]pointer 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] [aee5].byte SPRITE_OP_RUN_ACTION; Op: Run action [aee6].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [aee7].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aee8].byte SPRITE_BEHAVIOR_FALL; |- Fall/Wait [aee9].byte $1e; '- For 30 ticks [aeea].byte SPRITE_OP_RUN_ACTION; Op: Run action [aeeb].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [aeec].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aeed].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [aeee].byte $00; |- For 0 ticks [aeef].byte $00; |- 0 pixels [aef0].byte $02; '- 2 blocks [aef1]@_waitNearPlayer:; [$aef1] [aef1].byte SPRITE_OP_CHECK_DISTANCE; Op: Check player distance [aef2].byte $00; |- X direction [aef3].byte $20; |- If < 32 pixels [aef4]pointer @_isNearPlayer; |- Then _isNearPlayer [aef6]pointer @_waitNearPlayer; '- Else @_waitNearPlayer [aef8]@_isNearPlayer:; [$aef8] [aef8].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [aef9].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aefa].byte SPRITE_BEHAVIOR_HOP; |- Hop [aefb].byte $00; |- (unused) [aefc].byte $00; |- 0 pixels X [aefd].byte $02; |- 2 blocks X [aefe].byte $04; '- Hop mode 4 [aeff].byte SPRITE_OP_GOTO; Op: Goto [af00]pointer 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] [af02].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af03].byte SPRITE_BEHAVIOR_BOUNCE_AND_EXPIRE; |- Bounce and expire [af04].byte $00; '- (unused) [af05].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] [af06].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af07].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af08].byte $14; |- For 20 ticks [af09].byte $80; |- 128 pixels X [af0a].byte $00; '- 0 blocks X [af0b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af0c].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af0d].byte $0a; '- For 10 ticks [af0e].byte SPRITE_OP_RUN_ACTION; Op: Run action [af0f].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [af10].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af11].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af12].byte $28; |- For 40 ticks [af13].byte $80; |- 128 pixels X [af14].byte $00; '- 0 blocks X [af15].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af16].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af17].byte $0a; '- For 10 ticks [af18].byte SPRITE_OP_RUN_ACTION; Op: Run action [af19].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af1a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af1b].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af1c].byte $14; |- For 20 ticks [af1d].byte $80; |- 128 pixels X [af1e].byte $00; '- 0 blocks X [af1f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af20].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af21].byte $0a; '- For 10 ticks [af22].byte SPRITE_OP_RUN_ACTION; Op: Run action [af23].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [af24].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af25].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af26].byte $28; |- For 40 ticks [af27].byte $80; |- 128 pixels X [af28].byte $00; '- 0 blocks X [af29].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af2a].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af2b].byte $3c; '- For 60 ticks [af2c].byte SPRITE_OP_RUN_ACTION; Op: Run action [af2d].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af2e].byte SPRITE_OP_GOTO; Op: Goto [af2f]pointer 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] [af31].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af31] SpriteOp [af32].byte SPRITE_BEHAVIOR_NECRON_AIDES; [$af32] SpriteBehavior [af33].byte $00; [$af33] byte .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] [af35].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af35] SpriteOp [af36].byte SPRITE_BEHAVIOR_YUINARU; [$af36] SpriteBehavior [af37].byte $00; [$af37] byte .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] [af39].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af39] SpriteOp [af3a].byte SPRITE_BEHAVIOR_NASH; [$af3a] SpriteBehavior [af3b].byte $00; [$af3b] byte .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] [af3d].byte SPRITE_OP_RUN_ACTION; Op: Run action [af3e].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af3f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af40].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af41].byte $00; '- For 0 ticks [af42]@_waitNearPlayer:; [$af42] [af42].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [af43].byte $00; |- X direction [af44].byte $20; |- If < 32 pixels [af45]pointer @_isNearPlayer; |- Then _isNearPlayer [af47]pointer @_waitNearPlayer; '- Else _waitNearPlayer [af49]@_isNearPlayer:; [$af49] [af49].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [af4a].byte SPRITE_OP_RUN_ACTION; Op: Run action [af4b].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af4c].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af4d].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [af4e].byte $28; |- For 40 ticks [af4f].byte $80; |- 128 pixels X [af50].byte $01; '- 1 block X [af51].byte SPRITE_OP_GOTO; Op: Goto [af52]pointer 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] [af54].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af54] SpriteOp [af55].byte SPRITE_BEHAVIOR_ISHIISU; [$af55] SpriteBehavior [af56].byte $00; [$af56] byte .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] [af58].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af58] SpriteOp [af59].byte SPRITE_BEHAVIOR_EXECUTION_HOOD; [$af59] SpriteBehavior [af5a].byte $00; [$af5a] byte .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] [af5c].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af5c] SpriteOp [af5d].byte SPRITE_BEHAVIOR_MAYBE_LIGHTNINGBALL; [$af5d] SpriteBehavior [af5e].byte $00; [$af5e] byte .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] [af60].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af60] SpriteOp [af61].byte SPRITE_BEHAVIOR_LIGHTNINBALL_CHARRON; [$af61] SpriteBehavior [af62].byte $00; [$af62] byte .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] [af64].byte SPRITE_OP_SWITCH_BEHAVIOR; [$af64] SpriteOp [af65].byte SPRITE_BEHAVIOR_EFFECT_BOSS_DEATH; [$af65] SpriteBehavior [af66].byte $00; [$af66] byte .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] [af68].byte SPRITE_OP_RUN_ACTION; Op: Run action [af69].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af6a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af6b].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af6c].byte $10; '- For 16 ticks [af6d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af6e].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af6f].byte $1e; |- For 30 ticks [af70].byte $c0; |- 192 pixels X [af71].byte $00; '- 0 blocks X [af72].byte SPRITE_OP_RUN_ACTION; Op: Run action [af73].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af74].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af75].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [af76].byte $10; '- For 16 ticks [af77].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af78].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af79].byte $1e; |- For 30 ticks [af7a].byte $00; |- 0 pixels X [af7b].byte $01; '- 1 blocks X [af7c].byte SPRITE_OP_RUN_ACTION; Op: Run action [af7d].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af7e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af7f].byte SPRITE_BEHAVIOR_WAIT; |- Wait [af80].byte $08; '- For 8 ticks [af81].byte SPRITE_OP_RUN_ACTION; Op: Run action [af82].byte SPRITE_ACTION_CAST_MAGIC; '- Cast magic [af83].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af84].byte SPRITE_BEHAVIOR_WAIT; |- Wait [af85].byte $08; '- For 8 ticks [af86].byte SPRITE_OP_GOTO; Op: Goto [af87]pointer 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] [af89].byte SPRITE_OP_RUN_ACTION; Op: Run action [af8a].byte SPRITE_ACTION_RANDOMLY_FLIP_X_DIRECTION; '- Randomly flip X direction [af8b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af8c].byte SPRITE_BEHAVIOR_CLEAR_READY_SET_BIT_7; [$af8c] SpriteBehavior [af8d].byte $00; [$af8d] byte [af8e]@_moveTowardPlayerLoop:; [$af8e] [af8e].byte SPRITE_OP_RUN_ACTION; Op: Run action [af8f].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af90].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af91].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [af92].byte $1e; |- For 30 ticks [af93].byte $00; |- 0 pixels X [af94].byte $02; '- 2 blocks X [af95].byte SPRITE_OP_GOTO; Op: Goto [af96]pointer @_moveTowardPlayerLoop; '- @_moveTowardPlayerLoop
;============================================================================ ; Sugata enemy behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad5d] ;
[af98]BSCRIPTS_ENEMY_SUGATA:; [$af98] [af98].byte SPRITE_OP_RUN_ACTION; Op: Run action [af99].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [af9a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [af9b].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [af9c].byte $1e; |- For 30 ticks [af9d].byte $00; |- 0 pixels per tick [af9e].byte $01; '- 1 block per tick [af9f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa0].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afa1].byte $1e; '- For 30 ticks [afa2].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa3].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [afa4].byte $28; |- For 40 ticks [afa5].byte $00; |- 0 pixels per tick [afa6].byte $01; '- 1 block per tick [afa7].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afa8].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afa9].byte $0a; '- For 10 ticks [afaa].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afab].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player (X) [afac].byte $14; |- For 20 ticks [afad].byte $80; |- 128 pixels per tick [afae].byte $00; '- 0 blocks per tick [afaf].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afb0].byte SPRITE_BEHAVIOR_FLASH_DAMAGE_PLAYER; |- Flash screen, damage player [afb1].byte $00; '- (unused) [afb2].byte SPRITE_OP_GOTO; Op: Goto [afb3]pointer 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] [afb5].byte SPRITE_OP_RUN_ACTION; Op: Run action [afb6].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afb7].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afb8].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afb9].byte $10; '- For 16 ticks [afba].byte SPRITE_OP_RUN_ACTION; Op: Run action [afbb].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afbc].byte SPRITE_OP_RUN_ACTION; Op: Run action [afbd].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afbe].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afbf].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afc0].byte $14; '- For 20 ticks [afc1].byte SPRITE_OP_RUN_ACTION; Op: Run action [afc2].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afc3].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afc4].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afc5].byte $0a; '- For 10 ticks [afc6].byte SPRITE_OP_RUN_ACTION; Op: Run action [afc7].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afc8].byte SPRITE_OP_RUN_ACTION; Op: Run action [afc9].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afca].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afcb].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afcc].byte $0e; '- For 14 ticks [afcd].byte SPRITE_OP_RUN_ACTION; Op: Run action [afce].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afcf].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afd0].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afd1].byte $10; '- For 16 ticks [afd2].byte SPRITE_OP_RUN_ACTION; Op: Run action [afd3].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afd4].byte SPRITE_OP_RUN_ACTION; Op: Run action [afd5].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [afd6].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afd7].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afd8].byte $12; '- For 18 ticks [afd9].byte SPRITE_OP_RUN_ACTION; Op: Run action [afda].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [afdb].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afdc].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [afdd].byte $00; '- For 0 ticks [afde].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [afdf].byte $01; |- Y direction [afe0].byte $10; |- If < 16 pixels [afe1]pointer @_nearPlayerY; |- Then @_nearPlayerY [afe3]pointer @_awayFromPlayerY; '- Else @_awayFromPlayerY [afe5]@_awayFromPlayerY:; [$afe5] [afe5].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [afe6].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [afe7].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [afe8].byte $28; |- For 40 ticks [afe9].byte $80; |- 128 pixels X [afea].byte $00; '- 0 blocks X [afeb]@_waitNearPlayerX:; [$afeb] [afeb].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [afec].byte $00; |- X direction [afed].byte $10; |- If < 16 pixels [afee]pointer @_nearPlayerX; |- Then @_nearPlayerX [aff0]pointer @_waitNearPlayerX; '- Else _waitNearPlayerX [aff2].byte SPRITE_OP_GOTO; Op: Goto [aff3]pointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [aff5]@_nearPlayerX:; [$aff5] [aff5].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [aff6].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [aff7].byte SPRITE_BEHAVIOR_HOP; |- Hop [aff8].byte $00; |- (unused) [aff9].byte $00; |- 0 pixels X [affa].byte $01; |- 1 block X [affb].byte $02; '- Hop mode 2 [affc].byte SPRITE_OP_GOTO; Op: Goto [affd]pointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [afff]@_nearPlayerY:; [$afff] [afff].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b000].byte SPRITE_OP_SET_PHASE; Op: Set phase [b001].byte $09; '- 9 [b002].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b003].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b004].byte $28; |- For 40 ticks [b005].byte $00; |- 0 pixels X [b006].byte $02; '- 2 pixels X [b007]@_waitNearPlayerX2:; [$b007] [b007].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b008].byte $00; |- X direction [b009].byte $10; |- If < 16 pixels [b00a]pointer @_nearPlayerX2; |- Then @_nearPlayerX2 [b00c]pointer @_waitNearPlayerX2; '- Else @_waitNearPlayerX2 [b00e].byte SPRITE_OP_GOTO; Op: Goto [b00f]pointer BSCRIPTS_ENEMY_GRIMLOCK; '- BSCRIPTS_ENEMY_GRIMLOCK [b011]@_nearPlayerX2:; [$b011] [b011].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b012].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b013].byte SPRITE_BEHAVIOR_HOP; |- Hop [b014].byte $00; |- (unused) [b015].byte $00; |- 0 pixels X [b016].byte $02; |- 2 blocks X [b017].byte $02; '- Hop mode 2 [b018].byte SPRITE_OP_GOTO; Op: Goto [b019]pointer 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] [b01b].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b01b] SpriteOp [b01c].byte SPRITE_BEHAVIOR_GIANT_BEES; [$b01c] SpriteBehavior [b01d].byte $00; [$b01d] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Myconid sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad63] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad63] ;
[b01f]BSCRIPTS_ENEMY_MYCONID:; [$b01f] [b01f].byte SPRITE_OP_RUN_ACTION; Op: Run action [b020].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b021].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b022].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b023].byte $3c; |- For 60 ticks [b024].byte $40; |- 64 pixels X [b025].byte $00; '- 0 blocks X [b026].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b027].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b028].byte $1e; '- For 30 ticks [b029].byte SPRITE_OP_RUN_ACTION; Op: Run action [b02a].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b02b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b02c].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b02d].byte $3c; |- For 60 ticks [b02e].byte $40; |- 64 pixels X [b02f].byte $00; '- 0 blocks X [b030].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b031].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b032].byte $1e; '- For 30 ticks [b033].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b034].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b035].byte $28; |- For 40 ticks [b036].byte $80; |- 128 pixels X [b037].byte $00; '- 0 blocks X [b038].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b039].byte SPRITE_BEHAVIOR_HOP; |- Hop [b03a].byte $00; |- (unused) [b03b].byte $80; |- 128 pixels X [b03c].byte $00; |- 0 blocks X [b03d].byte $02; '- Hop mode 2 [b03e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b03f].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b040].byte $1e; '- For 30 ticks [b041].byte SPRITE_OP_GOTO; Op: Goto [b042]pointer 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] [b044].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b044] SpriteOp [b045].byte SPRITE_BEHAVIOR_NAGA; [$b045] SpriteBehavior [b046].byte $00; [$b046] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Giant Strider sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad69] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad69] ;
[b048]BSCRIPTS_ENEMY_GIANT_STRIDER:; [$b048] [b048].byte SPRITE_OP_RUN_ACTION; Op: Run action [b049].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b04a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b04b].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b04c].byte $3c; |- For 60 ticks [b04d].byte $00; |- 0 pixels X [b04e].byte $01; '- 1 block X [b04f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b050].byte SPRITE_BEHAVIOR_HOP; |- Hop [b051].byte $00; |- (unused) [b052].byte $00; |- 0 pixels X [b053].byte $01; |- 1 block X [b054].byte $02; '- Hop mode 2 [b055].byte SPRITE_OP_GOTO; Op: Goto [b056]pointer 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] [b058].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b058] SpriteOp [b059].byte SPRITE_BEHAVIOR_YAREEKA; [$b059] SpriteBehavior [b05a].byte $00; [$b05a] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Magman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad73] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad73] ;
[b05c]BSCRIPTS_ENEMY_MAGMAN:; [$b05c] [b05c].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b05c] SpriteOp [b05d].byte SPRITE_BEHAVIOR_MAGMAN; [$b05d] SpriteBehavior [b05e].byte $00; [$b05e] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Unused 36 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad75] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad75] ;
[b060]BSCRIPTS_ENEMY_UNUSED_36:; [$b060] [b060].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b060] SpriteOp [b061].byte SPRITE_BEHAVIOR_ENEMY_UNUSED_36; [$b061] SpriteBehavior [b062].byte $00; [$b062] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Unused 39 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7b] ;
[b064]BSCRIPTS_ENEMY_UNUSED_39:; [$b064] [b064].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b064] SpriteOp [b065].byte SPRITE_BEHAVIOR_ENEMY_UNUSED_39; [$b065] SpriteBehavior [b066].byte $00; [$b066] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Lamprey sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad7d] ;
[b068]BSCRIPTS_ENEMY_LAMPREY:; [$b068] [b068].byte SPRITE_OP_RUN_ACTION; Op: Run action [b069].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b06a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b06b].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b06c].byte $3c; |- For 60 ticks [b06d].byte $50; |- 80 pixels X [b06e].byte $00; '- 0 blocks X [b06f].byte SPRITE_OP_GOTO; Op: Goto [b070]pointer 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] [b072].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b072] SpriteOp [b073].byte SPRITE_BEHAVIOR_ENEMY_UNUSED_43; [$b073] SpriteBehavior [b074].byte $00; [$b074] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Tamazutsu sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad85] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad85] ;
[b076]BSCRIPTS_ENEMY_TAMAZUTSU:; [$b076] [b076].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b076] SpriteOp [b077].byte SPRITE_BEHAVIOR_TAMAZUTSU; [$b077] SpriteBehavior [b078].byte $00; [$b078] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; 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] [b07a].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b07a] SpriteOp [b07b].byte SPRITE_BEHAVIOR_SIR_GAWAINE_WOLFMAN; [$b07b] SpriteBehavior [b07c].byte $00; [$b07c] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Maskman sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad6d] ;
[b07e]BSCRIPTS_ENEMY_MASKMAN:; [$b07e] [b07e].byte SPRITE_OP_RUN_ACTION; Op: Run action [b07f].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b080].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b081].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b082].byte $14; |- For 20 ticks [b083].byte $00; |- 0 pixels X [b084].byte $01; '- 1 block X [b085].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b086].byte SPRITE_BEHAVIOR_HOP; |- Hop [b087].byte $00; |- (unused) [b088].byte $00; |- 0 pixels X [b089].byte $01; |- 1 block X [b08a].byte $02; '- Hop mode 2 [b08b].byte SPRITE_OP_RUN_ACTION; Op: Run action [b08c].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b08d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b08e].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b08f].byte $14; |- For 20 ticks [b090].byte $00; |- 0 pixels X [b091].byte $01; '- 1 block X [b092].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b093].byte SPRITE_BEHAVIOR_HOP; |- Hop [b094].byte $00; |- (unused) [b095].byte $00; |- 0 pixels X [b096].byte $01; |- 1 block X [b097].byte $02; '- Hop mode 2 [b098].byte SPRITE_OP_RUN_ACTION; Op: Run action [b099].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b09a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b09b].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Walk toward player [b09c].byte $14; |- For 20 ticks [b09d].byte $00; |- 0 pixels X [b09e].byte $01; '- 1 block X [b09f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0a0].byte SPRITE_BEHAVIOR_HOP; |- Hop [b0a1].byte $00; |- (unused) [b0a2].byte $00; |- 0 pixels X [b0a3].byte $01; |- 1 block X [b0a4].byte $01; '- Hop mode 1 [b0a5].byte SPRITE_OP_GOTO; Op: Goto [b0a6]pointer 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] [b0a8].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0a9].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b0aa].byte $00; '- For 0 ticks [b0ab].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] [b0ac].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0ad].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ae].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0af].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0b0].byte $14; |- For 20 ticks [b0b1].byte $00; |- 0 pixels X [b0b2].byte $01; '- 1 block X [b0b3].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0b4].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0b5].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0b6].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b0b7].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0b8].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0b9].byte $14; |- For 20 ticks [b0ba].byte $80; |- 128 pixels X [b0bb].byte $00; '- 0 blocks X [b0bc].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0bd].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0be].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0bf].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b0c0].byte $08; |- For 8 ticks [b0c1].byte $00; |- 0 pixels X [b0c2].byte $01; '- 1 block X [b0c3].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance [b0c4].byte $00; |- Check X [b0c5].byte $10; |- If < 16 pixels [b0c6]pointer @_hop; |- Then hop [b0c8]pointer @_loop; '- Else loop [b0ca]@_hop:; [$b0ca] [b0ca].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b0ca] SpriteOp [b0cb].byte SPRITE_BEHAVIOR_HOP; Op: Hop [b0cc].byte $00; |- (unused) [b0cd].byte $00; |- 0 pixels X [b0ce].byte $00; |- 0 blocks X [b0cf].byte $02; '- Hop mode 2 [b0d0]@_loop:; [$b0d0] [b0d0].byte SPRITE_OP_GOTO; Op: Goto [b0d1]pointer 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] [b0d3].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b0d3] SpriteOp [b0d4].byte SPRITE_BEHAVIOR_ENEMY_UNUSED_18; [$b0d4] SpriteBehavior [b0d5].byte $00; [$b0d5] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Ripasheiku sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad87] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad87] ;
[b0d7]BSCRIPTS_BOSS_RIPASHEIKU:; [$b0d7] [b0d7].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0d8].byte SPRITE_BEHAVIOR_RIPASHEIKU; |- Ripasheiku boss [b0d9].byte $00; '- (unused) [b0da].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] [b0db].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0dc].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0dd].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0de].byte SPRITE_BEHAVIOR_WAIT; |- Wait [b0df].byte $3c; '- For 60 ticks [b0e0].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0e1].byte SPRITE_BEHAVIOR_HOP; |- Hop [b0e2].byte $00; |- (unused [b0e3].byte $00; |- 0 pixels X [b0e4].byte $00; |- 0 blocks X [b0e5].byte $02; '- Hop mode 2 [b0e6].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0e7].byte SPRITE_ACTION_FLY_UP; '- Rise up [b0e8].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0e9].byte SPRITE_BEHAVIOR_MOVE_VERT; |- Move vertically [b0ea].byte $08; |- For 8 ticks [b0eb].byte $00; |- 0 pixels Y [b0ec].byte $02; '- 2 blocks Y [b0ed]@_mainLoop:; [$b0ed] [b0ed].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0ee].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ef].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b0f0].byte SPRITE_BEHAVIOR_SOMETHING_ZORADOHNA_18; |- TODO [b0f1].byte $00; |- For 0 ticks [b0f2].byte $00; |- 0 pixels X [b0f3].byte $01; |- 1 block X [b0f4].byte $02; '- TODO: Value 2 [b0f5]@_waitNearPlayer:; [$b0f5] [b0f5].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b0f6].byte $00; |- X direction [b0f7].byte $20; |- If < 32 pixels [b0f8]pointer @_isNearPlayer; |- Then @_isNearPlayer [b0fa]pointer @_waitNearPlayer; '- Else @_waitNearPlayer [b0fc]@_isNearPlayer:; [$b0fc] [b0fc].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b0fd].byte SPRITE_OP_RUN_ACTION; Op: Run action [b0fe].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b0ff].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b100].byte SPRITE_BEHAVIOR_HOP; |- Hop [b101].byte $00; |- (unused) [b102].byte $00; |- 0 pixels X [b103].byte $02; |- 2 blocks X [b104].byte $01; '- Hop mode 1 [b105].byte SPRITE_OP_GOTO; Op: Goto [b106]pointer @_mainLoop; '- @_mainLoop
;============================================================================ ; Borabohra sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8b] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8b] ;
[b108]BSCRIPTS_BOSS_BORABOHRA:; [$b108] [b108].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b108] SpriteOp [b109].byte SPRITE_BEHAVIOR_BORABOHRA; [$b109] SpriteBehavior [b10a].byte $00; [$b10a] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Pakukame sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8d] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8d] ;
[b10c]BSCRIPTS_BOSS_PAKUKAME:; [$b10c] [b10c].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b10c] SpriteOp [b10d].byte SPRITE_BEHAVIOR_PAKUKAME; [$b10d] SpriteBehavior [b10e].byte $00; [$b10e] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Zorugeriru sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8f] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad8f] ;
[b110]BSCRIPTS_BOSS_ZORUGERIRU:; [$b110] [b110].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b110] SpriteOp [b111].byte SPRITE_BEHAVIOR_ZORUGERIRU; [$b111] SpriteBehavior [b112].byte $00; [$b112] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; King Grieve sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad91] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad91] ;
[b114]BSCRIPTS_BOSS_KING_GRIEVE:; [$b114] [b114].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b114] SpriteOp [b115].byte SPRITE_BEHAVIOR_KING_GRIEVE; [$b115] SpriteBehavior [b116].byte $00; [$b116] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Shadow Eura sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad93] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad93] ;
[b118]BSCRIPTS_BOSS_SHADOW_EURA:; [$b118] [b118].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b118] SpriteOp [b119].byte SPRITE_BEHAVIOR_SHADOW_EURA; [$b119] SpriteBehavior [b11a].byte $00; [$b11a] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; 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] [b11c].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b11c] SpriteOp [b11d].byte SPRITE_BEHAVIOR_SOMETHING_GARBLED_81; [$b11d] SpriteBehavior [b11e].byte $00; [$b11e] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Unused garbled 10 sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad41] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad41] ;
[b120]BSCRIPTS_GARBLED_10:; [$b120] [b120].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b120] SpriteOp [b121].byte SPRITE_BEHAVIOR_SOMETHING_GARBLED_10; [$b121] SpriteBehavior [b122].byte $00; [$b122] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Walking Man NPC sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad95] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ad95] ;
[b124]BSCRIPTS_NPC_WALKING_MAN:; [$b124] [b124].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b125].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b126].byte $3c; |- For 60 ticks [b127].byte $c0; |- 192 pixels X [b128].byte $00; '- 0 blocks X [b129].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b12a].byte SPRITE_BEHAVIOR_FALL; |- Stand still [b12b].byte $1e; '- For 30 ticks [b12c].byte SPRITE_OP_RUN_ACTION; Op: Run action [b12d].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b12e].byte SPRITE_OP_GOTO; Op: Goto [b12f]pointer 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] [b131].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b132].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b133].byte $50; |- For 80 ticks [b134].byte $80; |- 128 pixels X [b135].byte $00; '- 0 blocks X [b136].byte SPRITE_OP_RUN_ACTION; Op: Run action [b137].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b138].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b139].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b13a].byte $14; |- For 20 ticks [b13b].byte $80; |- 128 pixels X [b13c].byte $00; '- 0 blocks X [b13d].byte SPRITE_OP_RUN_ACTION; Op: Run action [b13e].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b13f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b140].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b141].byte $50; |- For 80 ticks [b142].byte $80; |- 128 pixels X [b143].byte $00; '- 0 blocks X [b144].byte SPRITE_OP_RUN_ACTION; Op: Run action [b145].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b146].byte SPRITE_OP_GOTO; Op: Goto [b147]pointer 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] [b149].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b14a].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b14b].byte $3c; |- For 60 ticks [b14c].byte $c0; |- 192 pixels X [b14d].byte $00; '- 0 blocks X [b14e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b14f].byte SPRITE_BEHAVIOR_HOP; |- Hop [b150].byte $00; |- (unused) [b151].byte $00; |- 0 pixels X [b152].byte $01; |- 1 block X [b153].byte $03; '- Hop mode 3 [b154].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b155].byte SPRITE_BEHAVIOR_HOP; |- Hop [b156].byte $00; |- (unused) [b157].byte $00; |- 0 pixels X [b158].byte $01; |- 1 block X [b159].byte $03; '- Hop mode 3 [b15a].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b15b].byte SPRITE_BEHAVIOR_WALK_FORWARD; |- Walk forward [b15c].byte $0a; |- For 10 ticks [b15d].byte $c0; |- 192 pixels X [b15e].byte $00; '- 0 blocks X [b15f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b160].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b161].byte $05; '- For 5 ticks [b162].byte SPRITE_OP_RUN_ACTION; Op: Run action [b163].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b164].byte SPRITE_OP_GOTO; Op: Goto [b165]pointer 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] [b167].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b168].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b169].byte $00; '- 0 ticks [b16a].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] [b16b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b16c].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b16d].byte $01; '- 1 tick [b16e].byte SPRITE_OP_RUN_ACTION; Op: Run action [b16f].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b170].byte SPRITE_OP_GOTO; Op: Goto [b171]pointer 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] [b173].byte SPRITE_OP_RUN_ACTION; Op: Run action [b174].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b175].byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Set sprite data [b176]pointer CurrentSprites_XPos_Full; |- X position [b178].byte $04; '- to 4 [b179].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b17a].byte SPRITE_BEHAVIOR_FALL; |- Stand still [b17b].byte $00; '- For 0 ticks [b17c].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] [b17d].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b17e].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b17f].byte $00; '- For 0 ticks
; ; Wait until the King and the player are within 64 pixels ; of each other. ;
[b180]@_waitNearPlayerLoop:; [$b180] [b180].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b181].byte $00; |- For 0 ticks [b182].byte $40; |- If < 64 pixels [b183]pointer @_nearPlayer; |- Then @_nearPlayer [b185]pointer @_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] [b187].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b188].byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add value to [b189]pointer CurrentSprites_XPos_Full; |- Sprite X position [b18b].byte $08; '- Plus 8 [b18c].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b18d].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b18e].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] [b18f].byte SPRITE_OP_CHECK_DISTANCE; Op: Check distance to player [b190].byte $00; |- For 0 ticks [b191].byte $48; |- If < 72 pixels [b192]pointer @_waitAwayFromPlayerLoop; |- Then @_waitAwayFromPlayerLoop [b194]pointer @_awayFromPlayer; '- Else @_awayFromPlayer
; ; The player is now far enough away from the King. ; The King can sit down. ;
[b196]@_awayFromPlayer:; [$b196] [b196].byte SPRITE_OP_FINISH_BEHAVIOR; Op: Finish behavior [b197].byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add value to [b198]pointer CurrentSprites_XPos_Full; |- Sprite X position [b19a].byte $f8; '- Minus 8 [b19b].byte SPRITE_OP_GOTO; Op: Goto [b19c]pointer 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] [b19e].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b19f].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1a0].byte $01; '- For 1 tick [b1a1].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1a2].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1a3].byte SPRITE_OP_MAYBE_DISABLE_AND_GOTO; Op: Maybe: Disable and Go To [b1a4]pointer 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] [b1a6].byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add to sprite value [b1a7]pointer CurrentSprites_XPos_Full; |- Sprite X position [b1a9].byte $08; '- Add 8 [b1aa].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1ab].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1ac].byte $00; '- For 0 ticks [b1ad].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] [b1ae].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1af].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1b0].byte $00; '- For 0 ticks [b1b1].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] [b1b2].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1b3].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1b4].byte $05; '- For 5 ticks [b1b5].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1b6].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1b7].byte SPRITE_OP_GOTO; Op: Goto [b1b8]pointer 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] [b1ba].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1bb].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1bc].byte $05; '- For 5 ticks [b1bd].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1be].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1bf].byte SPRITE_OP_GOTO; Op: Goto [b1c0]pointer 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] [b1c2].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1c3].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1c4].byte $00; '- For 0 ticks [b1c5].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] [b1c6].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1c7].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1c8].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1c9].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1ca].byte $00; '- For 0 ticks [b1cb].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] [b1cc].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1cd].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1ce].byte $c0; |- For 192 ticks [b1cf].byte $80; |- 128 pixels X [b1d0].byte $00; '- 0 blocks X [b1d1].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1d2].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1d3].byte $05; '- For 5 ticks [b1d4].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1d5].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1d6].byte $28; |- For 40 ticks [b1d7].byte $80; |- 128 pixels X [b1d8].byte $00; '- 0 blocks X [b1d9].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1da].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1db].byte SPRITE_OP_GOTO; Op: Goto [b1dc]pointer 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] [b1de].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1df].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1e0].byte $50; |- For 80 ticks [b1e1].byte $c0; |- 192 pixels X [b1e2].byte $00; '- 0 blocks X [b1e3].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1e4].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1e5].byte $05; '- For 5 ticks [b1e6].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1e7].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1e8].byte SPRITE_OP_GOTO; Op: Goto [b1e9]pointer 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] [b1eb].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1ec].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1ed].byte $50; |- For 80 ticks [b1ee].byte $c0; |- 192 pixels X [b1ef].byte $00; '- 0 blocks X [b1f0].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1f1].byte SPRITE_BEHAVIOR_FALL; |- Fall/wait [b1f2].byte $0a; '- For 10 ticks [b1f3].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1f4].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b1f5].byte SPRITE_OP_RUN_ACTION; Op: Run action [b1f6].byte SPRITE_ACTION_FACE_PLAYER_X; '- Face player (X) [b1f7].byte SPRITE_OP_GOTO; Op: Goto [b1f8]pointer 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] [b1fa].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b1fb].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b1fc].byte $3c; |- For 60 ticks [b1fd].byte $80; |- 128 pixels X [b1fe].byte $00; '- 0 blocks X [b1ff].byte SPRITE_OP_RUN_ACTION; Op: Run action [b200].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b201].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b202].byte SPRITE_BEHAVIOR_MOVE_TOWARD_PLAYER; |- Move toward player [b203].byte $50; |- For 80 ticks [b204].byte $80; |- 128 pixels X [b205].byte $00; '- 0 blocks X [b206].byte SPRITE_OP_RUN_ACTION; Op: Run action [b207].byte SPRITE_ACTION_FLIP_X_DIRECTION; '- Flip X direction [b208].byte SPRITE_OP_GOTO; Op: Goto [b209]pointer 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] [b20b].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b20b] SpriteOp [b20c].byte SPRITE_BEHAVIOR_ITEM_OINTMENT; [$b20c] SpriteBehavior [b20d].byte $00; [$b20d] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Glove item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbd] ;
[b20f]BSCRIPTS_OBJ_GLOVE:; [$b20f] [b20f].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b20f] SpriteOp [b210].byte SPRITE_BEHAVIOR_ITEM_GLOVE; [$b210] SpriteBehavior [b211].byte $00; [$b211] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Wingboots item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add7] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add7] ;
[b213]BSCRIPTS_OBJ_WINGBOOTS:; [$b213] [b213].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b213] SpriteOp [b214].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_55; [$b214] SpriteBehavior [b215].byte $00; [$b215] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; 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] [b217].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b217] SpriteOp [b218].byte SPRITE_BEHAVIOR_FALL; [$b218] SpriteBehavior [b219].byte $00; [$b219] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Mattock item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adcd] ;
[b21b]BSCRIPTS_OBJ_MATTOCK:; [$b21b] [b21b].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b21b] SpriteOp [b21c].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_50; [$b21c] SpriteBehavior [b21d].byte $00; [$b21d] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Hour Glass item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add9] ;
[b21f]BSCRIPTS_OBJ_HOURGLASS:; [$b21f] [b21f].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b21f] SpriteOp [b220].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_51; [$b220] SpriteBehavior [b221].byte $00; [$b221] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Fountain sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::add1] ;
[b223]BSCRIPTS_FOUNTAIN:; [$b223] [b223].byte SPRITE_OP_ADD_TO_SPRITE_DATA; Op: Add to sprite value [b224]pointer CurrentSprites_XPos_Full; |- Sprite X position [b226].byte $08; '- Plus 8 [b227].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b228].byte SPRITE_BEHAVIOR_FOUNTAIN; [$b228] SpriteBehavior [b229].byte $00; [$b229] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Spring of Trunk sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adef] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adef] ;
[b22b]BSCRIPTS_SPRING_OF_FORTRESS:; [$b22b] [b22b].byte SPRITE_OP_ADD_TO_SPRITE_DATA; [$b22b] SpriteOp [b22c]pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [$PRG14::b22c] [b22e].byte $08; [$b22e] byte .byte SPRITE_OP_SWITCH_BEHAVIOR [b230].byte SPRITE_BEHAVIOR_SPRING_OF_FORTRESS; [$b230] SpriteBehavior [b231].byte $00; [$b231] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Spring of Sky sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf1] ;
[b233]BSCRIPTS_SPRING_OF_SKY:; [$b233] [b233].byte SPRITE_OP_ADD_TO_SPRITE_DATA; [$b233] SpriteOp [b234]pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [$PRG14::b234] [b236].byte $08; [$b236] byte .byte SPRITE_OP_SWITCH_BEHAVIOR [b238].byte SPRITE_BEHAVIOR_SPRING_OF_SKY; [$b238] SpriteBehavior [b239].byte $00; [$b239] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Spring of Joker sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf3] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adf3] ;
[b23b]BSCRIPTS_SPRING_OF_JOKER:; [$b23b] [b23b].byte SPRITE_OP_ADD_TO_SPRITE_DATA; [$b23b] SpriteOp [b23c]pointer CurrentSprites_XPos_Full; CurrentSprites_XPos_Full [$PRG14::b23c] [b23e].byte $08; [$b23e] byte .byte SPRITE_OP_SWITCH_BEHAVIOR [b240].byte SPRITE_BEHAVIOR_SPRING_OF_JOKER; [$b240] SpriteBehavior [b241].byte $00; [$b241] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Battle Suit item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addd] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addd] ;
[b243]BSCRIPTS_OBJ_BATTLE_SUIT:; [$b243] [b243].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b243] SpriteOp [b244].byte SPRITE_BEHAVIOR_BATTLE_SUIT_DROPPED_BY_ZORADOHNA; [$b244] SpriteBehavior [b245].byte $00; [$b245] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Battle Helmet item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addf] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addf] ;
[b247]BSCRIPTS_OBJ_BATTLE_HELMET:; [$b247] [b247].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b247] SpriteOp [b248].byte SPRITE_BEHAVIOR_BATTLE_HELMET_DROPPED_BY_ZORADOHNA; [$b248] SpriteBehavior [b249].byte $00; [$b249] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Dragon Slayer item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade1] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade1] ;
[b24b]BSCRIPTS_OBJ_DRAGON_SLAYER:; [$b24b] [b24b].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b24b] SpriteOp [b24c].byte SPRITE_BEHAVIOR_DRAGON_SLAYER_DROPPED_BY_KING_GRIEVE; [$b24c] SpriteBehavior [b24d].byte $00; [$b24d] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Magical Rod item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::addb] ;
[b24f]BSCRIPTS_OBJ_MAGICAL_ROD:; [$b24f] [b24f].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b24f] SpriteOp [b250].byte SPRITE_BEHAVIOR_SHOW_MAGICAL_ROD; [$b250] SpriteBehavior [b251].byte $00; [$b251] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Black Onyx dropped by Zoradohna sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbf] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adbf] ;
[b253]BSCRIPTS_OBJ_BLACK_ONYX:; [$b253] [b253].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b254].byte SPRITE_BEHAVIOR_BLACK_ONYX_DROPPED_FROM_ZORADOHNA; |- Black Onyx drops from Zoradohna [b255].byte $00; '- (unused) [b256].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] [b257].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b258].byte SPRITE_BEHAVIOR_PENDANT_DROPPED_FROM_RIPASHEIKU; |- Pendant drops from Ripasheiku [b259].byte $00; '- (unused) [b25a].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] [b25b].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b25c].byte SPRITE_BEHAVIOR_MATTOCK_DROPPED_BY_RPIASHEIKU; |- Mattock drops from Ripasheiku [b25d].byte $00; '- (unused) [b25e].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] [b25f].byte SPRITE_OP_SWITCH_BEHAVIOR; Op: Switch behavior [b260].byte SPRITE_BEHAVIOR_WING_BOOTS_DROPPED_BY_ZORUGERIRU; |- Wing Boots drops by Zorugeriru [b261].byte $00; '- (unused) [b262].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] [b263].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b263] SpriteOp [b264].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_52; [$b264] SpriteBehavior [b265].byte $00; [$b265] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Poison item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade9] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::ade9] ;
[b267]BSCRIPTS_OBJ_POISON:; [$b267] [b267].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b267] SpriteOp [b268].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_53; [$b268] SpriteBehavior [b269].byte $00; [$b269] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Glove 2 item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adeb] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::adeb] ;
[b26b]BSCRIPTS_OBJ_GLOVE_RANDOM:; [$b26b] [b26b].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b26b] SpriteOp [b26c].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_54; [$b26c] SpriteBehavior [b26d].byte $00; [$b26d] byte .byte SPRITE_OP_END_SCRIPT
;============================================================================ ; Ointment 2 item sprite behavior script. ; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::aded] ;============================================================================
; ; XREFS: ; SPRITE_BSCRIPTS [$PRG14::aded] ;
[b26f]BSCRIPTS_OBJ_OINTMENT_RANDOM:; [$b26f] [b26f].byte SPRITE_OP_SWITCH_BEHAVIOR; [$b26f] SpriteOp [b270].byte SPRITE_BEHAVIOR_RANDOMLY_SHOW_ITEM_56; [$b270] SpriteBehavior [b271].byte $00,$ff; [$b271] byte [b274].byte $00,$00,$10,$20,$00,$08,$10,$08; [$b274] undefined [b27b].byte $04,$08,$08,$08,$00,$00,$10,$10; [$b27b] undefined [b283].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b283] undefined [b28b].byte $00,$00,$10,$20,$00,$00,$10,$10; [$b28b] undefined [b293].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b293] undefined [b29b].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b29b] undefined [b2a3].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2a3] undefined [b2ab].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2ab] undefined [b2b3].byte $00,$00,$10,$20,$04,$00,$18,$30; [$b2b3] undefined [b2bb].byte $00,$00,$10,$20,$00,$00,$00,$00; [$b2bb] undefined [b2c3].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2c3] undefined [b2cb].byte $00,$00,$10,$10,$00,$00,$10,$20; [$b2cb] undefined [b2d3].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2d3] undefined [b2db].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2db] undefined [b2e3].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2e3] undefined [b2eb].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2eb] undefined [b2f3].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2f3] undefined [b2fb].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b2fb] undefined [b303].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b303] undefined [b30b].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b30b] undefined [b313].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b313] undefined [b31b].byte $00,$00,$10,$20,$00,$00,$10,$20; [$b31b] undefined [b323].byte $00,$00,$10,$20,$00,$00,$20,$40; [$b323] undefined [b32b].byte $00,$00,$20,$30,$04,$00,$18,$30; [$b32b] undefined [b333].byte $00,$00,$20,$20,$00,$00,$10,$20; [$b333] undefined [b33b].byte $00,$00,$40,$18,$08,$00,$28,$50; [$b33b] undefined [b343].byte $f8,$00,$20,$20,$f8,$00,$20,$20; [$b343] undefined [b34b].byte $f8,$00,$20,$20,$00,$00,$28,$30; [$b34b] undefined [b353].byte $f0,$00,$30,$20,$00,$00,$30,$20; [$b353] undefined [b35b].byte $00,$00,$30,$20,$f0,$00,$30,$20; [$b35b] undefined [b363].byte $00,$00,$20,$20,$f8,$00,$20,$20; [$b363] undefined [b36b].byte $00,$00,$20,$30,$f8,$00,$20,$20; [$b36b] undefined [b373].byte $f8,$00,$20,$20,$f8,$00,$20,$20; [$b373] undefined [b37b].byte $f8,$00,$20,$20,$f8,$00,$20,$20; [$b37b] undefined [b383].byte $f8,$00,$20,$20,$f8,$00,$20,$20; [$b383] undefined [b38b].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b38b] undefined [b393].byte $00,$00,$08,$10,$00,$00,$08,$10; [$b393] undefined [b39b].byte $00,$00,$08,$10,$00,$00,$08,$10; [$b39b] undefined [b3a3].byte $00,$00,$08,$10,$00,$00,$10,$10; [$b3a3] undefined [b3ab].byte $00,$00,$10,$10,$00,$00,$10,$c0; [$b3ab] undefined [b3b3].byte $00,$00,$10,$10,$04,$04,$08,$08; [$b3b3] undefined [b3bb].byte $00,$00,$20,$20,$00,$00,$10,$10; [$b3bb] undefined [b3c3].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3c3] undefined [b3cb].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3cb] undefined [b3d3].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3d3] undefined [b3db].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3db] undefined [b3e3].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3e3] undefined [b3eb].byte $00,$00,$10,$10,$00,$00,$10,$10; [$b3eb] undefined [b3f3].byte $00,$00,$10,$10,$00,$00,$20,$20; [$b3f3] undefined [b3fb].byte $00,$00,$20,$20,$00,$00,$20,$20; [$b3fb] undefined [b403].byte $00,$00,$20,$20; [$b403] undefined
; ; XREFS: ; Sprites_IsSpriteOutOfWeaponRange ;
[b407]MAYBE_SPRITE_EXTENTS:; [$b407] [b407]SPRITE_ENTITY_WEAPON_RANGES: [b407].byte $10; [0]:
; ; XREFS: ; Sprites_IsSpriteOutOfWeaponRange ;
[b408]MAYBE_SPRITE_EXTENTS_1_:; [$b408] [b408].byte $20; [1]: [b409].byte $10; [2]: [b40a].byte $08; [3]: [b40b].byte $08; [4]: [b40c].byte $08; [5]: [b40d].byte $10; [6]: [b40e].byte $10; [7]: [b40f].byte $10; [8]: [b410].byte $20; [9]: [b411].byte $10; [10]: [b412].byte $20; [11]: [b413].byte $10; [12]: [b414].byte $20; [13]: [b415].byte $10; [14]: [b416].byte $10; [15]: [b417].byte $10; [16]: [b418].byte $10; [17]: [b419].byte $10; [18]: [b41a].byte $10; [19]: [b41b].byte $10; [20]: [b41c].byte $10; [21]: [b41d].byte $10; [22]: [b41e].byte $10; [23]: [b41f].byte $10; [24]: [b420].byte $20; [25]: [b421].byte $10; [26]: [b422].byte $20; [27]: [b423].byte $10; [28]: [b424].byte $10; [29]: [b425].byte $10; [30]: [b426].byte $20; [31]: [b427].byte $10; [32]: [b428].byte $20; [33]: [b429].byte $20; [34]: [b42a].byte $10; [35]: [b42b].byte $10; [36]: [b42c].byte $20; [37]: [b42d].byte $00; [38]: [b42e].byte $00; [39]: [b42f].byte $10; [40]: [b430].byte $20; [41]: [b431].byte $10; [42]: [b432].byte $20; [43]: [b433].byte $10; [44]: [b434].byte $10; [45]: [b435].byte $10; [46]: [b436].byte $20; [47]: [b437].byte $10; [48]: [b438].byte $20; [49]: [b439].byte $10; [50]: [b43a].byte $20; [51]: [b43b].byte $10; [52]: [b43c].byte $20; [53]: [b43d].byte $10; [54]: [b43e].byte $20; [55]: [b43f].byte $10; [56]: [b440].byte $20; [57]: [b441].byte $10; [58]: [b442].byte $20; [59]: [b443].byte $10; [60]: [b444].byte $20; [61]: [b445].byte $10; [62]: [b446].byte $20; [63]: [b447].byte $10; [64]: [b448].byte $20; [65]: [b449].byte $10; [66]: [b44a].byte $20; [67]: [b44b].byte $10; [68]: [b44c].byte $20; [69]: [b44d].byte $10; [70]: [b44e].byte $20; [71]: [b44f].byte $10; [72]: [b450].byte $20; [73]: [b451].byte $10; [74]: [b452].byte $20; [75]: [b453].byte $10; [76]: [b454].byte $20; [77]: [b455].byte $10; [78]: [b456].byte $20; [79]: [b457].byte $10; [80]: [b458].byte $20; [81]: [b459].byte $10; [82]: [b45a].byte $20; [83]: [b45b].byte $10; [84]: [b45c].byte $20; [85]: [b45d].byte $10; [86]: [b45e].byte $20; [87]: [b45f].byte $10; [88]: [b460].byte $20; [89]: [b461].byte $20; [90]: [b462].byte $20; [91]: [b463].byte $20; [92]: [b464].byte $18; [93]: [b465].byte $20; [94]: [b466].byte $10; [95]: [b467].byte $20; [96]: [b468].byte $18; [97]: [b469].byte $10; [98]: [b46a].byte $20; [99]: [b46b].byte $40; [100]: [b46c].byte $10; [101]: [b46d].byte $30; [102]: [b46e].byte $20; [103]: [b46f].byte $10; [104]: [b470].byte $20; [105]: [b471].byte $10; [106]: [b472].byte $20; [107]: [b473].byte $10; [108]: [b474].byte $20; [109]: [b475].byte $28; [110]: [b476].byte $30; [111]: [b477].byte $20; [112]: [b478].byte $20; [113]: [b479].byte $30; [114]: [b47a].byte $20; [115]: [b47b].byte $30; [116]: [b47c].byte $20; [117]: [b47d].byte $20; [118]: [b47e].byte $20; [119]: [b47f].byte $10; [120]: [b480].byte $20; [121]: [b481].byte $10; [122]: [b482].byte $20; [123]: [b483].byte $10; [124]: [b484].byte $20; [125]: [b485].byte $10; [126]: [b486].byte $20; [127]: [b487].byte $10; [128]: [b488].byte $20; [129]: [b489].byte $10; [130]: [b48a].byte $20; [131]: [b48b].byte $10; [132]: [b48c].byte $20; [133]: [b48d].byte $10; [134]: [b48e].byte $20; [135]: [b48f].byte $10; [136]: [b490].byte $20; [137]: [b491].byte $10; [138]: [b492].byte $20; [139]: [b493].byte $10; [140]: [b494].byte $10; [141]: [b495].byte $10; [142]: [b496].byte $10; [143]: [b497].byte $08; [144]: [b498].byte $10; [145]: [b499].byte $08; [146]: [b49a].byte $10; [147]: [b49b].byte $08; [148]: [b49c].byte $10; [149]: [b49d].byte $08; [150]: [b49e].byte $10; [151]: [b49f].byte $08; [152]: [b4a0].byte $10; [153]: [b4a1].byte $10; [154]: [b4a2].byte $10; [155]: [b4a3].byte $10; [156]: [b4a4].byte $10; [157]: [b4a5].byte $10; [158]: [b4a6].byte $c0; [159]: [b4a7].byte $10; [160]: [b4a8].byte $10; [161]: [b4a9].byte $08; [162]: [b4aa].byte $08; [163]: [b4ab].byte $20; [164]: [b4ac].byte $20; [165]: [b4ad].byte $10; [166]: [b4ae].byte $10; [167]: [b4af].byte $10; [168]: [b4b0].byte $10; [169]: [b4b1].byte $10; [170]: [b4b2].byte $10; [171]: [b4b3].byte $10; [172]: [b4b4].byte $10; [173]: [b4b5].byte $10; [174]: [b4b6].byte $10; [175]: [b4b7].byte $10; [176]: [b4b8].byte $10; [177]: [b4b9].byte $10; [178]: [b4ba].byte $10; [179]: [b4bb].byte $10; [180]: [b4bc].byte $10; [181]: [b4bd].byte $10; [182]: [b4be].byte $10; [183]: [b4bf].byte $10; [184]: [b4c0].byte $10; [185]: [b4c1].byte $10; [186]: [b4c2].byte $10; [187]: [b4c3].byte $10; [188]: [b4c4].byte $10; [189]: [b4c5].byte $10; [190]: [b4c6].byte $10; [191]: [b4c7].byte $10; [192]: [b4c8].byte $10; [193]: [b4c9].byte $10; [194]: [b4ca].byte $10; [195]: [b4cb].byte $10; [196]: [b4cc].byte $10; [197]: [b4cd].byte $10; [198]: [b4ce].byte $10; [199]: [b4cf].byte $10; [200]: [b4d0].byte $10; [201]:
; ; XREFS: ; CurrentSprite_CanMoveInDirection ; Sprite_CalcDistanceXToPlayer ; Sprite_CheckHitByCastMagic ; Sprites_MoveRight ;
[b4d1]SPRITE_HITBOX_WIDTHS:; [$b4d1] [b4d1].byte $0f; [0]: [b4d2].byte $0f; [1]: [b4d3].byte $1f; [2]: [b4d4].byte $1f; [3]: [b4d5].byte $1f; [4]: [b4d6].byte $3f; [5]: [b4d7].byte $2f; [6]:
; ; XREFS: ; CurrentSprite_CanMoveInDirection ; DEADCODE_Sprites_CanMoveDownBelowHitbox ; Sprite_CheckHitByCastMagic ; Sprites_CanMoveDownByHitbox ; Sprites_MoveRight__86c6 ;
[b4d8]SPRITE_HITBOX_HEIGHTS:; [$b4d8] [b4d8].byte $0f; [0]: [b4d9].byte $1f; [1]: [b4da].byte $2f; [2]: [b4db].byte $3f; [3]: [b4dc].byte $1f; [4]: [b4dd].byte $1f; [5]: [b4de].byte $4f; [6]:
;============================================================================ ; A mapping of sprite entity IDs to hitbox types. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[b4df]SPRITE_ENTITIES_HITBOX_TYPES:; [$b4df] [b4df].byte SPRITE_HITBOX_1; [0]: [b4e0].byte SPRITE_HITBOX_1; [1]: Dropped: Bread
; ; XREFS: ; Sprite_ReplaceWithDroppedItem ;
[b4e1]SPRITE_ENTITIES_HITBOX_TYPES_2_:; [$b4e1] [b4e1].byte SPRITE_HITBOX_0; [2]: Dropped: Coin [b4e2].byte SPRITE_HITBOX_1; [3]: Enemy: ? [b4e3].byte SPRITE_HITBOX_1; [4]: Enemy: Raiden [b4e4].byte SPRITE_HITBOX_1; [5]: Enemy: Necron Aides [b4e5].byte SPRITE_HITBOX_1; [6]: Enemy: Zombie [b4e6].byte SPRITE_HITBOX_0; [7]: Enemy: Hornet [b4e7].byte SPRITE_HITBOX_0; [8]: Enemy: Bihoruda [b4e8].byte SPRITE_HITBOX_0; [9]: Enemy: Lilith [b4e9].byte SPRITE_HITBOX_0; [10]: Magic: ? [b4ea].byte SPRITE_HITBOX_0; [11]: Enemy: Yuinaru [b4eb].byte SPRITE_HITBOX_1; [12]: Enemy: Snowman [b4ec].byte SPRITE_HITBOX_1; [13]: Enemy: Nash [b4ed].byte SPRITE_HITBOX_1; [14]: Enemy: Fire Giant [b4ee].byte SPRITE_HITBOX_1; [15]: Enemy: Ishiisu [b4ef].byte SPRITE_HITBOX_1; [16]: Enemy: Execution Hood [b4f0].byte SPRITE_HITBOX_2; [17]: Boss: Rokusutahn [b4f1].byte SPRITE_HITBOX_1; [18]: Boss: unused (round body of snake boss) [b4f2].byte SPRITE_HITBOX_1; [19]: Effect: Enemy death [b4f3].byte SPRITE_HITBOX_1; [20]: Effect: Lightning ball [b4f4].byte SPRITE_HITBOX_1; [21]: Enemy: Charron [b4f5].byte SPRITE_HITBOX_1; [22]: Enemy: ? (Unused) [b4f6].byte SPRITE_HITBOX_1; [23]: Enemy: Geributa [b4f7].byte SPRITE_HITBOX_1; [24]: Enemy: Sugata [b4f8].byte SPRITE_HITBOX_1; [25]: Enemy: Grimlock [b4f9].byte SPRITE_HITBOX_1; [26]: Enemy: Giant Bees [b4fa].byte SPRITE_HITBOX_1; [27]: Enemy: Myconid [b4fb].byte SPRITE_HITBOX_1; [28]: Enemy: Naga [b4fc].byte SPRITE_HITBOX_1; [29]: Enemy: Skeleton Knight (unused) [b4fd].byte SPRITE_HITBOX_1; [30]: Enemy: Giant Strider [b4fe].byte SPRITE_HITBOX_1; [31]: Enemy: Sir Gawaine [b4ff].byte SPRITE_HITBOX_1; [32]: Enemy: Maskman [b500].byte SPRITE_HITBOX_1; [33]: Enemy: Wolfman [b501].byte SPRITE_HITBOX_1; [34]: Enemy: Yareeka [b502].byte SPRITE_HITBOX_1; [35]: Enemy: Magman [b503].byte SPRITE_HITBOX_1; [36]: Enemy: Curly-tailed guy with spear (unused) [b504].byte SPRITE_HITBOX_1; [37]: Enemy: ? (unused) [b505].byte SPRITE_HITBOX_1; [38]: Enemy: Ikeda [b506].byte SPRITE_HITBOX_1; [39]: Enemy: Muppet guy (unused) [b507].byte SPRITE_HITBOX_1; [40]: Enemy: Lamprey [b508].byte SPRITE_HITBOX_1; [41]: Enemy: ? (unused) [b509].byte SPRITE_HITBOX_1; [42]: Enemy: Monodron [b50a].byte SPRITE_HITBOX_1; [43]: Enemy: Winged skeleton (unused) [b50b].byte SPRITE_HITBOX_1; [44]: Enemy: Tamazutsu [b50c].byte SPRITE_HITBOX_3; [45]: Boss: Ripasheiku [b50d].byte SPRITE_HITBOX_2; [46]: Boss: Zoradohna [b50e].byte SPRITE_HITBOX_2; [47]: Boss: Borabohra [b50f].byte SPRITE_HITBOX_1; [48]: Boss: Pakukame [b510].byte SPRITE_HITBOX_1; [49]: Boss: King Grieve [b511].byte SPRITE_HITBOX_1; [50]: Boss: Shadow Eura [b512].byte SPRITE_HITBOX_1; [51]: NPC: Walking Man 1 [b513].byte SPRITE_HITBOX_1; [52]: NPC: Blue lady (unused) [b514].byte SPRITE_HITBOX_1; [53]: NPC: Child (unused) [b515].byte SPRITE_HITBOX_1; [54]: NPC: Armor Salesman [b516].byte SPRITE_HITBOX_1; [55]: NPC: Martial Artist [b517].byte SPRITE_HITBOX_1; [56]: NPC: Priest [b518].byte SPRITE_HITBOX_1; [57]: NPC: King [b519].byte SPRITE_HITBOX_1; [58]: NPC: Magic Teacher [b51a].byte SPRITE_HITBOX_1; [59]: NPC: Key Salesman [b51b].byte SPRITE_HITBOX_1; [60]: NPC: Smoking Man [b51c].byte SPRITE_HITBOX_1; [61]: NPC: Man in Chair [b51d].byte SPRITE_HITBOX_1; [62]: NPC: Sitting Man [b51e].byte SPRITE_HITBOX_1; [63]: NPC: Meat Salesman [b51f].byte SPRITE_HITBOX_1; [64]: NPC: Lady in Blue Dress with Cup [b520].byte SPRITE_HITBOX_1; [65]: NPC: Guard [b521].byte SPRITE_HITBOX_1; [66]: NPC: Doctor [b522].byte SPRITE_HITBOX_1; [67]: NPC: Walking Woman 1 [b523].byte SPRITE_HITBOX_1; [68]: NPC: Walking Woman 2 [b524].byte SPRITE_HITBOX_1; [69]: Enemy: Eyeball (unused) [b525].byte SPRITE_HITBOX_0; [70]: Enemy: Zozura [b526].byte SPRITE_HITBOX_0; [71]: Item: Glove [b527].byte SPRITE_HITBOX_0; [72]: Item: Black Onyx [b528].byte SPRITE_HITBOX_0; [73]: Item: Pendant [b529].byte SPRITE_HITBOX_0; [74]: Item: Red Potion [b52a].byte SPRITE_HITBOX_0; [75]: Item: Poison [b52b].byte SPRITE_HITBOX_0; [76]: Item: Elixir [b52c].byte SPRITE_HITBOX_0; [77]: Item: Ointment [b52d].byte SPRITE_HITBOX_0; [78]: Trigger: Intro [b52e].byte SPRITE_HITBOX_1; [79]: Item: Mattock
; ; XREFS: ; Sprite_ReplaceWithMattock ;
[b52f]SPRITE_ENTITIES_HITBOX_TYPES_80_:; [$b52f] [b52f].byte SPRITE_HITBOX_0; [80]: Magic: ?
; ; XREFS: ; Sprite_Maybe_ResetState ;
[b530]SPRITE_ENTITIES_HITBOX_TYPES_81_:; [$b530] [b530].byte SPRITE_HITBOX_0; [81]: Effect: Fountain [b531].byte SPRITE_HITBOX_4; [82]: Magic: ? [b532].byte SPRITE_HITBOX_0; [83]: Magic: ? [b533].byte SPRITE_HITBOX_0; [84]: Item: Wing Boots [b534].byte SPRITE_HITBOX_0; [85]: Item: Hour Glass [b535].byte SPRITE_HITBOX_0; [86]: Item: Magical Rod [b536].byte SPRITE_HITBOX_0; [87]: Item: Battle Suit [b537].byte SPRITE_HITBOX_0; [88]: Item: Battle Helmet [b538].byte SPRITE_HITBOX_0; [89]: Item: Dragon Slayer [b539].byte SPRITE_HITBOX_0; [90]: Item: Mattock [b53a].byte SPRITE_HITBOX_0; [91]: Item: Wing Boots (from quest) [b53b].byte SPRITE_HITBOX_0; [92]: Item: Red Potion [b53c].byte SPRITE_HITBOX_0; [93]: Item: Poison [b53d].byte SPRITE_HITBOX_0; [94]: Item: Glove [b53e].byte SPRITE_HITBOX_0; [95]: Item: Ointment [b53f].byte SPRITE_HITBOX_0; [96]: Effect: Spring of Trunk [b540].byte SPRITE_HITBOX_4; [97]: Effect: Spring of Sky [b541].byte SPRITE_HITBOX_4; [98]: Effect: Spring of Tower [b542].byte SPRITE_HITBOX_4; [99]: Effect: Boss Death [b543].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] [b544].byte SPRITE_ENEMY; [0]: [b545].byte SPRITE_DROPPED; [1]: Dropped: Bread [b546].byte SPRITE_DROPPED; [2]: Dropped: Coin [b547].byte SPRITE_ENEMY; [3]: Enemy: ? [b548].byte SPRITE_ENEMY; [4]: Enemy: Raiden [b549].byte SPRITE_ENEMY; [5]: Enemy: Necron Aides [b54a].byte SPRITE_ENEMY; [6]: Enemy: Zombie [b54b].byte SPRITE_ENEMY; [7]: Enemy: Hornet [b54c].byte SPRITE_ENEMY; [8]: Enemy: Bihoruda [b54d].byte SPRITE_ENEMY; [9]: Enemy: Lilith [b54e].byte SPRITE_MAGIC; [10]: Magic: ? [b54f].byte SPRITE_ENEMY; [11]: Enemy: Yuinaru [b550].byte SPRITE_ENEMY; [12]: Enemy: Snowman [b551].byte SPRITE_ENEMY; [13]: Enemy: Nash [b552].byte SPRITE_ENEMY; [14]: Enemy: Fire Giant [b553].byte SPRITE_ENEMY; [15]: Enemy: Ishiisu [b554].byte SPRITE_ENEMY; [16]: Enemy: Execution Hood [b555].byte SPRITE_BOSS; [17]: Boss: Rokusutahn [b556].byte SPRITE_BOSS; [18]: Boss: unused (round body of snake boss) [b557].byte SPRITE_EFFECT; [19]: Effect: Enemy death [b558].byte SPRITE_EFFECT; [20]: Effect: Lightning ball [b559].byte SPRITE_ENEMY; [21]: Enemy: Charron [b55a].byte SPRITE_ENEMY; [22]: Enemy: ? (Unused) [b55b].byte SPRITE_ENEMY; [23]: Enemy: Geributa [b55c].byte SPRITE_ENEMY; [24]: Enemy: Sugata [b55d].byte SPRITE_ENEMY; [25]: Enemy: Grimlock [b55e].byte SPRITE_ENEMY; [26]: Enemy: Giant Bees [b55f].byte SPRITE_ENEMY; [27]: Enemy: Myconid [b560].byte SPRITE_ENEMY; [28]: Enemy: Naga [b561].byte SPRITE_ENEMY; [29]: Enemy: Skeleton Knight (unused) [b562].byte SPRITE_ENEMY; [30]: Enemy: Giant Strider [b563].byte SPRITE_ENEMY; [31]: Enemy: Sir Gawaine [b564].byte SPRITE_ENEMY; [32]: Enemy: Maskman [b565].byte SPRITE_ENEMY; [33]: Enemy: Wolfman [b566].byte SPRITE_ENEMY; [34]: Enemy: Yareeka [b567].byte SPRITE_ENEMY; [35]: Enemy: Magman [b568].byte SPRITE_ENEMY; [36]: Enemy: Curly-tailed guy with spear (unused) [b569].byte SPRITE_ENEMY; [37]: Enemy: ? (unused) [b56a].byte SPRITE_ENEMY; [38]: Enemy: Ikeda [b56b].byte SPRITE_ENEMY; [39]: Enemy: Muppet guy (unused) [b56c].byte SPRITE_ENEMY; [40]: Enemy: Lamprey [b56d].byte SPRITE_ENEMY; [41]: Enemy: ? (unused) [b56e].byte SPRITE_ENEMY; [42]: Enemy: Monodron [b56f].byte SPRITE_ENEMY; [43]: Enemy: Winged skeleton (unused) [b570].byte SPRITE_ENEMY; [44]: Enemy: Tamazutsu [b571].byte SPRITE_BOSS; [45]: Boss: Ripasheiku [b572].byte SPRITE_BOSS; [46]: Boss: Zoradohna [b573].byte SPRITE_BOSS; [47]: Boss: Borabohra [b574].byte SPRITE_BOSS; [48]: Boss: Pakukame [b575].byte SPRITE_BOSS; [49]: Boss: King Grieve [b576].byte SPRITE_BOSS; [50]: Boss: Shadow Eura [b577].byte SPRITE_BOSS; [51]: NPC: Walking Man 1 [b578].byte SPRITE_NPC; [52]: NPC: Blue lady (unused) [b579].byte SPRITE_NPC; [53]: NPC: Child (unused) [b57a].byte SPRITE_NPC; [54]: NPC: Armor Salesman [b57b].byte SPRITE_NPC; [55]: NPC: Martial Artist [b57c].byte SPRITE_NPC; [56]: NPC: Priest [b57d].byte SPRITE_NPC; [57]: NPC: King [b57e].byte SPRITE_NPC; [58]: NPC: Magic Teacher [b57f].byte SPRITE_NPC; [59]: NPC: Key Salesman [b580].byte SPRITE_NPC; [60]: NPC: Smoking Man [b581].byte SPRITE_NPC; [61]: NPC: Man in Chair [b582].byte SPRITE_NPC; [62]: NPC: Sitting Man [b583].byte SPRITE_NPC; [63]: NPC: Meat Salesman [b584].byte SPRITE_NPC; [64]: NPC: Lady in Blue Dress with Cup [b585].byte SPRITE_NPC; [65]: NPC: Guard [b586].byte SPRITE_NPC; [66]: NPC: Doctor [b587].byte SPRITE_NPC; [67]: NPC: Walking Woman 1 [b588].byte SPRITE_NPC; [68]: NPC: Walking Woman 2 [b589].byte SPRITE_NPC; [69]: Enemy: Eyeball (unused) [b58a].byte SPRITE_ENEMY; [70]: Enemy: Zozura [b58b].byte SPRITE_ENEMY; [71]: Item: Glove [b58c].byte SPRITE_ITEM; [72]: Item: Black Onyx [b58d].byte SPRITE_ITEM; [73]: Item: Pendant [b58e].byte SPRITE_ITEM; [74]: Item: Red Potion [b58f].byte SPRITE_ITEM; [75]: Item: Poison [b590].byte SPRITE_ITEM; [76]: Item: Elixir [b591].byte SPRITE_ITEM; [77]: Item: Ointment [b592].byte SPRITE_ITEM; [78]: Trigger: Intro [b593].byte SPRITE_TRIGGER; [79]: Item: Mattock [b594].byte SPRITE_ITEM; [80]: Magic: ? [b595].byte SPRITE_MAGIC; [81]: Effect: Fountain [b596].byte SPRITE_EFFECT; [82]: Magic: ? [b597].byte SPRITE_MAGIC; [83]: Magic: ? [b598].byte SPRITE_MAGIC; [84]: Item: Wing Boots [b599].byte SPRITE_ITEM; [85]: Item: Hour Glass [b59a].byte SPRITE_ITEM; [86]: Item: Magical Rod [b59b].byte SPRITE_ITEM; [87]: Item: Battle Suit [b59c].byte SPRITE_ITEM; [88]: Item: Battle Helmet [b59d].byte SPRITE_ITEM; [89]: Item: Dragon Slayer [b59e].byte SPRITE_ITEM; [90]: Item: Mattock [b59f].byte SPRITE_ITEM; [91]: Item: Wing Boots (from quest) [b5a0].byte SPRITE_ITEM; [92]: Item: Red Potion [b5a1].byte SPRITE_ITEM; [93]: Item: Poison [b5a2].byte SPRITE_ITEM; [94]: Item: Glove [b5a3].byte SPRITE_ITEM; [95]: Item: Ointment [b5a4].byte SPRITE_ITEM; [96]: Effect: Spring of Trunk [b5a5].byte SPRITE_EFFECT; [97]: Effect: Spring of Sky [b5a6].byte SPRITE_EFFECT; [98]: Effect: Spring of Tower [b5a7].byte SPRITE_EFFECT; [99]: Effect: Boss Death [b5a8].byte SPRITE_EFFECT; [100]:
;============================================================================ ; Starting HP for each entity type. ; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;============================================================================
; ; XREFS: ; Sprites_PopulateNextAvailableSprite ;
[b5a9]SPRITE_ENTITIES_HP:; [$b5a9] [b5a9].byte $00; [0]: [b5aa].byte $00; [1]: Dropped: Bread [b5ab].byte $00; [2]: Dropped: Coin [b5ac].byte $00; [3]: Enemy: ? [b5ad].byte $12; [4]: Enemy: Raiden [b5ae].byte $18; [5]: Enemy: Necron Aides [b5af].byte $0e; [6]: Enemy: Zombie [b5b0].byte $03; [7]: Enemy: Hornet [b5b1].byte $05; [8]: Enemy: Bihoruda
; ; XREFS: ; SpriteBehavior_Pakukame ;
[b5b2]SPRITE_ENTITIES_HP_9_:; [$b5b2] [b5b2].byte $07; [9]: Enemy: Lilith [b5b3].byte $08; [10]: Magic: ? [b5b4].byte $03; [11]: Enemy: Yuinaru [b5b5].byte $10; [12]: Enemy: Snowman [b5b6].byte $0c; [13]: Enemy: Nash [b5b7].byte $14; [14]: Enemy: Fire Giant [b5b8].byte $18; [15]: Enemy: Ishiisu [b5b9].byte $64; [16]: Enemy: Execution Hood [b5ba].byte $46; [17]: Boss: Rokusutahn [b5bb].byte $24; [18]: Boss: unused (round body of snake boss) [b5bc].byte $00; [19]: Effect: Enemy death [b5bd].byte $00; [20]: Effect: Lightning ball [b5be].byte $1a; [21]: Enemy: Charron [b5bf].byte $08; [22]: Enemy: ? (Unused) [b5c0].byte $12; [23]: Enemy: Geributa [b5c1].byte $16; [24]: Enemy: Sugata [b5c2].byte $1d; [25]: Enemy: Grimlock [b5c3].byte $13; [26]: Enemy: Giant Bees [b5c4].byte $16; [27]: Enemy: Myconid [b5c5].byte $17; [28]: Enemy: Naga [b5c6].byte $00; [29]: Enemy: Skeleton Knight (unused) [b5c7].byte $1d; [30]: Enemy: Giant Strider [b5c8].byte $23; [31]: Enemy: Sir Gawaine [b5c9].byte $20; [32]: Enemy: Maskman [b5ca].byte $26; [33]: Enemy: Wolfman [b5cb].byte $30; [34]: Enemy: Yareeka [b5cc].byte $17; [35]: Enemy: Magman [b5cd].byte $24; [36]: Enemy: Curly-tailed guy with spear (unused) [b5ce].byte $1f; [37]: Enemy: ? (unused) [b5cf].byte $11; [38]: Enemy: Ikeda [b5d0].byte $20; [39]: Enemy: Muppet guy (unused) [b5d1].byte $38; [40]: Enemy: Lamprey [b5d2].byte $24; [41]: Enemy: ? (unused) [b5d3].byte $0a; [42]: Enemy: Monodron [b5d4].byte $0b; [43]: Enemy: Winged skeleton (unused) [b5d5].byte $1a; [44]: Enemy: Tamazutsu [b5d6].byte $4b; [45]: Boss: Ripasheiku [b5d7].byte $73; [46]: Boss: Zoradohna [b5d8].byte $69; [47]: Boss: Borabohra [b5d9].byte $28; [48]: Boss: Pakukame [b5da].byte $18; [49]: Boss: King Grieve [b5db].byte $fa; [50]: Boss: Shadow Eura [b5dc].byte $fa; [51]: NPC: Walking Man 1 [b5dd].byte $00; [52]: NPC: Blue lady (unused) [b5de].byte $00; [53]: NPC: Child (unused) [b5df].byte $00; [54]: NPC: Armor Salesman [b5e0].byte $00; [55]: NPC: Martial Artist [b5e1].byte $00; [56]: NPC: Priest [b5e2].byte $00; [57]: NPC: King [b5e3].byte $00; [58]: NPC: Magic Teacher [b5e4].byte $00; [59]: NPC: Key Salesman [b5e5].byte $00; [60]: NPC: Smoking Man [b5e6].byte $00; [61]: NPC: Man in Chair [b5e7].byte $00; [62]: NPC: Sitting Man [b5e8].byte $00; [63]: NPC: Meat Salesman [b5e9].byte $00; [64]: NPC: Lady in Blue Dress with Cup [b5ea].byte $00; [65]: NPC: Guard [b5eb].byte $00; [66]: NPC: Doctor [b5ec].byte $00; [67]: NPC: Walking Woman 1 [b5ed].byte $00; [68]: NPC: Walking Woman 2 [b5ee].byte $00; [69]: Enemy: Eyeball (unused) [b5ef].byte $10; [70]: Enemy: Zozura [b5f0].byte $09; [71]: Item: Glove [b5f1].byte $00; [72]: Item: Black Onyx [b5f2].byte $00; [73]: Item: Pendant [b5f3].byte $00; [74]: Item: Red Potion [b5f4].byte $00; [75]: Item: Poison [b5f5].byte $00; [76]: Item: Elixir [b5f6].byte $00; [77]: Item: Ointment [b5f7].byte $00; [78]: Trigger: Intro [b5f8].byte $00; [79]: Item: Mattock [b5f9].byte $00; [80]: Magic: ? [b5fa].byte $08; [81]: Effect: Fountain [b5fb].byte $00; [82]: Magic: ? [b5fc].byte $08; [83]: Magic: ? [b5fd].byte $08; [84]: Item: Wing Boots [b5fe].byte $00; [85]: Item: Hour Glass [b5ff].byte $00; [86]: Item: Magical Rod [b600].byte $00; [87]: Item: Battle Suit [b601].byte $00; [88]: Item: Battle Helmet [b602].byte $00; [89]: Item: Dragon Slayer [b603].byte $00; [90]: Item: Mattock [b604].byte $00; [91]: Item: Wing Boots (from quest) [b605].byte $00; [92]: Item: Red Potion [b606].byte $00; [93]: Item: Poison [b607].byte $00; [94]: Item: Glove [b608].byte $00; [95]: Item: Ointment [b609].byte $00; [96]: Effect: Spring of Trunk [b60a].byte $00; [97]: Effect: Spring of Sky [b60b].byte $00; [98]: Effect: Spring of Tower [b60c].byte $00; [99]: Effect: Boss Death [b60d].byte $00; [100]:
;============================================================================ ; Experience gained from defeating each entity type. ; ; XREFS: ; Player_AddExperienceFromSprite ;============================================================================
; ; XREFS: ; Player_AddExperienceFromSprite ;
[b60e]ENEMY_EXPERIENCE:; [$b60e] [b60e].byte $00; [0]: [b60f].byte $00; [1]: Dropped: Bread [b610].byte $00; [2]: Dropped: Coin [b611].byte $00; [3]: Enemy: ? [b612].byte $23; [4]: Enemy: Raiden [b613].byte $37; [5]: Enemy: Necron Aides [b614].byte $19; [6]: Enemy: Zombie [b615].byte $19; [7]: Enemy: Hornet [b616].byte $23; [8]: Enemy: Bihoruda [b617].byte $19; [9]: Enemy: Lilith [b618].byte $00; [10]: Magic: ? [b619].byte $19; [11]: Enemy: Yuinaru [b61a].byte $37; [12]: Enemy: Snowman [b61b].byte $3c; [13]: Enemy: Nash [b61c].byte $2d; [14]: Enemy: Fire Giant [b61d].byte $0a; [15]: Enemy: Ishiisu [b61e].byte $32; [16]: Enemy: Execution Hood [b61f].byte $78; [17]: Boss: Rokusutahn [b620].byte $5a; [18]: Boss: unused (round body of snake boss) [b621].byte $00; [19]: Effect: Enemy death [b622].byte $00; [20]: Effect: Lightning ball [b623].byte $41; [21]: Enemy: Charron [b624].byte $00; [22]: Enemy: ? (Unused) [b625].byte $28; [23]: Enemy: Geributa [b626].byte $0d; [24]: Enemy: Sugata [b627].byte $3a; [25]: Enemy: Grimlock [b628].byte $1d; [26]: Enemy: Giant Bees [b629].byte $1a; [27]: Enemy: Myconid [b62a].byte $23; [28]: Enemy: Naga [b62b].byte $00; [29]: Enemy: Skeleton Knight (unused) [b62c].byte $30; [30]: Enemy: Giant Strider [b62d].byte $3a; [31]: Enemy: Sir Gawaine [b62e].byte $36; [32]: Enemy: Maskman [b62f].byte $31; [33]: Enemy: Wolfman [b630].byte $1e; [34]: Enemy: Yareeka [b631].byte $3e; [35]: Enemy: Magman [b632].byte $26; [36]: Enemy: Curly-tailed guy with spear (unused) [b633].byte $19; [37]: Enemy: ? (unused) [b634].byte $21; [38]: Enemy: Ikeda [b635].byte $1d; [39]: Enemy: Muppet guy (unused) [b636].byte $1e; [40]: Enemy: Lamprey [b637].byte $18; [41]: Enemy: ? (unused) [b638].byte $14; [42]: Enemy: Monodron [b639].byte $12; [43]: Enemy: Winged skeleton (unused) [b63a].byte $0f; [44]: Enemy: Tamazutsu [b63b].byte $5a; [45]: Boss: Ripasheiku [b63c].byte $9e; [46]: Boss: Zoradohna [b63d].byte $4b; [47]: Boss: Borabohra [b63e].byte $55; [48]: Boss: Pakukame [b63f].byte $50; [49]: Boss: King Grieve [b640].byte $00; [50]: Boss: Shadow Eura [b641].byte $00; [51]: NPC: Walking Man 1 [b642].byte $00; [52]: NPC: Blue lady (unused) [b643].byte $00; [53]: NPC: Child (unused) [b644].byte $00; [54]: NPC: Armor Salesman [b645].byte $00; [55]: NPC: Martial Artist [b646].byte $00; [56]: NPC: Priest [b647].byte $00; [57]: NPC: King [b648].byte $00; [58]: NPC: Magic Teacher [b649].byte $00; [59]: NPC: Key Salesman [b64a].byte $00; [60]: NPC: Smoking Man [b64b].byte $00; [61]: NPC: Man in Chair [b64c].byte $00; [62]: NPC: Sitting Man [b64d].byte $00; [63]: NPC: Meat Salesman [b64e].byte $00; [64]: NPC: Lady in Blue Dress with Cup [b64f].byte $00; [65]: NPC: Guard [b650].byte $00; [66]: NPC: Doctor [b651].byte $00; [67]: NPC: Walking Woman 1 [b652].byte $00; [68]: NPC: Walking Woman 2 [b653].byte $00; [69]: Enemy: Eyeball (unused) [b654].byte $19; [70]: Enemy: Zozura [b655].byte $1e; [71]: Item: Glove [b656].byte $00; [72]: Item: Black Onyx [b657].byte $00; [73]: Item: Pendant [b658].byte $00; [74]: Item: Red Potion [b659].byte $00; [75]: Item: Poison [b65a].byte $00; [76]: Item: Elixir [b65b].byte $00; [77]: Item: Ointment [b65c].byte $00; [78]: Trigger: Intro [b65d].byte $00; [79]: Item: Mattock [b65e].byte $00; [80]: Magic: ? [b65f].byte $08; [81]: Effect: Fountain [b660].byte $00; [82]: Magic: ? [b661].byte $08; [83]: Magic: ? [b662].byte $08; [84]: Item: Wing Boots [b663].byte $00; [85]: Item: Hour Glass [b664].byte $00; [86]: Item: Magical Rod [b665].byte $00; [87]: Item: Battle Suit [b666].byte $00; [88]: Item: Battle Helmet [b667].byte $00; [89]: Item: Dragon Slayer [b668].byte $00; [90]: Item: Mattock [b669].byte $00; [91]: Item: Wing Boots (from quest) [b66a].byte $00; [92]: Item: Red Potion [b66b].byte $00; [93]: Item: Poison [b66c].byte $00; [94]: Item: Glove [b66d].byte $00; [95]: Item: Ointment [b66e].byte $00; [96]: Effect: Spring of Trunk [b66f].byte $00; [97]: Effect: Spring of Sky [b670].byte $00; [98]: Effect: Spring of Tower [b671].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] [b672].byte $ff; [0]: [b673].byte $ff; [1]: Dropped: Bread [b674].byte $ff; [2]: Dropped: Coin [b675].byte $00; [3]: Enemy: ? [b676].byte $08; [4]: Enemy: Raiden [b677].byte $11; [5]: Enemy: Necron Aides [b678].byte $ff; [6]: Enemy: Zombie [b679].byte $07; [7]: Enemy: Hornet [b67a].byte $08; [8]: Enemy: Bihoruda [b67b].byte $ff; [9]: Enemy: Lilith [b67c].byte $00; [10]: Magic: ? [b67d].byte $32; [11]: Enemy: Yuinaru [b67e].byte $13; [12]: Enemy: Snowman [b67f].byte $12; [13]: Enemy: Nash [b680].byte $11; [14]: Enemy: Fire Giant [b681].byte $15; [15]: Enemy: Ishiisu [b682].byte $1d; [16]: Enemy: Execution Hood [b683].byte $15; [17]: Boss: Rokusutahn [b684].byte $06; [18]: Boss: unused (round body of snake boss) [b685].byte $ff; [19]: Effect: Enemy death [b686].byte $ff; [20]: Effect: Lightning ball [b687].byte $14; [21]: Enemy: Charron [b688].byte $00; [22]: Enemy: ? (Unused) [b689].byte $0f; [23]: Enemy: Geributa [b68a].byte $13; [24]: Enemy: Sugata [b68b].byte $12; [25]: Enemy: Grimlock [b68c].byte $14; [26]: Enemy: Giant Bees [b68d].byte $32; [27]: Enemy: Myconid [b68e].byte $38; [28]: Enemy: Naga [b68f].byte $ff; [29]: Enemy: Skeleton Knight (unused) [b690].byte $16; [30]: Enemy: Giant Strider [b691].byte $18; [31]: Enemy: Sir Gawaine [b692].byte $19; [32]: Enemy: Maskman [b693].byte $1a; [33]: Enemy: Wolfman [b694].byte $33; [34]: Enemy: Yareeka [b695].byte $1b; [35]: Enemy: Magman [b696].byte $17; [36]: Enemy: Curly-tailed guy with spear (unused) [b697].byte $18; [37]: Enemy: ? (unused) [b698].byte $13; [38]: Enemy: Ikeda [b699].byte $33; [39]: Enemy: Muppet guy (unused) [b69a].byte $34; [40]: Enemy: Lamprey [b69b].byte $33; [41]: Enemy: ? (unused) [b69c].byte $09; [42]: Enemy: Monodron [b69d].byte $34; [43]: Enemy: Winged skeleton (unused) [b69e].byte $15; [44]: Enemy: Tamazutsu [b69f].byte $19; [45]: Boss: Ripasheiku [b6a0].byte $1c; [46]: Boss: Zoradohna [b6a1].byte $08; [47]: Boss: Borabohra [b6a2].byte $16; [48]: Boss: Pakukame [b6a3].byte $03; [49]: Boss: King Grieve [b6a4].byte $ff; [50]: Boss: Shadow Eura [b6a5].byte $ff; [51]: NPC: Walking Man 1 [b6a6].byte $ff; [52]: NPC: Blue lady (unused) [b6a7].byte $ff; [53]: NPC: Child (unused) [b6a8].byte $ff; [54]: NPC: Armor Salesman [b6a9].byte $ff; [55]: NPC: Martial Artist [b6aa].byte $ff; [56]: NPC: Priest [b6ab].byte $ff; [57]: NPC: King [b6ac].byte $ff; [58]: NPC: Magic Teacher [b6ad].byte $ff; [59]: NPC: Key Salesman [b6ae].byte $ff; [60]: NPC: Smoking Man [b6af].byte $ff; [61]: NPC: Man in Chair [b6b0].byte $ff; [62]: NPC: Sitting Man [b6b1].byte $ff; [63]: NPC: Meat Salesman [b6b2].byte $ff; [64]: NPC: Lady in Blue Dress with Cup [b6b3].byte $ff; [65]: NPC: Guard [b6b4].byte $ff; [66]: NPC: Doctor [b6b5].byte $ff; [67]: NPC: Walking Woman 1 [b6b6].byte $ff; [68]: NPC: Walking Woman 2 [b6b7].byte $ff; [69]: Enemy: Eyeball (unused) [b6b8].byte $0f; [70]: Enemy: Zozura [b6b9].byte $32; [71]: Item: Glove [b6ba].byte $ff; [72]: Item: Black Onyx [b6bb].byte $ff; [73]: Item: Pendant [b6bc].byte $ff; [74]: Item: Red Potion [b6bd].byte $ff; [75]: Item: Poison [b6be].byte $ff; [76]: Item: Elixir [b6bf].byte $ff; [77]: Item: Ointment [b6c0].byte $ff; [78]: Trigger: Intro [b6c1].byte $ff; [79]: Item: Mattock [b6c2].byte $ff; [80]: Magic: ? [b6c3].byte $00; [81]: Effect: Fountain [b6c4].byte $ff; [82]: Magic: ? [b6c5].byte $00; [83]: Magic: ? [b6c6].byte $00; [84]: Item: Wing Boots [b6c7].byte $ff; [85]: Item: Hour Glass [b6c8].byte $ff; [86]: Item: Magical Rod [b6c9].byte $ff; [87]: Item: Battle Suit [b6ca].byte $ff; [88]: Item: Battle Helmet [b6cb].byte $ff; [89]: Item: Dragon Slayer [b6cc].byte $ff; [90]: Item: Mattock [b6cd].byte $ff; [91]: Item: Wing Boots (from quest) [b6ce].byte $ff; [92]: Item: Red Potion [b6cf].byte $ff; [93]: Item: Poison [b6d0].byte $ff; [94]: Item: Glove [b6d1].byte $ff; [95]: Item: Ointment [b6d2].byte $ff; [96]: Effect: Spring of Trunk [b6d3].byte $ff; [97]: Effect: Spring of Sky [b6d4].byte $ff; [98]: Effect: Spring of Tower [b6d5].byte $ff; [99]: Effect: Boss Death [b6d6].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] [b6d7].byte $00; [0]: [b6d8].byte $00; [1]: Dropped: Bread [b6d9].byte $00; [2]: Dropped: Coin [b6da].byte $1f; [3]: Enemy: ? [b6db].byte $07; [4]: Enemy: Raiden [b6dc].byte $09; [5]: Enemy: Necron Aides [b6dd].byte $06; [6]: Enemy: Zombie [b6de].byte $03; [7]: Enemy: Hornet [b6df].byte $04; [8]: Enemy: Bihoruda [b6e0].byte $06; [9]: Enemy: Lilith [b6e1].byte $1c; [10]: Magic: ? [b6e2].byte $03; [11]: Enemy: Yuinaru [b6e3].byte $04; [12]: Enemy: Snowman [b6e4].byte $05; [13]: Enemy: Nash [b6e5].byte $07; [14]: Enemy: Fire Giant [b6e6].byte $0d; [15]: Enemy: Ishiisu [b6e7].byte $0f; [16]: Enemy: Execution Hood [b6e8].byte $14; [17]: Boss: Rokusutahn [b6e9].byte $14; [18]: Boss: unused (round body of snake boss) [b6ea].byte $00; [19]: Effect: Enemy death [b6eb].byte $00; [20]: Effect: Lightning ball [b6ec].byte $07; [21]: Enemy: Charron [b6ed].byte $0a; [22]: Enemy: ? (Unused) [b6ee].byte $0a; [23]: Enemy: Geributa [b6ef].byte $04; [24]: Enemy: Sugata [b6f0].byte $0d; [25]: Enemy: Grimlock [b6f1].byte $05; [26]: Enemy: Giant Bees [b6f2].byte $0e; [27]: Enemy: Myconid [b6f3].byte $17; [28]: Enemy: Naga [b6f4].byte $00; [29]: Enemy: Skeleton Knight (unused) [b6f5].byte $0f; [30]: Enemy: Giant Strider [b6f6].byte $0c; [31]: Enemy: Sir Gawaine [b6f7].byte $0b; [32]: Enemy: Maskman [b6f8].byte $11; [33]: Enemy: Wolfman [b6f9].byte $12; [34]: Enemy: Yareeka [b6fa].byte $09; [35]: Enemy: Magman [b6fb].byte $10; [36]: Enemy: Curly-tailed guy with spear (unused) [b6fc].byte $0b; [37]: Enemy: ? (unused) [b6fd].byte $07; [38]: Enemy: Ikeda [b6fe].byte $0a; [39]: Enemy: Muppet guy (unused) [b6ff].byte $10; [40]: Enemy: Lamprey [b700].byte $0c; [41]: Enemy: ? (unused) [b701].byte $05; [42]: Enemy: Monodron [b702].byte $06; [43]: Enemy: Winged skeleton (unused) [b703].byte $0f; [44]: Enemy: Tamazutsu [b704].byte $12; [45]: Boss: Ripasheiku [b705].byte $1c; [46]: Boss: Zoradohna [b706].byte $18; [47]: Boss: Borabohra [b707].byte $0d; [48]: Boss: Pakukame [b708].byte $0b; [49]: Boss: King Grieve [b709].byte $28; [50]: Boss: Shadow Eura [b70a].byte $29; [51]: NPC: Walking Man 1 [b70b].byte $00; [52]: NPC: Blue lady (unused) [b70c].byte $00; [53]: NPC: Child (unused) [b70d].byte $00; [54]: NPC: Armor Salesman [b70e].byte $00; [55]: NPC: Martial Artist [b70f].byte $00; [56]: NPC: Priest [b710].byte $00; [57]: NPC: King [b711].byte $00; [58]: NPC: Magic Teacher [b712].byte $00; [59]: NPC: Key Salesman [b713].byte $00; [60]: NPC: Smoking Man [b714].byte $00; [61]: NPC: Man in Chair [b715].byte $00; [62]: NPC: Sitting Man [b716].byte $00; [63]: NPC: Meat Salesman [b717].byte $00; [64]: NPC: Lady in Blue Dress with Cup [b718].byte $00; [65]: NPC: Guard [b719].byte $00; [66]: NPC: Doctor [b71a].byte $00; [67]: NPC: Walking Woman 1 [b71b].byte $00; [68]: NPC: Walking Woman 2 [b71c].byte $00; [69]: Enemy: Eyeball (unused) [b71d].byte $08; [70]: Enemy: Zozura [b71e].byte $07; [71]: Item: Glove [b71f].byte $00; [72]: Item: Black Onyx [b720].byte $00; [73]: Item: Pendant [b721].byte $00; [74]: Item: Red Potion [b722].byte $00; [75]: Item: Poison [b723].byte $00; [76]: Item: Elixir [b724].byte $00; [77]: Item: Ointment [b725].byte $00; [78]: Trigger: Intro [b726].byte $00; [79]: Item: Mattock [b727].byte $00; [80]: Magic: ? [b728].byte $08; [81]: Effect: Fountain [b729].byte $00; [82]: Magic: ? [b72a].byte $1c; [83]: Magic: ? [b72b].byte $08; [84]: Item: Wing Boots [b72c].byte $00; [85]: Item: Hour Glass [b72d].byte $00; [86]: Item: Magical Rod [b72e].byte $00; [87]: Item: Battle Suit [b72f].byte $00; [88]: Item: Battle Helmet [b730].byte $00; [89]: Item: Dragon Slayer [b731].byte $00; [90]: Item: Mattock [b732].byte $00; [91]: Item: Wing Boots (from quest) [b733].byte $00; [92]: Item: Red Potion [b734].byte $00; [93]: Item: Poison [b735].byte $00; [94]: Item: Glove [b736].byte $00; [95]: Item: Ointment [b737].byte $00; [96]: Effect: Spring of Trunk [b738].byte $00; [97]: Effect: Spring of Sky [b739].byte $00; [98]: Effect: Spring of Tower [b73a].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] [b73b].byte $fc; [0]: <unused> [b73c].byte $fc; [1]: Dropped: Bread [b73d].byte $fc; [2]: Dropped: Coin [b73e].byte $fc; [3]: Enemy: ? [b73f].byte $10; [4]: Enemy: Raiden [b740].byte $50; [5]: Enemy: Necron Aides [b741].byte $0c; [6]: Enemy: Zombie [b742].byte $00; [7]: Enemy: Hornet [b743].byte $00; [8]: Enemy: Bihoruda [b744].byte $00; [9]: Enemy: Lilith [b745].byte $fc; [10]: Magic: ? [b746].byte $00; [11]: Enemy: Yuinaru [b747].byte $04; [12]: Enemy: Snowman [b748].byte $fc; [13]: Enemy: Nash [b749].byte $40; [14]: Enemy: Fire Giant [b74a].byte $14; [15]: Enemy: Ishiisu [b74b].byte $c0; [16]: Enemy: Execution Hood [b74c].byte $00; [17]: Boss: Rokusutahn [b74d].byte $d0; [18]: Boss: unused (round body of snake boss) [b74e].byte $fc; [19]: Effect: Enemy death [b74f].byte $fc; [20]: Effect: Lightning ball [b750].byte $00; [21]: Enemy: Charron [b751].byte $fc; [22]: Enemy: ? (Unused) [b752].byte $00; [23]: Enemy: Geributa [b753].byte $3c; [24]: Enemy: Sugata [b754].byte $00; [25]: Enemy: Grimlock [b755].byte $0c; [26]: Enemy: Giant Bees [b756].byte $14; [27]: Enemy: Myconid [b757].byte $00; [28]: Enemy: Naga [b758].byte $00; [29]: Enemy: Skeleton Knight (unused) [b759].byte $00; [30]: Enemy: Giant Strider [b75a].byte $00; [31]: Enemy: Sir Gawaine [b75b].byte $00; [32]: Enemy: Maskman [b75c].byte $00; [33]: Enemy: Wolfman [b75d].byte $00; [34]: Enemy: Yareeka [b75e].byte $00; [35]: Enemy: Magman [b75f].byte $00; [36]: Enemy: Curly-tailed guy with spear (unused) [b760].byte $54; [37]: Enemy: ? (unused) [b761].byte $00; [38]: Enemy: Ikeda [b762].byte $40; [39]: Enemy: Muppet guy (unused) [b763].byte $00; [40]: Enemy: Lamprey [b764].byte $00; [41]: Enemy: ? (unused) [b765].byte $00; [42]: Enemy: Monodron [b766].byte $00; [43]: Enemy: Winged skeleton (unused) [b767].byte $14; [44]: Enemy: Tamazutsu [b768].byte $40; [45]: Boss: Ripasheiku [b769].byte $f4; [46]: Boss: Zoradohna [b76a].byte $e0; [47]: Boss: Borabohra [b76b].byte $44; [48]: Boss: Pakukame [b76c].byte $00; [49]: Boss: King Grieve [b76d].byte $fc; [50]: Boss: Shadow Eura [b76e].byte $fc; [51]: NPC: Walking Man 1 [b76f].byte $fc; [52]: NPC: Blue lady (unused) [b770].byte $fc; [53]: NPC: Child (unused) [b771].byte $fc; [54]: NPC: Armor Salesman [b772].byte $fc; [55]: NPC: Martial Artist [b773].byte $fc; [56]: NPC: Priest [b774].byte $fc; [57]: NPC: King [b775].byte $fc; [58]: NPC: Magic Teacher [b776].byte $fc; [59]: NPC: Key Salesman [b777].byte $fc; [60]: NPC: Smoking Man [b778].byte $fc; [61]: NPC: Man in Chair [b779].byte $fc; [62]: NPC: Sitting Man [b77a].byte $fc; [63]: NPC: Meat Salesman [b77b].byte $fc; [64]: NPC: Lady in Blue Dress with Cup [b77c].byte $fc; [65]: NPC: Guard [b77d].byte $fc; [66]: NPC: Doctor [b77e].byte $fc; [67]: NPC: Walking Woman 1 [b77f].byte $fc; [68]: NPC: Walking Woman 2 [b780].byte $fc; [69]: Enemy: Eyeball (unused) [b781].byte $00; [70]: Enemy: Zozura [b782].byte $00; [71]: Item: Glove [b783].byte $00; [72]: Item: Black Onyx [b784].byte $fc; [73]: Item: Pendant [b785].byte $fc; [74]: Item: Red Potion [b786].byte $00; [75]: Item: Poison [b787].byte $fc; [76]: Item: Elixir [b788].byte $00; [77]: Item: Ointment [b789].byte $fc; [78]: Trigger: Intro [b78a].byte $fc; [79]: Item: Mattock [b78b].byte $00; [80]: Magic: ? [b78c].byte $fc; [81]: Effect: Fountain [b78d].byte $fc; [82]: Magic: ? [b78e].byte $fc; [83]: Magic: ? [b78f].byte $fc; [84]: Item: Wing Boots [b790].byte $fc; [85]: Item: Hour Glass [b791].byte $fc; [86]: Item: Magical Rod [b792].byte $fc; [87]: Item: Battle Suit [b793].byte $fc; [88]: Item: Battle Helmet [b794].byte $fc; [89]: Item: Dragon Slayer [b795].byte $fc; [90]: Item: Mattock [b796].byte $fc; [91]: Item: Wing Boots (from quest) [b797].byte $fc; [92]: Item: Red Potion [b798].byte $fc; [93]: Item: Poison [b799].byte $fc; [94]: Item: Glove [b79a].byte $fc; [95]: Item: Ointment [b79b].byte $fc; [96]: Effect: Spring of Trunk [b79c].byte $fc; [97]: Effect: Spring of Sky [b79d].byte $fc; [98]: Effect: Spring of Tower [b79e].byte $fc; [99]: Effect: Boss Death [b79f].byte $fc; [100]: <unused>
;============================================================================ ; Magic damage. ; ; XREFS: ; Player_HitEnemyWithMagic ;============================================================================
; ; XREFS: ; Player_HitEnemyWithMagic ;
[b7a0]MAGIC_DAMAGE:; [$b7a0] [b7a0].byte $06; [0]: Deluge -- 6HP [b7a1].byte $09; [1]: Thunder -- 9HP [b7a2].byte $18; [2]: Fire -- 12HP [b7a3].byte $22; [3]: Death -- 34HP [b7a4].byte $26; [4]: Tilte -- 38HP
;============================================================================ ; Weapon damage. ; ; XREFS: ; Player_HitSpriteWithWeapon ;============================================================================
; ; XREFS: ; Player_HitSpriteWithWeapon ;
[b7a5]WEAPON_STRENGTHS:; [$b7a5] [b7a5].byte $04; [0]: Hand Dagger -- 4HP [b7a6].byte $08; [1]: Long Sword -- 8HP [b7a7].byte $0c; [2]: Giant Blade -- 12HP [b7a8].byte $10; [3]: Dragon Slayer -- 16HP
;============================================================================ ; MP costs for magic spells. ; ; XREFS: ; Player_ReduceMP ;============================================================================
; ; XREFS: ; Player_ReduceMP ;
[b7a9]MAGIC_COSTS:; [$b7a9] [b7a9].byte $02; [0]: Deluge [b7aa].byte $04; [1]: Thunder [b7ab].byte $06; [2]: Fire [b7ac].byte $0a; [3]: Death [b7ad].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] [b7ae]LDA #$00 [b7b0]STA a:NumberOfWeapons; Set the number of weapons to 0. [b7b3]STA a:NumberOfShields; Set the number of shields to 0. [b7b6]STA a:NumberOfMagicSpells; Set the number of magic spells to 0. [b7b9]STA a:NumberOfItems; Set the number of items to 0. [b7bc]STA 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] [b7bf]LDA #$00 [b7c1]STA a:SelectedArmor; Set armor to Leather. [b7c4]LDA #$ff [b7c6]STA a:SelectedWeapon; Set weapon to None. [b7c9]STA a:Player_CurWeapon; Set current weapon to None. [b7cc]STA a:SelectedShield; Set shield to None. [b7cf]STA a:SelectedMagic; Set magic to None. [b7d2]STA a:SelectedItem; Set item to None.
; ; XREFS: ; Player_DrawWeapon ;
[b7d5]RETURN_B7D5:; [$b7d5] [b7d5]RTS
;============================================================================ ; TODO: Document Player_DrawWeapon ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; EndGame_MainLoop ; Game_DrawScreenInFrozenState ; Game_MainLoop ;============================================================================
[b7d6]Player_DrawWeapon:; [$b7d6] [b7d6]LDA a:IScript_PortraitID [b7d9]BPL RETURN_B7D5 [b7db]LDA a:Player_CurWeapon [b7de]BMI RETURN_B7D5 [b7e0]LDA Player_ArmorLookupIndex [b7e2]AND #$01 [b7e4]STA Temp_00 [b7e6]JSR Player_GetNormalizedWeaponID [b7e9]ASL A [b7ea]ORA Temp_00 [b7ec]ASL A [b7ed]TAX [b7ee]LDA PTR_ARRAY_PRG14__b89f,X [b7f1]STA Temp_Addr_L [b7f3]LDA PTR_ARRAY_PRG14__b89f+1,X [b7f6]STA Temp_Addr_U [b7f8]JSR Maybe_Player_CalcAnimFrame [b7fb]STA Temp_00 [b7fd]ASL A [b7fe]TAY [b7ff]LDA Player_Flags [b801]AND #$40 [b803]BEQ @LAB_PRG14__b806 [b805]INY [b806]@LAB_PRG14__b806:; [$b806] [b806]LDA (Temp_Addr_L),Y [b808]JSR Player_CalcValueAndFFForNeg [b80b]LDA Player_PosX_Block [b80d]CLC [b80e]ADC Temp_04 [b810]STA PlayerPosXPlus10 [b812]LDA Screen_Maybe_ScrollXCounter [b814]ADC Temp_05 [b816]STA Maybe_Something_WeaponPosX [b818]CMP Screen_Maybe_ScrollXCounter [b81a]BNE RETURN_B7D5 [b81c]LDA a:Player_CurWeapon [b81f]ASL A [b820]TAX [b821]LDA PTR_ARRAY_PRG14__b90f,X [b824]STA Temp_Addr_L [b826]LDA PTR_ARRAY_PRG14__b90f+1,X [b829]STA Temp_Addr_U [b82b]LDY Temp_00 [b82d]LDA Player_PosY [b82f]CLC [b830]ADC (Temp_Addr_L),Y [b832]STA Maybe_Something_WeaponPosY [b834]LDA Player_Something_ScrollPosY [b836]ADC #$00 [b838]STA DrawWeapon_Unused_00D1 [b83a]LDA a:Player_CurWeapon [b83d]ASL A [b83e]TAX [b83f]LDA MAYBE_WEAPON_RANGES,X [b842]STA Maybe_WeaponRange_X [b844]LDA MAYBE_WEAPON_RANGES+1,X [b847]STA Maybe_WeaponRange_Y [b849]LDA Maybe_Something_WeaponPosX [b84b]CMP Screen_Maybe_ScrollXCounter [b84d]BEQ @LAB_PRG14__b850 [b84f]RTS [b850]@LAB_PRG14__b850:; [$b850] [b850]LDA Player_Flags [b852]AND #$40 [b854]STA CurrentSprite_FlipMask [b856]LDA PlayerPosXPlus10 [b858]STA Arg_DrawSprite_PosX [b85a]LDA Maybe_Something_WeaponPosY [b85c]STA Arg_DrawSprite_PosY [b85e]LDA Temp_00 [b860]PHA [b861]JSR Player_CalculateVisibility [b864]PLA [b865]STA Temp_00 [b867]LDX a:Player_CurWeapon [b86a]LDA WEAPONS_SPRITE_U,X [b86d]STA Sprites_PPUOffset [b86f]LDA Temp_00 [b871]CLC [b872]ADC WEAPONS_SPRITE_L,X [b875]JMP Sprite_SetPlayerAppearanceAddr
;============================================================================ ; Sprite addresses for each weapon type. ; ; XREFS: ; Player_DrawWeapon ;============================================================================
; ; XREFS: ; Player_DrawWeapon ;
[b878]WEAPONS_SPRITE_L:; [$b878] [b878].byte $40; [0]: [b879].byte $48; [1]: [b87a].byte $50; [2]: [b87b].byte $58; [3]:
; ; XREFS: ; Player_DrawWeapon ;
[b87c]WEAPONS_SPRITE_U:; [$b87c] [b87c].byte $38; [0]: [b87d].byte $38; [1]: [b87e].byte $38; [2]: [b87f].byte $34; [3]:
;============================================================================ ; TODO: Document Player_CalcValueAndFFForNeg ; ; INPUTS: ; A ; ; OUTPUTS: ; TODO ; ; XREFS: ; Player_DrawWeapon ; FUN_PRG15_MIRROR__ec58 ;============================================================================
[b880]Player_CalcValueAndFFForNeg:; [$b880] [b880]STA Temp_04 [b882]LDA #$00 [b884]STA Temp_05 [b886]LDA Temp_04 [b888]BPL @_return [b88a]LDA #$ff [b88c]STA Temp_05 [b88e]@_return:; [$b88e] [b88e]RTS [b88f].byte $18,$10,$18,$18,$18,$18,$20,$00; [$b88f] undefined
; ; XREFS: ; Player_DrawWeapon ;
[b897]MAYBE_WEAPON_RANGES:; [$b897] [b897].word $0408,$0810,$0810,$0810; [$b897] ushort
; ; XREFS: ; Player_DrawWeapon ;
[b89f]PTR_ARRAY_PRG14__b89f:; [$b89f] [b89f]pointer DAT_PRG14__b8af; [0]: Dagger [b8a1]pointer DAT_PRG14__b8bf; [1]: Dagger + shield [b8a3]pointer DAT_PRG14__b8cf; [2]: Long Sword [b8a5]pointer DAT_PRG14__b8df; [3]: Long Sword + shield [b8a7]pointer DAT_PRG14__b8ef; [4]: Giant Blade [b8a9]pointer DAT_PRG14__b8ff; [5]: Giant Blade + shield [b8ab]pointer DAT_PRG14__b8ff; [6]: Dragon Slayer [b8ad]pointer DAT_PRG14__b8ff; [7]: Dragon Slayer + shield
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b89f] ;
[b8af]DAT_PRG14__b8af:; [$b8af] [b8af].byte $f8,$10,$fc,$0c,$f8,$10,$f8,$10; [$b8af] undefined [b8b7].byte $f8,$10,$f8,$0e,$f0,$18,$00,$00; [$b8b7] undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a1] ;
[b8bf]DAT_PRG14__b8bf:; [$b8bf] [b8bf].byte $f8,$10,$f8,$10,$f8,$10,$f8,$10; [$b8bf] undefined [b8c7].byte $f8,$10,$f8,$10,$f0,$18,$00,$00; [$b8c7] undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a3] ;
[b8cf]DAT_PRG14__b8cf:; [$b8cf] [b8cf].byte $f8,$10,$fc,$0c,$f8,$10,$f8,$10; [$b8cf] undefined [b8d7].byte $f8,$10,$f0,$10,$e8,$18,$00,$00; [$b8d7] undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a5] ;
[b8df]DAT_PRG14__b8df:; [$b8df] [b8df].byte $f8,$10,$f8,$10,$f8,$10,$f8,$10; [$b8df] undefined [b8e7].byte $f8,$10,$f0,$10,$e8,$18,$00,$00; [$b8e7] undefined
; ; XREFS: ; PTR_ARRAY_PRG14__b89f [$PRG14::b8a7] ;
[b8ef]DAT_PRG14__b8ef:; [$b8ef] [b8ef].byte $f0,$10,$fc,$0c,$f8,$10,$f0,$10; [$b8ef] undefined [b8f7].byte $f8,$10,$f0,$10,$e8,$18,$00,$00; [$b8f7] 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] [b8ff].byte $f0,$10,$f8,$10,$f8,$10,$f0,$10; [$b8ff] undefined [b907].byte $f8,$10,$f0,$10,$e8,$18,$00,$00; [$b907] undefined
; ; XREFS: ; Player_DrawWeapon ;
[b90f]PTR_ARRAY_PRG14__b90f:; [$b90f] [b90f]pointer DAT_PRG14__b917; [0]: Hand dagger [b911]pointer DAT_PRG14__b91f; [1]: Long sword [b913]pointer DAT_PRG14__b91f; [2]: Giant blade [b915]pointer DAT_PRG14__b91f; [3]: Dragon slayer
; ; XREFS: ; PTR_ARRAY_PRG14__b90f [$PRG14::b90f] ;
[b917]DAT_PRG14__b917:; [$b917] [b917].byte $08,$08,$08,$08,$08,$08,$06,$00; [$b917] 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] [b91f].byte $00,$08,$08,$00,$08,$08,$06,$00; [$b91f] undefined
;============================================================================ ; TODO: Document Maybe_Player_CalcAnimFrame ; ; INPUTS: ; None. ; ; OUTPUTS: ; A ; ; XREFS: ; Player_CheckShieldHitByMagic ; Player_DrawShield ; Player_DrawWeapon ;============================================================================
[b927]Maybe_Player_CalcAnimFrame:; [$b927] [b927]LDA Player_Flags [b929]LSR A [b92a]BCC @LAB_PRG14__b933 [b92c]LDA Player_Flags [b92e]BMI @LAB_PRG14__b958 [b930]LDA #$03 [b932]RTS [b933]@LAB_PRG14__b933:; [$b933] [b933]AND #$04 [b935]BEQ @LAB_PRG14__b954 [b937]LDA Player_PosX_Block [b939]AND #$0f [b93b]BEQ @LAB_PRG14__b943 [b93d]LDA Player_Flags [b93f]AND #$04 [b941]BNE @LAB_PRG14__b954 [b943]@LAB_PRG14__b943:; [$b943] [b943]LDA Player_Flags [b945]AND #$10 [b947]BEQ @LAB_PRG14__b954 [b949]LDA Player_MovementTick [b94b]AND #$10 [b94d]ASL A [b94e]ASL A [b94f]STA CurrentSprite_FlipMask [b951]LDA #$07 [b953]RTS [b954]@LAB_PRG14__b954:; [$b954] [b954]LDA Player_Flags [b956]BPL @LAB_PRG14__b95e [b958]@LAB_PRG14__b958:; [$b958] [b958]LDX PlayerHitsPhaseCounter [b95a]LDA BYTE_ARRAY_PRG14__b97b,X [b95d]RTS [b95e]@LAB_PRG14__b95e:; [$b95e] [b95e]LDA Player_StatusFlag [b960]BPL @LAB_PRG14__b969 [b962]LDA Joy1_ButtonMask [b964]BPL @LAB_PRG14__b969 [b966]LDA #$03 [b968]RTS [b969]@LAB_PRG14__b969:; [$b969] [b969]LDA Player_Flags [b96b]AND #$20 [b96d]BEQ @LAB_PRG14__b976 [b96f]LDA Player_MovementTick [b971]LSR A [b972]LSR A [b973]LSR A [b974]AND #$03 [b976]@LAB_PRG14__b976:; [$b976] [b976]TAX [b977]LDA BYTE_ARRAY_PRG14__b97e,X [b97a]RTS
; ; XREFS: ; Maybe_Player_CalcAnimFrame ;
[b97b]BYTE_ARRAY_PRG14__b97b:; [$b97b] [b97b].byte $04; [0]: [b97c].byte $05; [1]: [b97d].byte $06; [2]:
; ; XREFS: ; Maybe_Player_CalcAnimFrame ;
[b97e]BYTE_ARRAY_PRG14__b97e:; [$b97e] [b97e].byte $00; [0]: [b97f].byte $01; [1]: [b980].byte $02; [2]: [b981].byte $01; [3]:
;============================================================================ ; TODO: Document Player_DrawShield ; ; INPUTS: ; None. ; ; OUTPUTS: ; TODO ; ; XREFS: ; EndGame_MainLoop ; Game_DrawScreenInFrozenState ; Game_MainLoop ;============================================================================
[b982]Player_DrawShield:; [$b982] [b982]LDA a:IScript_PortraitID [b985]BPL @_return [b987]LDA a:SelectedShield [b98a]BMI @_return [b98c]CMP #$03 [b98e]BEQ @_return [b990]JSR Maybe_Player_CalcAnimFrame [b993]STA Temp_00 [b995]ASL A [b996]TAY [b997]LDA Player_Flags [b999]AND #$40 [b99b]BEQ @LAB_PRG14__b99e [b99d]INY [b99e]@LAB_PRG14__b99e:; [$b99e] [b99e]LDA Player_PosX_Block [b9a0]CLC [b9a1]ADC SHIELD_SPRITE_OFFSETS_X,Y [b9a4]STA a:Player_ShieldPositionX [b9a7]LDA Player_PosY [b9a9]CLC [b9aa]ADC #$08 [b9ac]STA a:Player_ShieldPositionY [b9af]LDA Player_Flags [b9b1]AND #$40 [b9b3]STA CurrentSprite_FlipMask [b9b5]LDA #$30 [b9b7]STA Sprites_PPUOffset [b9b9]LDA a:Player_ShieldPositionX [b9bc]STA Arg_DrawSprite_PosX [b9be]LDA a:Player_ShieldPositionY [b9c1]STA Arg_DrawSprite_PosY [b9c3]LDA Temp_00 [b9c5]PHA [b9c6]JSR Player_CalculateVisibility [b9c9]PLA [b9ca]STA Temp_00 [b9cc]LDY Temp_00 [b9ce]LDA MAYBE_SHIELD_SPRITE_PPU_OFFSETS,Y [b9d1]JMP Sprite_SetPlayerAppearanceAddr [b9d4]@_return:; [$b9d4] [b9d4]RTS
; ; XREFS: ; Player_DrawShield ;
[b9d5]MAYBE_SHIELD_SPRITE_PPU_OFFSETS:; [$b9d5] [b9d5].byte $60; [0]: [b9d6].byte $60; [1]: [b9d7].byte $60; [2]: [b9d8].byte $60; [3]: [b9d9].byte $61; [4]: [b9da].byte $60; [5]: [b9db].byte $62; [6]: [b9dc].byte $42; [7]:
; ; XREFS: ; Player_DrawShield ;
[b9dd]SHIELD_SPRITE_OFFSETS_X:; [$b9dd] [b9dd].byte $00; [0]: [b9de].byte $08; [1]: [b9df].byte $00; [2]: [b9e0].byte $08; [3]: [b9e1].byte $00; [4]: [b9e2].byte $08; [5]: [b9e3].byte $00; [6]: [b9e4].byte $08; [7]: [b9e5].byte $00; [8]: [b9e6].byte $08; [9]: [b9e7].byte $00; [10]: [b9e8].byte $08; [11]: [b9e9].byte $08; [12]: [b9ea].byte $00; [13]: [b9eb].byte $00; [14]: [b9ec].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] [b9ed]LDA #$00 [b9ef]STA Temp_MovingSpriteVisibility [b9f1]LDA Arg_DrawSprite_PosY [b9f3]STA Arg_PixelPosY [b9f5]LDA Arg_DrawSprite_PosX [b9f7]CLC [b9f8]ADC #$04 [b9fa]STA Arg_PixelPosX [b9fc]JSR Area_ConvertPixelsToBlockPos [b9ff]JSR ScreenBuffer_LoadBlockProperty [ba02]CMP #$04 [ba04]BEQ @LAB_PRG14__ba0e [ba06]CMP #$0d [ba08]BEQ @LAB_PRG14__ba0e [ba0a]CMP #$09 [ba0c]BNE @LAB_PRG14__ba14 [ba0e]@LAB_PRG14__ba0e:; [$ba0e] [ba0e]LDA Temp_MovingSpriteVisibility [ba10]ORA #$01 [ba12]STA Temp_MovingSpriteVisibility [ba14]@LAB_PRG14__ba14:; [$ba14] [ba14]LDA Arg_DrawSprite_PosX [ba16]CLC [ba17]ADC #$0c [ba19]STA Arg_PixelPosX [ba1b]JSR Area_ConvertPixelsToBlockPos [ba1e]JSR ScreenBuffer_LoadBlockProperty [ba21]CMP #$04 [ba23]BEQ @LAB_PRG14__ba2d [ba25]CMP #$0d [ba27]BEQ @LAB_PRG14__ba2d [ba29]CMP #$09 [ba2b]BNE @LAB_PRG14__ba33 [ba2d]@LAB_PRG14__ba2d:; [$ba2d] [ba2d]LDA Temp_MovingSpriteVisibility [ba2f]ORA #$02 [ba31]STA Temp_MovingSpriteVisibility [ba33]@LAB_PRG14__ba33:; [$ba33] [ba33]LDA Player_Flags [ba35]AND #$40 [ba37]BEQ @LAB_PRG14__ba46 [ba39]LDA Temp_MovingSpriteVisibility [ba3b]BEQ SUB_PRG14__ba48 [ba3d]CMP #$03 [ba3f]BEQ SUB_PRG14__ba48 [ba41]EOR #$03 [ba43]JMP SUB_PRG14__ba48 [ba46]@LAB_PRG14__ba46:; [$ba46] [ba46]LDA Temp_MovingSpriteVisibility
; ; XREFS: ; Player_CalculateVisibility ;
[ba48]SUB_PRG14__ba48:; [$ba48] [ba48]STA MovingSpriteVisibility [ba4a]RTS
;============================================================================ ; 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] [ba4b]LDA a:Player_CurWeapon; Load the player's current weapon. [ba4e]CMP #$ff; Is it unset? [ba50]BNE @_return; If not, return. [ba52]LDA #$00; Else, return the Hand Dagger. [ba54]@_return:; [$ba54] [ba54]RTS
;============================================================================ ; Clear the visible magic on the screen. ; ; INPUTS: ; None. ; ; OUTPUTS: ; CastMagic_Type: ; The magic, unset. ; ; XREFS: ; Game_InitStateForSpawn ;============================================================================
[ba55]Player_ClearVisibleMagic:; [$ba55] [ba55]LDA #$ff [ba57]STA a:CastMagic_Type; Unset the cast magic type. [ba5a]RTS
;============================================================================ ; 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:; [$ba5b]
; ; Check if there's any visible magic on the screen. ; ; If so, run its handler and return. ;
[ba5b]LDA a:CastMagic_Type; Load the visible magic. [ba5e]BPL CastMagic_RunSpellHandler; If unset, jump to the next function in the spell cast logic.
; ; Check if the player is climbing a ladder. ;
[ba60]JSR Player_IsClimbing; Check if the player can cast magic. [ba63]BCS @_return2; If not, we're done.
; ; Check if the player has pressed Up-B to cast magic. ;
[ba65]LDA Joy1_ButtonMask; Load the current button mask. [ba67]AND #$08; Has Up been pressed? [ba69]BEQ @_return1; If not, return. [ba6b]LDA Joy1_ChangedButtonMask; Load the newly-changed button mask. [ba6d]AND #$40; Has B been pressed? [ba6f]BEQ @_return1; If not, return.
; ; Load the currently-selected magic spell. ; ; Only the primary spells (not extra stages of the spells) ; are supported. ;
[ba71]LDA a:SelectedMagic; Load the magic spell. [ba74]CMP #$05; Compare against 5 (Tilte -- last spell). [ba76]BCC @LAB_PRG14__ba79; If a valid spell, then jump. [ba78]@_return1:; [$ba78] [ba78]RTS; We're done.
; ; If the player has enough MP for the spell, reduce the MP ; for the spell cost. ;
[ba79]@LAB_PRG14__ba79:; [$ba79] [ba79]JSR Player_ReduceMP; Reduce the MP. [ba7c]BCS @_return1; If there's not enough, we're done.
; ; Load the magic spell again. ;
[ba7e]LDA a:SelectedMagic; Load the magic spell. [ba81]CMP #$04; Compare it to 4 (Fire). [ba83]BEQ @_playTilteSound
; ; This is any magic spell other than Tilte, which ; has its own sound. ;
[ba85]LDA #$05 [ba87]JSR Sound_PlayEffect; Play the standard magic sound effect. [ba8a]JMP @_placeMagic
; ; This is Tilte magic. Play its sound effect. ;
[ba8d]@_playTilteSound:; [$ba8d] [ba8d]LDA #$14 [ba8f]JSR Sound_PlayEffect; Play the Tilte magic sound effect.
; ; Begin placing the magic spell on the screen. ;
[ba92]@_placeMagic:; [$ba92] [ba92]LDA a:SelectedMagic; Load the magic spell. [ba95]STA 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]LDA Player_Flags; Load the player's flags. [ba9a]AND #$40; Pull out the Facing Right bit. [ba9c]STA a:CastMagic_Flags; Store as the direction.
; ; Set the initial X position of the magic. ;
[ba9f]LDY a:CastMagic_Type; Y = visible magic [baa2]LDA Player_PosX_Block; A = player X position [baa4]ADC CAST_MAGIC_START_X,Y; Load the relative starting X position for the spell. [baa7]STA a:CastMagic_XPos_Full; Set it as the full X start position. [baaa]LDA Player_PosY; A = player Y position [baac]CLC
; ; Set the initial Y position of the magic. ;
[baad]ADC CAST_MAGIC_START_Y,Y; Load the relative starting Y position for the spell. [bab0]STA a:CastMagic_YPos_Full; Set it as the full Y start position.
; ; Clear the rest of the default state. ;
[bab3]LDA #$00 [bab5]STA a:CastMagic_XPos_Frac; Fractional X = 0 [bab8]STA a:CastMagic_YPos_Frac; Fraction Y = 0 [babb]STA a:CastMagic_Counter; Counter = 0 [babe]STA a:CastMagic_Phase; Phase = 0
; ; Tilte behaves differently, so check which spell's being cast. ;
[bac1]LDA a:CastMagic_Type; Load the magic spell. [bac4]CMP #$04; Compare against Tilte. [bac6]BNE 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]LDA a:CastMagic_Flags; Load the magic's flags. [bacb]ORA #$80; Set the Falling bit. [bacd]STA a:CastMagic_Flags; Store it back out.
; ; Set the magic counter to a default of 33. ;
[bad0]LDA #$21; A = 0x21 [bad2]STA a:CastMagic_Counter; Store as the magic's counter. [bad5]JMP CastMagic_RunSpellHandler; Jump to the next function in the spell cast logic. [bad8]@_return2:; [$bad8] [bad8]RTS
;============================================================================ ; 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:; [$bad9]
; ; Push PRG15_MIRROR:C2E9 to the stack as the result ; after our magic function. ;
[bad9]LDA #$c2 [badb]PHA [badc]LDA #$e8 [bade]PHA
; ; 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]LDA a:CastMagic_Type; A = Current spell [bae2]ASL A; Multiply by 2. [bae3]TAY; Y = A [bae4]LDA CAST_MAGIC_UPDATE_HANDLERS+1,Y; Load the upper nibble of the address [bae7]PHA; Push onto A [bae8]LDA CAST_MAGIC_UPDATE_HANDLERS,Y; Load the lower nibble of the address [baeb]PHA; 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] [baec]RTS
; ; XREFS: ; Player_CastMagic ;
[baed]CAST_MAGIC_START_Y:; [$baed] [baed].byte $08; [0]: Deluge [baee].byte $00; [1]: Thunder [baef].byte $00; [2]: Fire [baf0].byte $08; [3]: Death [baf1].byte $08; [4]: Tilte
; ; XREFS: ; Player_CastMagic ;
[baf2]CAST_MAGIC_START_X:; [$baf2] [baf2].byte $00; [0]: Deluge [baf3].byte $00; [1]: Thunder [baf4].byte $00; [2]: Fire [baf5].byte $00; [3]: Death [baf6].byte $00; [4]: Tilte
; ; XREFS: ; CastMagic_RunSpellHandler ;
[baf7]CAST_MAGIC_UPDATE_HANDLERS:; [$baf7] [baf7]pointer CastMagic_UpdateDeluge-1; [0]: Deluge [baf9]pointer CastMagic_UpdateThunderOrDeath-1; [1]: Thunder [bafb]pointer CastMagic_UpdateFire-1; [2]: Fire [bafd]pointer CastMagic_HandleDeath-1; [3]: Death [baff]pointer CastMagic_UpdateTilte-1; [4]: Tilte [bb01]pointer CastMagic_Unused_UpdateDelugeAfterFirstHit-1; [5]: Deluge after first hit [bb03]pointer CastMagic_UpdateThunderAfterFirstHit-1; [6]: Thunder after first hit [bb05]pointer CastMagic_UpdateFireAfterFirstHit-1; [7]: Fire after first hit [bb07]pointer CastMagic_UpdateDeathAfterFirstHit-1; [8]: Death after first hit [bb09]pointer CastMagic_Noop-1; [9]: UNUSED: No-op [bb0b]pointer CastMagic_Unused_UpdateHitWallEffect-1; [10]: UNUSED: Hit Wall effect [bb0d]pointer CastMagic_UpdateTilteAfterFirstHit-1; [11]: Tilte magic after first hit
; ; XREFS: ; Sprite_CheckHitByCastMagic ;
[bb0f]CAST_MAGIC_HIT_HANDLERS:; [$bb0f] [bb0f]pointer CastMagic_HitHandler_Deluge-1; [0]: Deluge [bb11]pointer CastMagic_HitHandler_Thunder-1; [1]: Thunder [bb13]pointer CastMagic_HitHandler_Fire-1; [2]: Fire [bb15]pointer CastMagic_HitHandler_Death-1; [3]: Death [bb17]pointer CastMagic_HitHandler_Tilte-1; [4]: Tilte [bb19]pointer CastMagic_HitHandler_NoOp-1; [5]: Deluge after first hit [bb1b]pointer CastMagic_HitHandler_NoOp-1; [6]: Thunder after first hit [bb1d]pointer CastMagic_HitHandler_NoOp-1; [7]: Fire after first hit [bb1f]pointer CastMagic_HitHandler_NoOp-1; [8]: Death after first hit [bb21]pointer CastMagic_HitHandler_NoOp-1; [9]: UNUSED [bb23]pointer CastMagic_HitHandler_NoOp-1; [10]: UNUSED: Hit Wall effect [bb25]pointer 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] [bb27]pointer CastMagic_FinishHandler_Deluge-1; [0]: Deluge [bb29]pointer CastMagic_FinishHandler_Thunder-1; [1]: Thunder [bb2b]pointer CastMagic_FinishHandler_Fire-1; [2]: Fire [bb2d]pointer CastMagic_FinishHandler_Death-1; [3]: Death [bb2f]pointer CastMagic_FinishHandler_Tilte-1; [4]: Tilte [bb31]pointer CastMagic_FinishHandler_DelugeOrDeathAfterHit-1; [5]: Deluge after first hit [bb33]pointer CastMagic_FinishHandler_Thunder-1; [6]: Thunder after first hit [bb35]pointer CastMagic_FinishHandler_Fire-1; [7]: Fire after first hit [bb37]pointer CastMagic_FinishHandler_DelugeOrDeathAfterHit-1; [8]: Death after first hit [bb39]pointer CastMagic_Noop-1; [9]: UNUSED [bb3b]pointer CastMagic_FinishHandler_HitWallEffect-1; [10]: UNUSED: Hit Wall effect [bb3d]pointer 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] [bb3f]LDA #$ff [bb41]STA a:CastMagic_Type [bb44]RTS
;============================================================================ ; 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:; [$bb45]
; ; Update the position by X +/- 3 and check if the ; magic flew off-screen. ;
[bb45]LDA #$03 [bb47]STA a:Arg_DeltaX_Full; Set delta X block argument to 3. [bb4a]LDA #$00 [bb4c]STA a:Arg_DeltaX_Frac; Set delta X pixel argument to 0. [bb4f]JSR CastMagic_UpdateXPosition; Update position. [bb52]BCC @_checkCollision; If not off-screen, check for collision.
; ; It's off-screen. Clear the magic. ;
[bb54]JMP CastMagic_Clear; Clear the magic.
; ; Check if the magic is on a block other than air. ;
[bb57]@_checkCollision:; [$bb57] [bb57]LDA Blocks_Result; Check which block the magic is on. [bb59]BEQ @_return; If air, we're done.
; ; It hit a block. Play the sound effect. ;
[bb5b]LDA #$0a [bb5d]JSR 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]LDA #$ff [bb62]STA a:CastMagic_Type; Unset the cast magic spell. [bb65]LDA #$04 [bb67]STA a:CastMagic_Unused_HitWallDeltaPosY; Set the Hit Wall appearance offset. [bb6a]@_return:; [$bb6a] [bb6a]RTS
;============================================================================ ; 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] [bb6b]LDA #$ff [bb6d]STA a:CastMagic_Type; Unset the magic type. [bb70]LDA #$04 [bb72]STA a:CastMagic_Counter; Set the magic counter to 4.
; ; Update the X position of the cast magic to the sprite's ; x position. ;
[bb75]LDX a:CurrentSpriteIndex; X = current sprite index [bb78]LDA CurrentSprites_XPos_Full,X; A = current sprite X position. [bb7a]STA a:CastMagic_XPos_Full; Store as the X position. [bb7d]RTS
;============================================================================ ; 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:; [$bb7e]
; ; Update the position by X +/- 2 and check if the ; magic flew off-screen. ;
[bb7e]LDA #$02 [bb80]STA a:Arg_DeltaX_Full; Set the delta X position to check to 2. [bb83]LDA #$00 [bb85]STA a:Arg_DeltaX_Frac; Set the delta fractional X position to 0. [bb88]JSR CastMagic_UpdateXPosition; Update the X position and check if it stayed on-screen. [bb8b]BCC @_return; If still on-screen, jump.
; ; It's off-screen. Clear the magic. ;
[bb8d]JMP CastMagic_Clear; Clear the magic. [bb90]@_return:; [$bb90] [bb90]RTS
;============================================================================ ; 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] [bb91]LDA #$18 [bb93]STA a:CastMagic_Counter; Set the magic counter to 24. [bb96]LDA #$06 [bb98]STA a:CastMagic_Type; Set the magic type to the thunder explosion effect. [bb9b]RTS
;============================================================================ ; 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:; [$bb9c]
; ; Update X +/- 4 and check if the magic flew off-screen. ;
[bb9c]LDA #$04 [bb9e]STA a:Arg_DeltaX_Full; Full Delta X = 4 [bba1]LDA #$00 [bba3]STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bba6]JSR CastMagic_UpdateXPosition; Update the X position. [bba9]BCC @_checkCollision; If not off-screen, check for collision.
; ; It's off-screen. Clear the magic. ;
[bbab]JMP CastMagic_Clear; Clear the magic.
; ; Check if the magic is on a block other than air. ;
[bbae]@_checkCollision:; [$bbae] [bbae]LDA Blocks_Result; Check which block the magic is on. [bbb0]BEQ @_return; If air, we're done.
; ; It hit a block. Play the sound effect. ;
[bbb2]LDA #$0a [bbb4]JSR 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]LDA #$00 [bbb9]STA a:CastMagic_Unused_HitWallDeltaPosY; Set the Hit Wall appearance offset. [bbbc]LDA #$ff [bbbe]STA 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]LDA a:CastMagic_Flags; Load the magic's flags. [bbc4]AND #$40; Check the direction bit. [bbc6]LSR A; If set, divide by 8 (resulting in 16). [bbc7]LSR A [bbc8]ADC a:CastMagic_XPos_Full; Add to the current position. [bbcb]STA a:CastMagic_XPos_Full; And set it.
; ; Switch the direction of the spell. ;
[bbce]LDA a:CastMagic_Flags; Load the flags. [bbd1]AND #$7f; Clear the Attacking bit. [bbd3]EOR #$40; Toggle the Facing Right bit. [bbd5]STA a:CastMagic_Flags; Store it. [bbd8]@_return:; [$bbd8] [bbd8]RTS
;============================================================================ ; 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] [bbd9]LDA #$ff [bbdb]STA a:CastMagic_Counter; Set the counter to 0xFF. [bbde]LDA #$07 [bbe0]STA a:CastMagic_Type; Set the magic type to the post-hit handler. [bbe3]LDX a:CurrentSpriteIndex; X = Current sprite index. [bbe6]RTS
;============================================================================ ; 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] [bbe7]JMP 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] [bbea]LDA #$ff [bbec]STA a:CastMagic_Type; Set the magic type to 0xFF (unset). [bbef]RTS
; ; XREFS: ; CastMagic_UpdateTilte ;
[bbf0]CastMagic_ClearTilte:; [$bbf0] [bbf0]JMP 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:; [$bbf3]
; ; Update based on the phase of this magic. ;
[bbf3]LDA a:CastMagic_Phase; Check the phase. [bbf6]LSR A; Check bit 0 for even/odd. [bbf7]BCS @_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]LDA #$01 [bbfb]STA a:Arg_DeltaX_Full; Full Delta X = 1 [bbfe]LDA #$00 [bc00]STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bc03]JSR CastMagic_UpdateXPosition; Update position. [bc06]BCS CastMagic_ClearTilte; If off-screen, jump to clear.
; ; Calculate the next movement behavior. ;
[bc08]LDA a:CastMagic_Counter; Load the magic tick counter. [bc0b]LDY #$03; Y = 3 [bc0d]JSR Sprites_CalcYFromGravity; Calculate the movement behavior (delta Y). [bc10]LDY #$03; Y = 3 (count) [bc12]JSR Sprites_CalcVerticalSpriteMovement; Calculate vertical movement. [bc15]LDA #$00 [bc17]STA a:Arg_DeltaY_Full; Full Delta Y = 0 [bc1a]JSR CastMagic_UpdateYPosition; Update the Y position. [bc1d]BCS 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]LDA a:CastMagic_Counter; A = counter. [bc22]AND #$1f; Check against anything but 32, 64, or 128. [bc24]BNE @_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]LDA a:CastMagic_Flags; Load the magic flags. [bc29]EOR #$80; Toggle the Falling phase. [bc2b]STA a:CastMagic_Flags; Store the updated flags. [bc2e]BPL @_incAndReturn; If attacking is clear, jump to finish up.
; ; Switch to the missile phase. ;
[bc30]INC a:CastMagic_Phase; Increment the phase.
; ; Clear the falling flag, moving back up. ;
[bc33]LDA a:CastMagic_Flags; Load the magic flags. [bc36]AND #$7f; Clear attacking. [bc38]STA a:CastMagic_Flags; Store it. [bc3b]RTS [bc3c]@_incAndReturn:; [$bc3c] [bc3c]INC a:CastMagic_Counter; Increment the tick counter. [bc3f]RTS
; ; 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] [bc40]LDA #$04 [bc42]STA a:Arg_DeltaX_Full; Full Delta X = 4 [bc45]STA a:Arg_DeltaY_Full; Full Delta Y = 4 [bc48]LDA #$00 [bc4a]STA a:Arg_DeltaX_Frac; Fractional Delta X = 0 [bc4d]STA a:Arg_DeltaY_Frac; Fractional Delta Y = 0 [bc50]JSR CastMagic_UpdateXPosition; Update the X position. [bc53]BCS CastMagic_ClearTilte; If off-screen, jump to clear. [bc55]JSR CastMagic_UpdateYPosition; Update the Y position. [bc58]BCS CastMagic_ClearTilte; If off-screen, jump to clear. [bc5a]RTS
;============================================================================ ; 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] [bc5b]LDA #$00 [bc5d]STA a:CastMagic_Counter; Set the counter to 0. [bc60]LDA #$0b [bc62]STA a:CastMagic_Type; Set the type to the post-collision Tilte type. [bc65]RTS
;============================================================================ ; 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] [bc66]JSR CastMagic_UpdateDeluge; Run standard Deluge behavior. [bc69]DEC a:CastMagic_Counter; Decrement the tick counter. [bc6c]BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc6e]LDA #$ff [bc70]STA a:CastMagic_Type; Clear the active magic spell. [bc73]@_return:; [$bc73] [bc73]RTS
;============================================================================ ; 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] [bc74]JSR CastMagic_UpdateThunderOrDeath; Run standard Thunder behavior. [bc77]DEC a:CastMagic_Counter; Decrement the tick counter. [bc7a]BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc7c]LDA #$ff [bc7e]STA a:CastMagic_Type; Clear the active magic spell. [bc81]@_return:; [$bc81] [bc81]RTS
;============================================================================ ; 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] [bc82]JSR CastMagic_UpdateFire; Run standard Fire behavior. [bc85]DEC a:CastMagic_Counter; Decrement the tick counter. [bc88]BNE @_return; If > 0, return.
; ; The magic spell has dissipated. Clear it. ;
[bc8a]LDA #$ff [bc8c]STA a:CastMagic_Type; Clear the active magic spell. [bc8f]@_return:; [$bc8f] [bc8f]RTS
;============================================================================ ; 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] [bc90]LDA #$ff [bc92]STA a:CastMagic_Type; Clear the active magic spell. [bc95]RTS
;============================================================================ ; UNUSED ;============================================================================
[bc96]JMP 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] [bc99]LDA #$ff [bc9b]STA a:CastMagic_Type; Clear the active magic spell. [bc9e]RTS
;============================================================================ ; 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] [bc9f]INC a:CastMagic_Counter; Increment the tick counter. [bca2]LDA a:CastMagic_Counter; Load the counter value. [bca5]CMP #$10; Is it < 16? [bca7]BCC @_return; If so, return.
; ; The magic spell has dissipated. Clear it. ;
[bca9]LDA #$ff [bcab]STA a:CastMagic_Type; Clear the active magic spell. [bcae]@_return:; [$bcae] [bcae]RTS
;============================================================================ ; 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] [bcaf]LDA a:CastMagic_Flags; Load the magic's flags. [bcb2]AND #$40; Check the Facing Right bit. [bcb4]BNE @_isRight; If it's set, jump.
; ; The magic is moving left. ; ; Update the fractional X value based on the provided delta. ;
[bcb6]LDA a:CastMagic_XPos_Frac; Load the fractional X position. [bcb9]SEC [bcba]SBC a:Arg_DeltaX_Frac; Subtract the provided delta. [bcbd]STA a:CastMagic_XPos_Frac; Store it.
; ; Now update the full X position. ;
[bcc0]LDA a:CastMagic_XPos_Full; Load the full X position. [bcc3]SBC a:Arg_DeltaX_Full; Subtract the provided delta. [bcc6]STA a:CastMagic_XPos_Full; Store it.
; ; Check for collision/off-screen in the Left direction. ;
[bcc9]LDX #$00; 0 = Left [bccb]JSR CastMagic_CheckDirection; Check for collision/off-screen in the left direction. [bcce]LDA a:CastMagic_XPos_Full; Load the block X coordinate. [bcd1]CMP #$f0; Set C=0 if on-screen, 1 if off-screen (wrapped around). [bcd3]RTS
; ; The magic is moving right. ; ; Update the fractional X value based on the provided delta. ;
[bcd4]@_isRight:; [$bcd4] [bcd4]LDA a:CastMagic_XPos_Frac; Load the fractional X coordinate. [bcd7]CLC [bcd8]ADC a:Arg_DeltaX_Frac; Add the provided delta. [bcdb]STA a:CastMagic_XPos_Frac; Store it.
; ; Now update the full X position. ;
[bcde]LDA a:CastMagic_XPos_Full; Load the full X coordinate. [bce1]ADC a:Arg_DeltaX_Full; Add the delta. [bce4]STA a:CastMagic_XPos_Full; Store it.
; ; Check for collision/off-screen in the Right direction. ;
[bce7]LDX #$01; X = Right [bce9]JSR CastMagic_CheckDirection; Check for collision/off-screen in the right direction. [bcec]LDX a:CastMagic_Type; X = Magic type. [bcef]LDA a:CastMagic_XPos_Full; A = Full X position. [bcf2]CMP CAST_MAGIC_MAX_SCREEN_WIDTHS,X; Compare the X position to the off-screen X position, and set C as the result. [bcf5]RTS
; ; XREFS: ; CastMagic_UpdateXPosition ;
[bcf6]CAST_MAGIC_MAX_SCREEN_WIDTHS:; [$bcf6] [bcf6].byte $f0; [0]: [bcf7].byte $f0; [1]: [bcf8].byte $e0; [2]: [bcf9].byte $f0; [3]: [bcfa].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] [bcfb]LDA a:CastMagic_Flags; Load the magic's flags. [bcfe]BMI @_isMovingDown; If it's moving up, jump.
; ; The magic is moving upward. ; ; Update the fractional Y value based on the provided delta. ;
[bd00]LDA a:CastMagic_YPos_Frac; Load the fractional Y coordinate. [bd03]SEC [bd04]SBC a:Arg_DeltaY_Frac; Subtract the provided delta value. [bd07]STA a:CastMagic_YPos_Frac; Store as the new fractional Y coordinate.
; ; Now update the block Y value. ;
[bd0a]LDA a:CastMagic_YPos_Full; Load the block Y coordinate. [bd0d]SBC a:Arg_DeltaY_Full; Subtract the provided delta value. [bd10]STA a:CastMagic_YPos_Full; Store it.
; ; Check for collision/off-screen in the Up direction. ;
[bd13]LDX #$02; X = 2 (up) [bd15]JSR CastMagic_CheckDirection; Check for collision/off-screen in the up direction. [bd18]LDA a:CastMagic_YPos_Full; Load the block Y coordiante. [bd1b]CMP #$f0; Set C=0 if on-screen, 1 if off-screen. [bd1d]RTS
; ; The magic is moving downward. ; ; Update the fractional Y value based on the provided delta. ;
[bd1e]@_isMovingDown:; [$bd1e] [bd1e]LDA a:CastMagic_YPos_Frac; Load the fractional Y coordinate. [bd21]CLC [bd22]ADC a:Arg_DeltaY_Frac; Add the provided delta value. [bd25]STA a:CastMagic_YPos_Frac; Store as the new fractional Y coordinate.
; ; Now update the block Y value. ;
[bd28]LDA a:CastMagic_YPos_Full; Load the block Y coordinate. [bd2b]ADC a:Arg_DeltaY_Full; Subtract the provided delta value. [bd2e]STA a:CastMagic_YPos_Full; Store it.
; ; Check for collision/off-screen in the Up direction. ;
[bd31]LDA a:Arg_DeltaY_Frac; Load the provided fractional Y delta. [bd34]PHP; Push flags to the stack. [bd35]LDX #$03; X = 3 (down) [bd37]JSR CastMagic_CheckDirection; Check for collision/off-screen in the down direction. [bd3a]PLP; Pop flags from the stack. [bd3b]RTS
;============================================================================ ; 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] [bd3c]LDA a:CastMagic_XPos_Full; A = Magic X position [bd3f]STA Arg_PixelPosX; Store as the pixel position to check. [bd41]CMP #$f0; Is it on-screen? [bd43]BCC 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] [bd45]LDA #$01; A = 1 (true) [bd47]STA Blocks_Result; Set as the result. [bd49]RTS
;============================================================================ ; 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] [bd4a]LDY a:CastMagic_Type; Y = Magic type [bd4d]LDA a:CastMagic_XPos_Full; A = Block X position. [bd50]CLC [bd51]ADC CAST_MAGIC_WIDTHS,Y; Add a width based on the magic type. [bd54]STA Arg_PixelPosX; Store as the X argument. [bd56]BCS 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:; [$bd58]
; ; First, check if the block at middle Y position (at the ; previously-calculated X) is passable. ;
[bd58]LDA a:CastMagic_YPos_Full; A = Magic full Y position [bd5b]STA Arg_PixelPosY; Store as the Y argument. [bd5d]JSR Area_ConvertPixelsToBlockPos; Convert the pixels to a screen block lookup position. [bd60]JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd63]STA Blocks_Result; Set the tentative result accordingly. [bd65]BNE @_return; If not passable, return the result.
; ; The block was passable. Check the block at the bottom ; of the magic's bounding box. ;
[bd67]LDY a:CastMagic_Type; Load the magic type. [bd6a]LDA CAST_MAGIC_HEIGHTS,Y; Load the magic's height. [bd6d]CMP #$10; Is the height >= 16 (more than one block)? [bd6f]BCC @_checkTop; If so, jump. [bd71]TXA; A = X (block position). [bd72]CLC [bd73]ADC #$10; Add 16 (next block). [bd75]TAX; X = A (result) [bd76]JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd79]STA Blocks_Result; Store the tentative result. [bd7b]BNE @_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] [bd7d]LDA a:CastMagic_YPos_Full; Load the full Y position again. [bd80]AND #$0f; Keep the lower nibble. [bd82]BEQ @_return; If it's 0, return the existing result. [bd84]TXA; A = X (block position). [bd85]CLC [bd86]ADC #$10; Add 16 (next block). [bd88]TAX; X = A (result) [bd89]JSR ScreenBuffer_IsBlockImpassable; Check if the block is impassable. [bd8c]STA Blocks_Result; Store the result. [bd8e]@_return:; [$bd8e] [bd8e]RTS
;============================================================================ ; 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:; [$bd8f]
; ; See if we're checking magic moving left. ;
[bd8f]TXA; A = X (direction) [bd90]BEQ CastMagic_CheckDirection_Left; If moving left, jump to check.
; ; See if we're checking magic moving right. ;
[bd92]DEX; X-- (shift the Right direction into Left for comparison). [bd93]BEQ 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]DEX; X-- (shift Up into Left). [bd96]BEQ @_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] [bd98]LDA #$00; A = 0 (false result) [bd9a]STA Blocks_Result; Store as the result. [bd9c]RTS
; ; XREFS: ; CastMagic_CheckDirection_Right ;
[bd9d]CAST_MAGIC_WIDTHS:; [$bd9d] [bd9d].byte $0f; [0]: Deluge [bd9e].byte $0f; [1]: Thunder [bd9f].byte $1f; [2]: Fire [bda0].byte $0f; [3]: Death [bda1].byte $0f; [4]: Tilte [bda2].byte $0f; [5]: Deluge after hit [bda3].byte $0f; [6]: Thunder after hit [bda4].byte $1f; [7]: Fire after hit [bda5].byte $0f; [8]: Death after hit [bda6].byte $0f; [9]: Unknown [bda7].byte $0f; [10]: Hit Wall effect (unused) [bda8].byte $0f; [11]: Tilte after hit
; ; XREFS: ; CastMagic_CheckDirection_CheckImpassable ;
[bda9]CAST_MAGIC_HEIGHTS:; [$bda9] [bda9].byte $0f; [0]: Deluge [bdaa].byte $1f; [1]: Thunder [bdab].byte $0f; [2]: Fire [bdac].byte $0f; [3]: Death [bdad].byte $0f; [4]: Tilte [bdae].byte $0f; [5]: Deluge after hit [bdaf].byte $1f; [6]: Thunder after hit [bdb0].byte $0f; [7]: Fire after hit [bdb1].byte $0f; [8]: Death after hit [bdb2].byte $0f; [9]: Unknown [bdb3].byte $0f; [10]: Hit Wall effect (unused) [bdb4].byte $0f; [11]: Tilte after hit [bdb5]UNUSED_SPACE_PRG14:; [$bdb5] [bdb5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdb5] undefined [bdbd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdbd] undefined [bdc5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdc5] undefined [bdcd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdcd] undefined [bdd5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdd5] undefined [bddd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bddd] undefined [bde5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bde5] undefined [bded].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bded] undefined [bdf5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdf5] undefined [bdfd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bdfd] undefined [be05].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be05] undefined [be0d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be0d] undefined [be15].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be15] undefined [be1d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be1d] undefined [be25].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be25] undefined [be2d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be2d] undefined [be35].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be35] undefined [be3d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be3d] undefined [be45].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be45] undefined [be4d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be4d] undefined [be55].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be55] undefined [be5d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be5d] undefined [be65].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be65] undefined [be6d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be6d] undefined [be75].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be75] undefined [be7d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be7d] undefined [be85].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be85] undefined [be8d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be8d] undefined [be95].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be95] undefined [be9d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$be9d] undefined [bea5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bea5] undefined [bead].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bead] undefined [beb5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$beb5] undefined [bebd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bebd] undefined [bec5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bec5] undefined [becd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$becd] undefined [bed5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bed5] undefined [bedd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bedd] undefined [bee5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bee5] undefined [beed].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$beed] undefined [bef5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bef5] undefined [befd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$befd] undefined [bf05].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf05] undefined [bf0d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf0d] undefined [bf15].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf15] undefined [bf1d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf1d] undefined [bf25].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf25] undefined [bf2d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf2d] undefined [bf35].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf35] undefined [bf3d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf3d] undefined [bf45].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf45] undefined [bf4d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf4d] undefined [bf55].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf55] undefined [bf5d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf5d] undefined [bf65].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf65] undefined [bf6d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf6d] undefined [bf75].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf75] undefined [bf7d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf7d] undefined [bf85].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf85] undefined [bf8d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf8d] undefined [bf95].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf95] undefined [bf9d].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bf9d] undefined [bfa5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfa5] undefined [bfad].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfad] undefined [bfb5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfb5] undefined [bfbd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfbd] undefined [bfc5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfc5] undefined [bfcd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfcd] undefined [bfd5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfd5] undefined [bfdd].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfdd] undefined [bfe5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfe5] undefined [bfed].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bfed] undefined [bff5].byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff; [$bff5] undefined [bffd].byte $ff,$ff,$ff; [$bffd] undefined