Users browsing this thread: 1 Guest(s)
Concept: Swapping Characters

#7
Posts: 3,971
Threads: 279
Thanks Received: 238
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
You can easily modify the command in order to have Gogo not get all the resetting but others would in order to keep the game logic (event-wise) intact.

Edit: That'S not really what you are proposing, but this could work for a character that would have jobs or even multiple upgrades in the game.

Semi xkas / disassembly code example incoming!
Code:
// beginning remains intact
C0/A07C:    20AD9D      JSR $9DAD    // Transfer to Y current character ID    
C0/A07F:    A916        LDA #$16
C0/A081:    8D0242      STA $4202
C0/A084:    A5EC        LDA $EC
C0/A086:    8D0342      STA $4203
C0/A089:    EA          NOP
C0/A08A:    EA          NOP
C0/A08B:    EA          NOP
C0/A08C:    AE1642      LDX $4216 // actor data offset

LDA $EC        (load parameter)
STA $1600,Y    (save actor ID)

Edit: // Character ID is in $EB not $EC

TYA
CMP #$0C        (is it Gogo?)
BEQ exit; // skip all the resetting stuff

// Other chars continue here
C0/A0AB:    BFA67CED    LDA $ED7CA6,X    (vigor)
C0/A0AF:    991A16      STA $161A,Y
C0/A0B2:    BFA77CED    LDA $ED7CA7,X    (speed)
C0/A0B6:    991B16      STA $161B,Y
C0/A0B9:    BFA87CED    LDA $ED7CA8,X    (stamina)
C0/A0BD:    991C16      STA $161C,Y
C0/A0C0:    BFA97CED    LDA $ED7CA9,X    (mag. pwr.)
C0/A0C4:    991D16      STA $161D,Y
C0/A0C7:    A9FF        LDA #$FF
C0/A0C9:    991E16      STA $161E,Y
C0/A0CC:    BFAF7CED    LDA $ED7CAF,X    (R-hand)
C0/A0D0:    991F16      STA $161F,Y
C0/A0D3:    BFB07CED    LDA $ED7CB0,X    (L-hand)
C0/A0D7:    992016      STA $1620,Y
C0/A0DA:    BFB17CED    LDA $ED7CB1,X    (Body)
C0/A0DE:    992116      STA $1621,Y
C0/A0E1:    BFB27CED    LDA $ED7CB2,X    (Head)
C0/A0E5:    992216      STA $1622,Y
C0/A0E8:    BFB37CED    LDA $ED7CB3,X    (Relic 1)
C0/A0EC:    992316      STA $1623,Y
C0/A0EF:    BFB47CED    LDA $ED7CB4,X    (Relic 2)
C0/A0F3:    992416      STA $1624,Y
C0/A0F6:    BFA07CED    LDA $ED7CA0,X    (Level 1 HP)
C0/A0FA:    990B16      STA $160B,Y
C0/A0FD:    BFA17CED    LDA $ED7CA1,X    (Level 1 MP)
C0/A101:    990F16      STA $160F,Y
C0/A104:    7B          TDC
C0/A105:    990C16      STA $160C,Y    (max HP, high byte = 0)
C0/A108:    991016      STA $1610,Y    (max MP, high byte = 0)
C0/A10B:    DA          PHX
C0/A10C:    5A          PHY
C0/A112:    20789F      JSR $9F78      (determine starting level) // level averaging
C0/A115:    7A          PLY
C0/A116:    FA          PLX
C0/A117:    990816      STA $1608,Y    (Store to the level)
C0/A11A:    BFB57CED    LDA $ED7CB5,X  ("Level factor")
C0/A11E:    290C        AND #$0C        (Isolate bits 2 and 3)
C0/A120:    4A          LSR A            (Divide by 2)
C0/A121:    4A          LSR A            (Divide by 2 again, now 4)
C0/A122:    AA          TAX            (Put that into X)
C0/A123:    BF28A2C0    LDA $C0A228,X  (Load one of 4 constants, depending on the above isolation of bits)
C0/A127:    18          CLC           (Clear the carry)
C0/A128:    790816      ADC $1608,Y    (Add the level and this variable amount [0, 2, 5, or -3])
C0/A12B:    F002        BEQ $A12F      (branch if level was 0)
C0/A12D:    1002        BPL $A131      (branch if level is less than 128, note that if it is higher, it will wrap back to 0)
C0/A12F:    A901        LDA #$01       (Min. Lev. 1)
C0/A131:    C963        CMP #$63       (is the current level 99?)
C0/A133:    9002        BCC $A137      (branch if less than 99)
C0/A135:    A963        LDA #$63       (Trunc at 99)
C0/A137:    990816      STA $1608,Y    (save as level)
C0/A13A:    207EA2      JSR $A27E       // Set Max HP
C0/A13D:    B90B16      LDA $160B,Y    (max HP, low byte)
C0/A140:    990916      STA $1609,Y    (save as current HP, low byte)
C0/A143:    B90C16      LDA $160C,Y    (max HP, high byte)
C0/A146:    990A16      STA $160A,Y    (save as current HP, high byte)
C0/A149:    20BCA2      JSR $A2BC         // Set Max MP
C0/A14C:    B90F16      LDA $160F,Y    (max MP, low byte)
C0/A14F:    990D16      STA $160D,Y    (save as current MP, low byte)
C0/A152:    B91016      LDA $1610,Y    (max MP, high byte)
C0/A155:    990E16      STA $160E,Y    (save as current MP, low byte)

exit; // Keep commands swap for everyone

Edit: X doesn't have anymore the actor data offset. Might redo calculation at beginning of command code.
C0/A08F:    BFA27CED    LDA $ED7CA2,X    (command 1)
C0/A093:    991616      STA $1616,Y
C0/A096:    BFA37CED    LDA $ED7CA3,X    (command 2)
C0/A09A:    991716      STA $1617,Y
C0/A09D:    BFA47CED    LDA $ED7CA4,X    (command 3)
C0/A0A1:    991816      STA $1618,Y
C0/A0A4:    BFA57CED    LDA $ED7CA5,X    (command 4)
C0/A0A8:    991916      STA $1619,Y

// C0/A158 non-relevant to this example code would continues here...

I'm being sloppy here, but you get the idea.
  Find
Quote  



Messages In This Thread
Concept: Swapping Characters - by Catone - 12-01-2015, 03:45 PM
RE: Concept: Swapping Characters - by Zozma - 12-01-2015, 05:34 PM
RE: Concept: Swapping Characters - by madsiur - 12-01-2015, 07:20 PM
RE: Concept: Swapping Characters - by Tenkarider - 12-01-2015, 08:01 PM
RE: Concept: Swapping Characters - by madsiur - 12-01-2015, 08:54 PM
RE: Concept: Swapping Characters - by Lockirby2 - 12-01-2015, 10:00 PM
RE: Concept: Swapping Characters - by madsiur - 12-01-2015, 11:22 PM
RE: Concept: Swapping Characters - by Catone - 12-01-2015, 11:31 PM
RE: Concept: Swapping Characters - by Zozma - 12-12-2015, 12:57 AM
RE: Concept: Swapping Characters - by madsiur - 12-12-2015, 01:41 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite