Make Link unmovable while holding sword

View previous topic View next topic Go down

Make Link unmovable while holding sword

Post by Puzzledude on Mon 15 Jul 2013 - 8:17

It is altogether strange when Link holds his sword, to make a spin attack, and is still able to move. Not because of the movement by itself, but because he can still move up or down the stairs from bg1 to bg2, or from one floor to another.
 
Going up or down on any stairs while in this position is unnatural, so I was wandering how to make him stand still while holding his sword. It will also be a little more difficult to hit with this strong attack, which is also a good thing. One way of fixing this would be to simply find the movement speed of Link while holding the sword and put it to 0, because he seems to move slower, while holding the sword. But I'm having a hard time finding this.
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Conn on Mon 15 Jul 2013 - 19:05

Shouldn't be very hard...
value 7e0354 gets a 02 when the sword is charged, here you could hack in.

Edit:
But I guess this isn't even necessary...
involved in movement is the ram 7E/00f8
Normal: up=08, down=04, left=02, right=01, no movement=00
Charging: up=88, down=84, left=82, right=81, no movement=80

I guess freezing the movement value to 80 when charging will do the job Very Happy

Example how to make (traced by walking left):
$00/83D9 AD 19 42    LDA $4219  [$00:4219]   A:0200
$00/83DC 85 01       STA $01    [$00:0001]   A:0282

hack after the lda 4219 (joypad read) with a jsl to an unused place:

clc (clear carry)
sbc #$80 (substract 80)
bcs to lda 4219 (branch on carry set, means value lower than 0 after substraction - if e.g., normal movement 01,02,04,08: go back to game )
sbc  #$09 (substract 09) 
bcc to lda 4219 (branch on carry clear: security, if there is a movement having values greater than 88 (swimming?) go back to game, so freeze is only between 81 and 88)
lda #$80 (freeze)
sta $01
rtl (return)
;back to game
lda #$4219 (reload native joypad value if <80 or >88)
sta $01
rtl (return)

in hex:
18 e9 80 b0 09 e9 09 90 05 a9 80 85 01 6b ad 19 42 85 01 6b
avatar
Conn
Zelda God - Administrator
Zelda God - Administrator

Since : 2013-06-30

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Puzzledude on Tue 16 Jul 2013 - 6:39

I thank everyone for their help. Smile I will test this out and make all the changes inserted into a hex decode and ips patch, so everyone can use this if they so choose.
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Puzzledude on Wed 17 Jul 2013 - 6:40

Found it on 3E233 and 3E234, but this is also the speed for shallow water, long grass and the speed when holding a sprite above your head. I will probably leave this as in the original, since it has to many side effects.
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Conn on Wed 17 Jul 2013 - 7:40

Try my code for unheadered US:

patch:
http://bszelda.zeldalegends.net/stuff/Con/nomove.zip

Code:

org $0003d9
  jsr $89c2 ; jsr to 0x0009c2 (unused region)

org $0009c2

LDA $4219   ;  reload joypad opcode deleted for jsr
  CLC
  SBC #$80   ; exclude normal movement <80
  BCC $07    
  SBC #$0B ; exclude movement >8a
  BCS $03  
  LDA #$80  ; freeze if sword is charging             
  RTS                    
  LDA $4219  ; regain value if normal movement
  RTS        
avatar
Conn
Zelda God - Administrator
Zelda God - Administrator

Since : 2013-06-30

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Puzzledude on Wed 17 Jul 2013 - 8:21

It is working. Very Happy And Link can walk normally on heavy grass, shallow water and with sprite. I never thought it possible, since it is the very same speed for above, so difficult to exclude.
 
I guess LDA $4219 at the beginning fixes your previous code, I knew the actual org is at 0003D9, instead of 0083D9, the SBC code exclude all other movement, but in combination with LDA #$80 (freeze if sword is charging) excludes the movement with holding sword from heavy grass, shallow water, and sprite movement (since sword is not charged, but movement is the same). Makes sence now.

PS
Conn, your name will be in a lot of credits (since I know SePH already used the pot braking with sword ASM in PU, and I'll be using it also, and I know Spane will use it as well in PoC). So that's three games already.
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Conn on Wed 17 Jul 2013 - 9:00

Great, please take my asm with care, since I am no expert in writing those codes... rather use the patch Laughing 

btw: The "bcc 0b SBC #$0B ; exclude movement >8a" check is to exclude diagonal movement

I guess LDA $4219 at the beginning fixes your previous code
If you hijack the code you of course need to reenter the code overwritten with your jmp/jsl/jsr. Sorry, forgot about this...

I knew the actual org is at 0003D9, instead of 0083D9
Yeah this lorom/pc addressing issue :roll: 

Conn, your name will be in a lot of credits (since I know SePH already used the pot braking with sword ASM in PU, and I'll be using it also, and I know Spane will use it as well in PoC). So that's three games already.
haha* as told already - you can, but no need to credit me ^^
avatar
Conn
Zelda God - Administrator
Zelda God - Administrator

Since : 2013-06-30

Back to top Go down

Re: Make Link unmovable while holding sword

Post by Puzzledude on Wed 17 Jul 2013 - 9:41

Meanwhile I've made a hex compare. This is what the ips actually does.

No move (hex changes)

0003D9 (pointer)
AD 19 42 --> 20 C2 89


0009C2 (main code), old values were FF
AD 19 42 18 E9 80 90 07 E9 0B B0 03 A9 80 60 AD 19 42 60
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum