Banner
Views: 864,005,118
Time:
12 users online:  Anorakun, Cheolpeoduck, chickaDEE Magazine,  Deeke, Dobosco, HammerBrother, imamelia, LMPuny, MagmaMouse,  patcdr, S.U, Vellidragon - Guests: 54 - Bots: 71 Users: 47,835 (2,084 active)
Latest: InfiniD_
Tip: The first column of the palettes list is the transparency. Don't change it.Not logged in.
Walljump ASM problem
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Walljump ASM problem
Pages: « 1 »
I am modifying HuFlungDu's Walljump2.0 Patch for my hack to instate some checks to prevent wall-jumping in awkward situations such as when flying, holding items and swimming, and for the most part, I have everything working the way it should be. However, I am still pretty dang new to ASM, and I am having trouble making it so that when Mario has a cape, and is jumping (flying) with his arms open, he won't be able to wall jump. With my added code and labels, depending on where I position the code in the patch will result in whether he is always able to jump off the wall or if he can never jump off the wall. I am trying to insert code that says
Code
                LDA $19                                          ;check if has cape 
                CMP #$02
                BEQ noflyleft

                noflyleft:
                LDA $72                                          ;checks jumping image
                CMP #$12                                         ;checks if Mario's hands are open while jumping (flying)
                BEQ dontstoreleft

I, of course, have to add the check for if he has the cape, because otherwise he wouldn't be able to jump when running fast at all, and since running fast and jumping with a cape will make you fly, I am using that as opposed to an earlier method I used of disabling wall-jumping when the flight timer is in effect, because the flight timer is still active and counting back down even when you are not flying, which results in a period where you can't wall-jump.

Can anyone explain to me what is wrong with my added code? Am I approaching it incorrectly? I apologize if this should be in the requests, but I want to learn about what I am doing wrong, because having specific things explained and pointed out to me helps me to learn, whereas having it done entirely for me doesn't teach me anything. I am still learning ASM, but I am improving and intend on learning more of it, and I understand that requires work, but I just need to be able to visualize things to help me learn.

Here is the entire patch, with my additions for reference:
Code
; Wall Jumping Patch 2.0
; By: HuFlungDu


!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

macro RATS_start(id)
db "STAR"
dw RATS_Endcode<id>-RATS_Startcode<id> 
dw RATS_Endcode<id>-RATS_Startcode<id>^#$FFFF 
RATS_Startcode<id>: 
endmacro

macro RATS_end(id)
RATS_Endcode<id>: 
endmacro

lorom                   ;\ ROM is LoRom
header                  ;/ and has a header.
ORG $A21B               ;\ 
JSL StatusCode          ;| and jump to our code

ORG $138000                    ;| POINT TO FREE SPACE!!!
%RATS_start(0)

StatusCode:       
		LDA $13E0
		CMP #$3C
		BNE notreturn
		BRL return
		notreturn:
		LDA $77				;  |
		AND #$04	 				; Check if mario is on ground
		BNE dontstoreleft
                LDA $75                                         ; Check if Mario is swimming              
                BNE dontstoreleft
                LDA $140D                                        ; Check if Mario is spin jumping            
                BNE dontstoreleft        
                LDA $1470                                        ; Check if Mario is carrying an item
                CMP #$01
                BEQ dontstoreleft    
                LDA $7D                                          ;\ Check if mario is moving up
                CMP #$80                                         ;highest upward speed
                BCS dontstoreleft                                ;/ return if value is greater than 80
		LDA $77				;  |
		AND #$02	 				; Check if mario blocked from the left
		BEQ dontstoreleft 
 		LDA $19                                          ;check if has cape 
                CMP #$02                          ;compare to value
                BEQ noflyleft                      ;if equal, branch  to label
		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
 		noflyleft:
                LDA $72                                          ;checks jumping image
                CMP #$12                                         ;checks if it is flying
                BEQ dontstoreleft
		rightcheck:
		LDA $77						;\
		AND #$04	 				;/ Check if mario is on ground
		BNE dontstoreright
                LDA $75                                         ; Check if Mario is swimming              
                BNE dontstoreright      
                LDA $140D                                        ; Check if Mario is spin jumping            
                BNE dontstoreright 
                LDA $1470                                        ; Check if Mario is carrying an item
                CMP #$01
                BEQ dontstoreright   
                LDA $7D                                          ;\ Check if mario is moving up
                CMP #$80                                         ;highest upward speed
                BCS dontstoreright                                ;/ return if value is greater than 80
		LDA $77						;\
		AND #$01	 				;/ Check if mario blocked from the right
		BEQ dontstoreright
 		LDA $19                                          ;check if has cape 
                CMP #$02                        ;compare to value
                BEQ noflyright                  ;if equal, branch to label
		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
 		noflyright:
                LDA $72                                          ;checks jumping image
                CMP #$12                                         ;checks if it is flying
                BEQ dontstoreright
		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 #$24                               ;cancels running animation (disabled for testing)				;/
                ;LDA #$00                                ;Cancels running counter (disabled for testing)
		LDA #$80
		CMP $7D
		BCC endslide
		LDA $7D
		CMP #$20
		BCC slidefound
		LDA #$20
		STA $7D	
		slidefound:
                ;LDA #$0B                               ;cancels running animation (disabled for testing)
                ;STA $72                                ;reset jumping pose (disabled for testing)
		LDA #$0D
		STA $13E0
		LDA !freeram1
		BNE leftface
		LDA #$00
		STA $76
		RTS
		leftface:
		LDA #$01
		STA $76
		endslide:
		RTS
%RATS_end(0)
Check if $1407 is zero and skip the whole walljump routine if not.

--------------------
Is this the code I would use?:
Code
                LDA $1407                                       ;check for flying actions
                CMP #$00
                BNE dontstoreleft

If so, then that doesn't work either. I also forgot to mention that I am using the Raccoon patch, so I might have to run checks for other things, because it functions differently.

Basically I need to make a code that checks for if Mario has a cape, and if he does, then wall-jumping is disabled when his jumping frame is the flying frame (because he would be flying anyway), but my method of creating the labels that are activated when Mario has a cape and then checks if his jumping frame is the "flying" one doesn't seem to be working. I don't know what I am doing wrong either... I don't know if it's possible (and believe it isn't) to do something like:
Code
LDA $19
CMP #$02
LDA $72 ;checks jumping image
CMP #$12 ;checks if it is flying
BEQ dontstoreleft 
but if you can do something like that, then I am not sure how to do it.

I apologize if the solution is very simple, but I am still learning ASM...
Just FYI, I released a version of the patch for C3 that fixes all of those bugs you talked about. I'd recommend using that one, as it doesn't require messing with the ASM.

Anyway, if you really want to modify the other one, here's how I did it:

Code
LDA $7D		;upward yspeed
BPL Run
LDA $77		;touching ground or screen-side
BIT #$84
BEQ Run
LDA $14A5	;flight
ORA $140D	;spin-jump
ORA $1470	;carrying/p-baloon
ORA $187A	;yoshi
ORA $73		;ducking
ORA $74		;climbing
ORA $75		;swimming
BEQ Run


You'd probably want to put it in one of the sections of purple code, followed by an RTS and then the label Run:.

--------------------
Now with extra girl and extra hacker
Those aren't actually bugs, I just didn't want to force those on people so I didn't include them. In hindsight it may have been better to have released it with those, and then put in comments allowing you to disable them, but whatever.
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Walljump ASM problem

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy