Users browsing this thread: 1 Guest(s)
Edit Chainsaw codes

#21
Posts: 275
Threads: 19
Thanks Received: 13
Thanks Given: 48
Joined: Dec 2017
Reputation: 2
Status
None
(03-08-2021, 02:39 AM)Lightning Wrote:
(03-08-2021, 02:06 AM)assassin Wrote: looks like the code posted in this thread is missing the edit to the C2/3DCD Special Effect Pointer table:

Code:
C2/3E6B: 8C 38
==>
Code:
C2/3E6B: 3B 2B

That seems to fix it! You actually pointed to the Scimitar slice effect instead of the normal chainsaw death - but I actually like it far better.  It makes more sense to have a monster sliced up after being attacked by a chainsaw...

To advance this topic about the Scimitar slice / X-kill death, can someone tell me how to revert the special effect back to the normal chainsaw death? I tried to find a table with the normal death effect, but could not. Thanks.
  Find
Quote  

#22
Posts: 180
Threads: 1
Thanks Received: 68
Thanks Given: 20
Joined: Oct 2015
Reputation: 18
Status
None
because X-Kill/Scimitar writes an additional entry to the animation buffers, it will be tricky.  with this being done at the END of that function, a caller can't readily skip it.  instead, you'll probably have to undo it.

i'm thinking you'll need to:
1) null out the buffer data that makes the game think there's another animation to depict.  i'm not sure what's required, but suspect that:
a. for the 4-byte $76 buffer, one step is to "null" (set to Mimic, 12h) the equivalent of $B5.  another is to FFh-null $B7.  do with "LDA #$12 / STA $B5 / LDA #$FF / STA $B7 / JSR $35BB" or "LDA #$12 / STA $2D77 / LDA #$FF / STA $2D79".
b. for the 16-byte $78 buffer, make use of a preexisting function to clear it: "JSR $6400 / JSR $63DB".
2) subtract 4 from $3A72, the ($76) buffer pointer, so as to "free" the no longer used entry.
3) subtract 16 from $3A32, the ($78) buffer pointer, so as to "free" the no longer used entry.

EDIT: err, i think you'll need to do Step 3 before 1b so it edits the proper buffer entry.  that is:
Step 1a
Step 2
Step 3
Step 1b
Step 3 again

now, it's possible that some steps, in particular, #2 and the repeat of #3, are unnecessary albeit logical.  you might be able to get away with just the $B5-related revision, and maybe zeroing $A2 - $A5 then doing a $63DB call.

[EDIT 2:] i just was reminded that the second ($78) buffer write occurs AFTER the special effect finishes running.  so we can't undo something that hasn't happened yet; nor can we prevent it!  this means that we DON'T want nor need to do Step 3 before Step 1b.  and it makes Step 3 in general fraught with trouble.  it'd be nice to have that buffer's $3A32 pointer end 16 bytes earlier, now that no 2nd entry needs to be written or read.  however, the only way i'm seeing to do that is to perform Step 3, then trust that the upcoming jump from C2/3480 to C2/63DB writes the $AN variables we wanted for the first entry.  it probably will, as nothing meaningfully modifies them between the end of C2/388D and C2/3480.  however, one potential issue i see involves my "Reflect barrier shown on bodyguards fix".  it overwrites $A6-$A7, so in the off-chance you hacked Chainsaw to allow True Knight, it wouldn't have the bodyguard(s) display correctly.

if shortening the buffers is concluded as infeasible or unnecessary, then i'd settle for calling C2/6400 to zero out $A0-$AF in anticipation of said second execution of C2/63DB.[/EDIT 2]

oh, AAAND you likely also want to revert the marking of Hide done at C2/38E4 - C2/38EB.

...... motherfucker, the list just keeps piling up!!  depending on how much undoing is actually required, an epiphany i just had could apply:

copy+paste the portions of C2/388D that you actually want to keep. Tongue

that is, C2/3891 thru 3897, C2/389F thru 38AA, and C2/38CA thru 38D3 (with me being unsure on inclusion of "STZ $341D'').
Quote  

#23
Posts: 275
Threads: 19
Thanks Received: 13
Thanks Given: 48
Joined: Dec 2017
Reputation: 2
Status
None
(04-09-2021, 05:59 PM)assassin Wrote: because X-Kill/Scimitar writes an additional entry to the animation buffers, it will be tricky.  with this being done at the END of that function, a caller can't readily skip it.  instead, you'll probably have to undo it.

i'm thinking you'll need to:
1) null out the buffer data that makes the game think there's another animation to depict.  i'm not sure what's required, but suspect that:
a. for the 4-byte $76 buffer, one step is to "null" (set to Mimic, 12h) the equivalent of $B5.  another is to FFh-null $B7.  do with "LDA #$12 / STA $B5 / LDA #$FF / STA $B7 / JSR $35BB" or "LDA #$12 / STA $2D77 / LDA #$FF / STA $2D79".
b. for the 16-byte $78 buffer, make use of a preexisting function to clear it: "JSR $6400 / JSR $63DB".
2) subtract 4 from $3A72, the ($76) buffer pointer, so as to "free" the no longer used entry.
3) subtract 16 from $3A32, the ($78) buffer pointer, so as to "free" the no longer used entry.

EDIT: err, i think you'll need to do Step 3 before 1b so it edits the proper buffer entry.  that is:
Step 1a
Step 2
Step 3
Step 1b
Step 3 again

now, it's possible that some steps, in particular, #2 and the repeat of #3, are unnecessary albeit logical.  you might be able to get away with just the $B5-related revision, and maybe zeroing $A2 - $A5 then doing a $63DB call.

oh, AAAND you likely also want to revert the marking of Hide done at C2/38E4 - C2/38EB.

...... motherfucker, the list just keeps piling up!!  depending on how much undoing is actually required, an epiphany i just had could apply:

copy+paste the portions of C2/388D that you actually want to keep. Tongue

that is, C2/3891 thru 3897, C2/389F thru 38AA, and C2/38CA thru 38D3 (with me being unsure on inclusion of "STZ $341D'').

Maybe I am not understanding your post correctly, but I don't see this patch modifying those locations (like C2/3891 through 3897, etc.)  If it isn't too much to ask, can you possibly update the original code by Warrax? To reiterate, I am just looking to have the Chainsaw perform the instant death move the way it used to with the default death animation, but retaining the other parts of the patch. That is, not performing an instant death move to monsters immune to death.

original code posted by warrax:


Code:
C2/2B24: 35 2B (New Drill pointer, this line must be changed)

C2/2B30: A99E LDA #$9E
C2/2B32: 8DA911 STA $11A9 (Use effect 4F)
C2/2B35: A920 LDA #$20
C2/2B37: 0CA211 TSB $11A2 (Set ignore defense)
C2/2B3A: 60 RTS
C2/2B3B: 208D38 JSR $388D (Use “Slice” subroutine)
C2/2B3E: A5B5 LDA $B5
C2/2B40: C902 CMP #$02
C2/2B42: D005 BNE $2B49 (Check for command == “Magic”)
C2/2B44: A908 LDA #$08
C2/2B46: 8D742D STA $2D74 (Set animation to “kill mode”)
C2/2B49: 60 RTS

C2/2B4A: EAEAEA
C2/2B4D: EAEAEA
C2/2B50: EAEAEA
  Find
Quote  

#24
Posts: 180
Threads: 1
Thanks Received: 68
Thanks Given: 20
Joined: Oct 2015
Reputation: 18
Status
None
i was saying to copy+paste portions of Function C2/388D, not edit any of it.

that is, you'd duplicate some of that function in C2/2B3B as opposed to calling it.  the reasoning there was that the Scimitar/X-Kill routine does too much that we don't want (the dice-up animation, writing additional entries to two animation buffers in the process, and setting Hide on the target).  writing code to roll back all this crap got big in a hurry.  and running the full C2/388D then undoing like 40% of it is a lot slower (albeit probably not consequentially) than simply performing a subset of its steps.

but as i mentioned, the wastefulness depends on how much undoing is actually required.  so let's start with a small subset of the rollbacks, and see how it works.

add the following to Function C2/2B3B:

Code:
LDA #$12
STA $2D77      (replace $B5 in the 3rd entry of the ($76) buffer with
                12h, the Mimic command, which acts as Null.  the goal
                is to overwrite the Magic command animation that
                performs the dice-up.)
JMP extra

[...]

(somewhere in free space:)

extra:
LDA $3DE9,Y
AND #$DF
STA $3DE9,Y    (remove Hide from Status to Set)
RTS
Quote  

#25
Posts: 275
Threads: 19
Thanks Received: 13
Thanks Given: 48
Joined: Dec 2017
Reputation: 2
Status
None
(04-09-2021, 10:08 PM)assassin Wrote: i was saying to copy+paste portions of Function C2/388D, not edit any of it.

that is, you'd duplicate some of that function in C2/2B3B as opposed to calling it.  the reasoning there was that the Scimitar/X-Kill routine does too much that we don't want (the dice-up animation, writing additional entries to two animation buffers in the process, and setting Hide on the target).  writing code to roll back all this crap got big in a hurry.  and running the full C2/388D then undoing like 40% of it is a lot slower (albeit probably not consequentially) than simply performing a subset of its steps.

but as i mentioned, the wastefulness depends on how much undoing is actually required.  so let's start with a small subset of the rollbacks, and see how it works.

add the following to Function C2/2B3B:

Code:
LDA #$12
STA $2D77      (replace $B5 in the 3rd entry of the ($76) buffer with
                12h, the Mimic command, which acts as Null.  the goal
                is to overwrite the Magic command animation that
                performs the dice-up.)
JMP extra

[...]

(somewhere in free space:)

extra:
LDA $3DE9,Y
AND #$DF
STA $3DE9,Y    (remove Hide from Status to Set)
RTS

So maybe now I am understanding a little better - but does this mean the original patch actually worked by using the Scimitar/X-kill death animation?  I thought this was just a fun optional feature to change the death animation to the slice effect, but if I am understanding correctly, the patch actually functions by using this effect to check for instant death status, etc..  I also don't understand ASM code much beyond just applying it to my hack. Assassin, do you have discord? I could probably resolve this in a 5-minute chat as opposed to going back and forth and making you type more explanations on here! Coding is my kryptonite, after all.
  Find
Quote  

#26
Posts: 180
Threads: 1
Thanks Received: 68
Thanks Given: 20
Joined: Oct 2015
Reputation: 18
Status
None
Lightning Wrote:So maybe now I am understanding a little better - but does this mean the original patch actually worked by using the Scimitar/X-kill death animation?  I thought this was just a fun optional feature to change the death animation to the slice effect, but if I am understanding correctly, the patch actually functions by using this effect to check for instant death status, etc..

yes on both counts.

no discord here.

to be specific on the code addition, you want to put it at C2/2B49, move the RTS there to C2/2B52, and lengthen the BNE to "D0 0E".
Quote  

#27
Posts: 51
Threads: 5
Thanks Received: 33
Thanks Given: 0
Joined: Jun 2010
Reputation: 6
Status
None
Nevermind
Quote  

#28
Posts: 275
Threads: 19
Thanks Received: 13
Thanks Given: 48
Joined: Dec 2017
Reputation: 2
Status
None
Thanks for helping me Assassin, but I decided to take a different approach to this. It's more work, but I am going to modify all monster scripts that counter all attacks AND that are not immune to instant death to exclude tools from a counter attack. There really aren't that many monsters that fit this description. I think I can at least cut the chances of seeing this bug to a minimum. After all, I do actually like the slice effect with the Chainsaw!
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite