;------------- ;Ground Pound ;------------- !Freespace = $608000 ;Freespace. !RAM = $0660 ;Pound Flag (Don't use $7Fxxxx) !FreezeMarioTimer = $0D ;Time to freeze Mario in the air !AirSFX = $43 ;SFX to play when starting the pound !PoundSFX = $37 ;SFX to play when hitting ground !GroundTimer = $60 ;Speed to fall to ground !Player = $01 ;Uncomment to only allow a single char use the ability 00 = Mario, 01 = Luigi ;!Unlock = $0DA1 ;An extra freeram address can be used as a flag that has to be set to unlock this ability !freeram1 = $0E85 ; Requires 4 empty RAM address !freeram2 = $0E86 ; Change these if you have another patch !freeram3 = $0E87 ; that uses these RAM addresses !freeram4 = $0E88 ; such as the YoshiFlutterJump patch !freeram5 = $0E89 ; Wall Jump Header LoROM org $829C09 db $20 ;Fix ground pound Y pos org $80F60A JML MarioDie org $80A21B JSL Routine org !Freespace|$800000 !CodeSize = Ending-Routine db "STAR" dw !CodeSize-1 dw !CodeSize-1^-1 Routine: JSR CodeA JML CodeB CodeA: LDA $74 ;If you climb... ;ORA $73 ;or duck ORA $75 ;or swim ORA $13D4 ;or if game paused ORA $1470 ;or holding something ORA $187A ;or go on Yoshi ORA $1493 ;or are beating the level ;ORA $0DB3 ;uncomment this to only allow Mario to ground pound. Don't use this with the "LDA $0DB3" above at the same time. BNE Clear ;Don't ground pound LDA $71 ;If player's state is CMP #$09 ;dead BEQ Clear ;stop ground pound ;LDA !Unlock ;free ram address has to be set ;BEQ Clear ;to use this ability, if you reset it stops LDA $0DB3 ;Uncomment this to only let Luigi ground pound and comment out the "ORA $0DB3" above BEQ Clear ;Only allow LUIGI to ground pound. Don't use this with the "ORA $0DB3" above at the same time. ;LDA $19 ;Only pound if you're big Mario ;CMP #$01 ; ;BNE Clear ;stop the pound from executing even if it's already started LDA $77 ;If Mario's on the ground AND #$04 ; BNE CheckStomp ;See whether or not we're pounding or not LDA !RAM ;Check for the pound flag -Remove the "Almost" to allow ground pound to stay even if you bounce off a sprite (explained in slightly more detail below) BNE AlmostReturn ;If the RAM is already set, skip (to prevent multiple button presses) ;LDA $7D ;If you're falling but not ground pounding, ;BPL Return ;dissallow starting ground pound LDA $18 ;This routine only allows ground pound BIT #$80 ;if you press "A" (spin jump button) BEQ Return ;Change to $16 for both A/B ;The thing below is an alternative way to activate ground pounding ;BIT $18 ;Only works if you press the X button (Change to $16 for both X/Y) ;BVC Return ;Code below runs once after starting the pound LDA #!AirSFX ;Set sound when pound activated STA $1DFC ;You might change this line in some cases. There's another one below STZ $7D ;Temporarily freeze X/Yspeeds STZ $7B ; LDA #!FreezeMarioTimer ;Stun player STA $18BD ;For a defined period of time. LDA #$01 ; STA $140D ;Set spin jump flag... ;LDA #$20 ;Mario palette ;STA $149B ;color cycle (unneeded) LDA #!GroundTimer ; STA $7D ;Set falling speed LDA #$01 ;And set the pound flag on STA !RAM ; BRA Return ; CheckStomp: LDA !RAM ;If the flag is not set BEQ Return ;skip the actual pound CMP #$FF ; BEQ Clear ;Clear flag (for the custom pound block) LDA $77 ;Skip if in air again AND #$04 ; BEQ Return ; LDA #!PoundSFX ;Perform STA $1DFC ;the JSL $8286BF ;pound Clear: ;Stop ground pound STZ !RAM ; Return: ; LDA $16 ;Part of the AND #$10 ;Hijacked code. RTL ; AlmostReturn: ;This code only runs if the pound flag is set, it'll run every frame while it's set LDA $1490 ;Star thing routine thing here BNE .skipstar LDA #$02 STA $1490 .skipstar LDA $7D ;Mario's Yspeed BMI .GoingUp ;If you're moving upwards stop the pound ability STZ $7B ;No X movement while smashing downwards (to smash perfectly straight down) -without this you can move sideways a little bit ;LDA #!GroundTimer ;Set falling speed ;STA $7D ;continuously BRA Return ;else continue like normal .GoingUp ; BRA Clear ; MarioDie: ;If you die, end the pounding STZ !RAM ; STZ $149B ;Stop color cycle just incase LDA #$09 ;Code STA $1DFB ;Restoration JML $80F60F ; CodeB: LDA $13E0 CMP #$3C BNE notreturn BRL return notreturn: LDA $77 ; | AND #$04 ; Check if mario is on ground BNE dontstoreleft LDA $77 ; | AND #$02 ; Check if mario blocked from the left BEQ dontstoreleft LDA #$01 ; tell the game you can jump off the left wall STA !freeram1 LDA #$05 STA !freeram5 dontstoreleft: LDA $15 ;\ check if left is pressed AND #$02 ;/ BNE rightcheck JSR Slide ;comment this out if you dont want mario to slide down walls LDA $16 ;\ check if either B or A is pressed AND #$80 ; | BEQ rightcheck ;/ if neither, return LDA $18 ;\ check if it's B that's pressed AND #$80 ; |if A, not B, BNE rightcheck ;/ return JSR Jumpright BRA reset rightcheck: LDA $77 ;\ AND #$04 ;/ Check if mario is on ground BNE dontstoreright LDA $77 ;\ AND #$01 ;/ Check if mario blocked from the right BEQ dontstoreright LDA #$01 ; tell the game you can jump off the right wall STA !freeram2 LDA #$05 STA !freeram5 dontstoreright: LDA $15 ; this will basically just skip everything if you didn't AND #$01 ; get blocked BNE reset JSR Slide ;comment this out if you dont want mario to slide down walls LDA $16 ;\ check if either B or A is pressed AND #$80 ; | BEQ reset ;/ if neither, return LDA $18 ;\ check if it's B that's pressed AND #$80 ; |if A, not B, BNE reset ;/ return JSR Jumpleft reset: LDA !freeram1 ;\ used to remove a bug that I found BEQ right ;| where you could jump in mid air LDA $15 ;| if you timed it correctly AND #$01 ;| BEQ right ;| STZ !freeram1 ;| right: ;| LDA !freeram2 ;| BEQ reset1 ;| LDA $15 ;| AND #$02 ;| BEQ reset1 ;| STZ !freeram2 ;/ reset1: LDA $77 ; | AND #$04 ; Check if mario is on ground BEQ return ; reset all the flags STZ !freeram1 STZ !freeram2 STZ !freeram3 STZ !freeram4 return: LDA !freeram5 BEQ NotDEC DEC !freeram5 BRA DECD NotDEC: STZ !freeram1 STZ !freeram2 DECD: LDA $16 AND #$10 RTL Jumpleft: LDA !freeram3 ;\ put a semicolon before these two lines if you BNE end1 ;/ want mario to be able to jump off the same wall twice LDA !freeram1 BEQ end1 LDA #$B0 ;\ Make mario jump STA $7D ;/ LDA #$0D ;\change pose for split second STA $13E0 ;/ LDA #$30 ;\ Make him move left STA $7B ;/ LDA #$02 ;\Play sound effect (spin jumping off enemy) STA $1DF9 ;/ JSL $01AB99 ;spawn Spin Jumping off spiked enemy sprite LDA #$01 ;\ tell the game that you just jumped off the left wall STA !freeram3 ;| and are ready for the right STZ !freeram4 ;/ STZ !freeram2 STZ !freeram1 end1: RTS Jumpright: LDA !freeram4 ;\ put a semicolon before these two lines if you BNE end ;/ want mario to be able to jump off the same wall twice LDA !freeram2 BEQ end LDA #$B0 ;\ Make mario jump STA $7D ;/ LDA #$0D ;\change pose for split second STA $13E0 ;/ LDA #$CF ;\ Make him move right STA $7B ;/ LDA #$02 ;\Play sound effect (spin jumping off enemy) STA $1DF9 ;/ JSL $01AB99 ; spawn Spin Jumping off spiked enemy sprite LDA #$01 ;\ tell the game that you just jumped off the right wall STA !freeram4 ;| and are ready for the left STZ !freeram3 ;/ STZ !freeram1 STZ !freeram2 end: RTS Slide: LDA !freeram1 BNE slide LDA !freeram2 BEQ endslide slide: LDA #$80 CMP $7D BCC endslide LDA $7D CMP #$20 BCC slidefound LDA #$20 STA $7D slidefound: LDA #$0D STA $13E0 LDA !freeram1 BNE leftface LDA #$00 STA $76 RTS leftface: LDA #$01 STA $76 endslide: RTS Ending: