Users browsing this thread: 1 Guest(s)
Ignore Imp check on a specific character

#3
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
look at the several instructions starting at C2/0E8D.  why is Square multiplying numbers and using $15DB,X to get the Actor ID when they could just use $3ED8,Other_X ??  answer: C2/0E77 isn't always called from Bank C2, so you can't rely on $3ED8,Other_X holding what you want!  and Other_X (which is what i'm calling the 0, 2, 4, 6, etc. value that indexes in-battle entities) hasn't necessarily been defined or preserved.

the index for the character's 37-byte data block in X (REVISED: well, more or less) is put on the stack at the start of Function C2/0F9A, right before pushing Y.  so you want to mimic Square in your code by using $15DB,index *after* switching to 8-bit mode.  even if you did have ready access to Other_X, you'd want this code to run properly in the main menus, not just in battle.

all registers are in 16-bit mode, so do "LDA $03,S" right *before* C2/1016 to get the desired value.  because C2/1076 or the branch to C2/10B2 will both overwrite Y, you should probably be fine modifying it here, as opposed to needing to preserve X.

in a decent, fair world:

Code:
LDA $03,S    ; get (index+1)*37 for character's 37-byte data block
TAY
SEP #$20
LDA $15DB,Y  ; get Actor ID
CMP #$0E
{blah blah}

* nearly posted that, proudly brushing my hands together.  nearly.  hahaha. *

oh, but that's not where we live!

see, Square is constantly changing X in the loop that calls C2/0F9A, to access different equipment/relic slots.  (they change it regularly in C2/0E77, to access many parts of the character data block.)  but we always want the FIRST, Actor slot of the data block!  what to do?!

if you could make space in Function C2/0E77, you'd want to preserve the result of C2/0E97 somewhere (e.g. stack, a scratch variable like $FF) to access from your code.

or we can try to reverse engineer the proper X.  see, these clowns also change Y in the calling loop, so that can provide us valuable info:

Code:
LDA #$0005
SEC
SBC $01,S    ; combine with former Y of 0-5 equip/relic slot, which
            ;   looping caller decrements in tandem with X.
            ; consider A our normalizer for the pain in the arse value
            ;   that we'll be encountering two instructions from now.
CLC
ADC $03,S    ; combine with former X, which equals:
            ;  ((roster index + 1) * 37) for character's 37-byte
            ;   data block ,
            ;  Plus 4  (due to recent C2/0EDC loop) ,
            ;  Minus 0 thru 5  (due to ongoing C2/0EF1 loop)
TAY
SEP #$20
LDA $15D7,Y  ; i sure HOPE this is our Actor ID.  not accessing
            ;   via $15DB,index, because i did NOT attempt to
            ;   normalize out the +4 !  (as i didn't want A
            ;   negative even momentarily.)
CMP #$0E     ; single out our designated character ... ideally
            ;   so we can put a bullet between their eyes as
            ;   gratitude for this tangent.
Quote  
[-] The following 3 users say Thank You to assassin for this post:
  • C-Dude (04-05-2021), madsiur (04-05-2021), PowerPanda (04-05-2021)



Messages In This Thread
RE: Ignore Imp check on a specific character - by assassin - 04-05-2021, 05:55 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite