Users browsing this thread: 1 Guest(s)
Possible solution to the sap death bug

#13
Posts: 16
Threads: 3
Thanks Received: 0
Thanks Given: 0
Joined: May 2019
Reputation: 2
Status
None
(01-21-2021, 01:59 PM)C-Dude Wrote: It was only the code changes in the first post.  I'll try both his first and second post and get back to you.
I just checked the patch list and yeah, it's the successor patch by Leetsketcher.  I want to try both of Bropedio's code blocks before I try to roll that back, though.


EDIT: Tried it with the code from the second post.  In-line version crashed, which means it's definitely fighting another patch (and not a problem with this patch itself).  Freespace version 'worked' in that it didn't cause any problems, but it had the same issue Bropedio's first segment did (HP level triggers were not activating).  Removing Leetsketcher's Item/Magic counter code did not resolve that issue, and neither did removing Imzogelmo's 5 byte fix to the crackboom-sap bug (which I also had applied; found it in my notes).
Imzo's code doesn't so much 'fix' the animation as it does guarantee an on-death script occurs... which is really weird when sap triggers it because an empty space will quake and disintegrate.

Anyway, sorry I couldn't be more helpful; I'm not sure anything from my experience is useful.

Thanks for giving the code a try, C-Dude -- sorry it didn't work out. I'm not sure what subtle collisions may be happening, but I did make a subsequent change to the second patch before adding it to the pending Brave New World beta. Testers have not reported any issues so far, but it's very possible that other changes in BNW may be masking side effects of my patch. Particularly, the nATB patch in BNW pauses time while animations play out, so it inadvertently resolves many of the queue issues that could arise.

In any case, my updated code is here:

Code:
org $C24BFD
DeathCounterFix:
 TRB $3A56        ; clear "entity died since last 1F"
 BNE .has_died    ; allow script if has died
 TRB $33FC        ; clear "no 1F this batch"
 BEQ .skip_it     ; bypass script if already run
org $C24C28
.has_died
 TRB $33FC        ; clear "no 1F this batch" if died override
org $C24C52
.skip_it

org $C24C68
RewritePrepare:
 STZ $B8            ; zero targets for counterattack
 STZ $B9            ; zero targets for counterattack
 LDA $B1            ; check for "normal" attack
 LSR                ; carry: "non-normal" attack
 BCS .skip          ; branch if ^
 LDA $32E0,X        ; "hit by attack"
 BPL .skip          ; branch if not ^
 ASL                ; get attacker index
 STA $EE            ; save in scratch RAM
 CPX $EE            ; target === attacker?
 BEQ .skip          ; branch if ^
 TAY                ; attacker index
 REP #$20           ; 16-bit A
 LDA $3018,Y        ; attacker unique bit
 STA $B8            ; save target for counterattack
 LDA $3018,X        ; current target bit
 TRB $33FE          ; flag to use full reactive script
.skip
 REP #$20           ; 16-bit A
 LDA $3018,X        ; current target bit
 BIT $3A56          ; "died since last reactive script"
 SEP #$20           ; 8-bit A
 BNE .react         ; branch if "died", so force script
 LDA $B8            ; else, check if was attacked by normal
 ORA $B9            ; ^
 BEQ .next          ; no counterattack if not ^
 LDA $32CD,X        ; entry point to counterattack queue
 BPL .retort        ; branch if already something queued
.react
 LDA $3269,X        ; top byte of reactive script pointer
 BMI .retort        ; branch if null ^
warnpc $C24CA8
padbyte $EA
pad $C24CA7
org $C24CB1
.retort
org $C24CBE
.next
  Find
Quote  



Messages In This Thread
RE: Possible solution to the sap death bug - by Bropedio - 01-21-2021, 07:51 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite