HiGravity

by tjb0607

Game: SMW

Description: High Gravity by tjb

; Custom gravity uberasm by tjb, v2.0
; Changes mario's gravity to a configurable amount.
; By default, sets the gravity to 2/3 of the vanilla gravity.

; == WARNING ==
; Uses freeram. This could conflict with another ASM you have applied and break both.
; If this happens, just change the !FreeRAM address below to another address found here:
; https://www.smwcentral.net/?p=memorymap&game=smw&region[]=ram&type=Empty&description=level
; (copy/paste the last four digits to replace 188E)
; =============

; == SETTINGS ==
;!FreeRAM = $188E|!addr  ; 1 byte of freeram, cleared on level load
!FreeRAM = !carl_initialized ; for uberasm use, delete this line and uncomment the above line.
!Gravity_Slowfall = 5   ; Gravity while holding jump (vanilla gravity is 3)
!Gravity_Fastfall = 10   ; Gravity after letting go of jump (vanilla gravity is 6)
; ==============

!Adjustment_Slowfall = #$00+!Gravity_Slowfall-3
!Adjustment_Fastfall = #$00+!Gravity_Fastfall-6

main:
    LDA $7D
    PHA
    SEC
    SBC !FreeRAM
    CMP #$03                ; compares last frame's y-speed to this frame's y-speed
    BEQ .adjustSlowfall     ; to see if gravity was applied
    CMP #$06
    BEQ .adjustFastfall
    PLA
.done:
    STA !FreeRAM
    RTL

.adjustSlowfall:
    PLA
    CLC
    ADC.b !Adjustment_Slowfall
    STA $7D
    BRA .done

.adjustFastfall:
    PLA
    CLC
    ADC.b !Adjustment_Fastfall
    STA $7D
    BRA .done
back to listings