;Act as $130 !TopLft = $0502 ;\Four tiles changed when block is hit. !TopRgt = $0503 ;| !BotLft = $0512 ;| !BotRgt = $0513 ;/ db $42 JMP MarioBelow : JMP MarioAbove : JMP MarioSide JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball JMP TopCorner : JMP BodyInside : JMP HeadInside ;====================================================================== MarioCape: REP #$20 ;\So that the sprite release ALWAYS LDA $98 ;|spawns center top of the block and AND #$FFF0 ;|not move in relation of player's collision point STA $98 ;| LDA $9A ;| AND #$FFF0 ;| STA $9A ;| SEP #$20 ;| JSR MainTrigger ;/ RTL ;====================================================================== SpriteH: SpriteHit: .CheckSprite %check_sprite_kicked_horizontal() ;\If sprite does not hit block hard enough, BCC Return ;/return. LDA $0F ;\Prevent sprite from moving sideways PHA ;/ PHX ;>Protect sprite index %sprite_block_position() ;>Set position to sprite's contact. JSR MainTrigger PLX ;>Restore sprite index PLA ;\Restore the sideways thing. STA $0F ;/ SpriteV: MarioFireball: MarioBelow: MarioAbove: MarioSide: TopCorner: BodyInside: HeadInside: Return: RTL ;====================================================================== MainTrigger: PHY ;>Save block behavor .ChangeTile REP #$10 ;\Change top-left LDX.w #!TopLft ;| %change_map16() ;| SEP #$10 ;/ REP #$30 ;>16-bit AXY LDY #$0004 ;>Start loop (the other 3 blocks) ..M16ChangeLoop PHP ;>Save processor flag SEP #$30 ;>8-bit AXY (this swap is 8-bit) JSR SwapXYHigh ;>Vertical level have high bytes switched. PLP ;>Restore processor flag LDA $98 ;\Adjust Y pos for next tile CLC ;| ADC YPosShft,y ;| STA $98 ;/ LDA $9A ;\Adjust X pos for next tile CLC ;| ADC XPosShft,y ;| STA $9A ;/ PHY ;>Protect index LDX M16Tbl,y ;\Set current tile %change_map16() ;/ PLY ;>restore index DEY ;\Go down 2 bytes since each DEY ;/slot has 2 bytes. BPL ..M16ChangeLoop ;.LoopDone SEP #$30 PLY ;>Restore block behavor .Effects JSR SwapXYHigh REP #$20 ;\Adjust position for spawning LDA $9A ;|an item sprite CLC ;| ADC #$0008 ;| STA $9A ;| LDA $98 ;| CLC ;| ADC #$FFF0 ;| STA $98 ;| SEP #$20 ;/ ;See $02887D for what item sprite. LDA #$01 ;\>Change this number to what item sprite it spawns. STA $05 ;|Spawn item sprite LDA #$0F ;|(without centering with 16x16 grid, center PHB ;|with the 32x32 block instead, unlike gps's). LDA #$82 ;| PHA ;| PLB ;| JSL $82887D ;| PLB ;/ RTS ;====================================================================== SwapXYHigh: LDA $5B ;\Check if vertical level = true AND #$01 ;| BEQ + ;/ PHY LDA $99 ;\Fix the $99 and $9B from glitching up if placed LDY $9B ;|other than top-left subscreen boundaries of vertical STY $99 ;|levels!!!!! (barrowed from the map16 change routine of GPS). STA $9B ;|(this switch values $99 <-> $9B, since the subscreen boundaries are sideways). PLY ;| + ;/ RTS XPosShft: dw $FFF0,$0000,$0010 YPosShft: dw $0000,$0010,$0000 M16Tbl: dw !BotLft,!BotRgt,!TopRgt