;; Mario Kart thing! cool. ;; Collecting coins increases Mario's max speed. Some options for handling that are below. !coinTick = $01 ; how many coins you need to collect to increase your max speed by 1. !minSpeed = $25 ; starting speed for mario. SMW's default is 25 (37 in dec). !maxSpeed = $72 ; maximum speed to accelerate to. recommended max is 72; more causes issues with going left. !disableP = 0 ; change to 1 if you want Mario's p-meter disabled. !coinRAM = $60 ; two bytes of free RAM to keep track of coins collected in the level; clear on overworld load. !freeData = $00CC86 ; where to stick 32 bytes in bank $00 for jump speeds. I was lazy. org $00D744 autoclean JML newMax org $008F25 JSL increaseCoinRAM NOP #2 org $00D663 LDA jumpSpeeds,x ; fix the "no-jump" glitch with X speeds >#$40 org !freeData jumpSpeeds: db $B0,$B6,$AE,$B4,$AB,$B2,$A9,$B0 ; #$00-#$1F db $A6,$AE,$A4,$AB,$A1,$A9,$9F,$A6 ; #$20-#$3F db $9C,$A4,$9A,$A1,$97,$9F,$95,$9C ; #$40-#$6F db $92,$9A,$90,$97,$8D,$95,$8B,$92 ; #$60-#$7F freecode ;; Modify Mario's default max speed. newMax: BMI + ; this is messy af but idk if there's a better way to do it without rewriting a lot more code SEC SBC !coinRAM CLC ADC #!minSpeed-$25 BRA ++ + CLC ADC !coinRAM SEC SBC #!minSpeed-$25 ++ SEC SBC $D535,Y BEQ Return00D76B STA $00 LDA $D535,Y BPL + SEC SBC !coinRAM CLC ADC #!minSpeed-$25 BRA ++ + CLC ADC !coinRAM SEC SBC #!minSpeed-$25 ++ EOR $00 BPL Return00D76B JML $00D74F ; return speed Return00D76B: JML $00D76B ; return max speed ;; Use coins to determine how much to modify by. increaseCoinRAM: LDA $60 CMP #(!maxSpeed-$2A-!minSpeed) BCS + INC !coinRAM+1 LDA !coinRAM+1 CMP #!coinTick BNE + STZ !coinRAM+1 INC !coinRAM + INC.w $0DBF LDA.w $0DBF RTL org $00D97C if !disableP NOP #3 else STA $13E4 endif