• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
September 30, 2020, 02:13:24 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen/RetroArch is recommended for playing/testing, pSX is recommended for debugging.


Dokurider's Custom AoEs

Started by Dokurider, April 21, 2014, 04:41:48 pm

RavenOfRazgriz

Hamedo doesn't make Counter useless.  Countergrasp is also its own flag, so you can make it possible to trigger "Counter" against any damaging attack that happens to be inside your weapon range, while Hamedo with Choto's fix can filll the role of old-Counter by triggering against those types of attacks with a pre-emptive strike.  Considering many people consider Counter to be a lackluster Support, this is a change that both makes Counter more relevant and gives Hamedo more overall utility.

What makes things useless is lacking the imagination to properly diversify things.

Xifanie

A Conic AoE is definitely great, yet rather limited to breath type attacks. Still, great work on that. I could see some use of weapon range abilities able to have an AoE. It would allow for exploding arrows, and some kind of "barrage" ability with a gun shooting multiple times at random in a given AoE. The range parameter of the skill could add or remove targeting distance of the weapon.

Of course, those are my own ideas and I'm not making a mod, so... :v
  • Modding version: PSX
Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Celdia

Quote from: Xifanie on May 28, 2014, 01:44:12 am
...some kind of "barrage" ability with a gun...


Two words: Shotgun Blast.

Timbo

Three words for D&D fans. Cone of Cold.
  • Modding version: PSX
  • Discord username: Timbo

Celdia

May 28, 2014, 04:13:30 pm #24 Last Edit: May 28, 2014, 11:39:01 pm by Celdia
Quote from: Jack of All Trades on May 28, 2014, 10:57:22 am
Three words for D&D fans. Cone of Cold.


If you want another three words, I think this might be what Xifanie's "barrage" translates to: Spray and Pray. :D

...which, come to think of it, would be really about perfect for any multi-hit formula with Random Hits flagged. Just set the number of hits to something ridiculous like 50 and don't have it animate misses...toss on something like a Knife Hand animation...hmmm.


Edit: Hey, Doku...I tried to make something work with this and all it did was crash on me despite various settings for the skill in question, almost always with illegal op code errors. PM me with what relevant info you'd need for troubleshooting and I'll collect it for you.

Dokurider

So, like I said, I've been looking into how Range is generated so I can allow for Self Attacking. It was an interesting evening last night, so here's what I got so far.


Set panels affected by ability?
0017a290: 27bdff98 addiu r29,r29,0xff98
0017a294: 27a50010 addiu r5,r29,0x0010
0017a298: afbf0064 sw r31,0x0064(r29)
0017a29c: afbe0060 sw r30,0x0060(r29)
0017a2a0: afb7005c sw r23,0x005c(r29)
0017a2a4: afb60058 sw r22,0x0058(r29)
0017a2a8: afb50054 sw r21,0x0054(r29)
0017a2ac: afb40050 sw r20,0x0050(r29)
0017a2b0: afb3004c sw r19,0x004c(r29)
0017a2b4: afb20048 sw r18,0x0048(r29)
0017a2b8: afb10044 sw r17,0x0044(r29)
0017a2bc: 0c01788b jal 0x0005e22c
0017a2c0: afb00040 sw r16,0x0040(r29)
0017a2c4: 93a30010 lbu r3,0x0010(r29) get caster id
0017a2c8: 00000000 nop
0017a2cc: 000310c0 sll r2,r3,0x03
0017a2d0: 00431023 subu r2,r2,r3
0017a2d4: 00021180 sll r2,r2,0x06
0017a2d8: 3c038019 lui r3,0x8019
0017a2dc: 246308cc addiu r3,r3,0x08cc load unit data
0017a2e0: 0043a021 addu r20,r2,r3 get caster data
0017a2e4: 87a30012 lh r3,0x0012(r29) load ability id?
0017a2e8: 00000000 nop
0017a2ec: 000310c0 sll r2,r3,0x03
0017a2f0: 00431023 subu r2,r2,r3
0017a2f4: 00021040 sll r2,r2,0x01
0017a2f8: 3c038006 lui r3,0x8006
0017a2fc: 2463fbf0 addiu r3,r3,0xfbf0 load ability flags
0017a300: 00431021 addu r2,r2,r3
0017a304: 90470001 lbu r7,0x0001(r2) load effect area
0017a308: 90530000 lbu r19,0x0000(r2) load range
0017a30c: a3a70028 sb r7,0x0028(r29) save AoE to stack
0017a310: 90470002 lbu r7,0x0002(r2) load verticle
0017a314: 90520003 lbu r18,0x0003(r2) load flags 1
0017a318: a3a70030 sb r7,0x0030(r29) save vertical to stack
0017a31c: 90420006 lbu r2,0x0006(r2) load flags 4
0017a320: 00000000 nop
0017a324: a3a20038 sb r2,0x0038(r29) save flags 4 to stack
0017a328: 92960047 lbu r22,0x0047(r20) load caster x coordinate
0017a32c: 92970048 lbu r23,0x0048(r20) load caster y coordinate
0017a330: 0c060428 jal 0x001810a0 map location calc
0017a334: 02802021 addu r4,r20,r0
0017a338: 00402821 addu r5,r2,r0 save target tile id?
0017a33c: 000510c0 sll r2,r5,0x03
0017a340: 3c038019 lui r3,0x8019
0017a344: 2463f8cc addiu r3,r3,0xf8cc load tile data
0017a348: 00431021 addu r2,r2,r3
0017a34c: 3c068019 lui r6,0x8019
0017a350: 24c62dd8 addiu r6,r6,0x2dd8 load panel grid pointer
0017a354: 90430003 lbu r3,0x0003(r2) load height halves + depths
0017a358: 3c04800e lui r4,0x800e
0017a35c: 90844e9c lbu r4,0x4e9c(r4) load map max X
0017a360: 3063001f andi r3,r3,0x001f ignore depth data
0017a364: 02e40018 mult r23,r4 caster y * max x
0017a368: 90440002 lbu r4,0x0002(r2) load tile height
0017a36c: 90420003 lbu r2,0x0003(r2) load height halves + depths
0017a370: 00042040 sll r4,r4,0x01
0017a374: 00832021 addu r4,r4,r3 height + depth
0017a378: 00021142 srl r2,r2,0x05
0017a37c: 00021040 sll r2,r2,0x01
0017a380: 0082f021 addu r30,r4,r2 height + depth + height + depth = frame pointer?
0017a384: 00051880 sll r3,r5,0x02
0017a388: 00651821 addu r3,r3,r5
0017a38c: 0066a821 addu r21,r3,r6 save target tile?
0017a390: 326300ff andi r3,r19,0x00ff r3 = Range
0017a394: 00001012 mflo r2 get Caster Y * max X
0017a398: 00562821 addu r5,r2,r22 + caster x
0017a39c: 340200ff ori r2,r0,0x00ff
0017a3a0: 1462000b bne r3,r2,0x0017a3d0 don't branch if range = 255
0017a3a4: 00002021 addu r4,r0,r0
0017a3a8: 34050001 ori r5,r0,0x0001
0017a3ac: 00c01821 addu r3,r6,r0

<---Loop--> If Range = 255
0017a3b0: a0650000 sb r5,0x0000(r3) all panels are apart of range
0017a3b4: a0600001 sb r0,0x0001(r3) no panels are targeted
0017a3b8: 24840001 addiu r4,r4,0x0001 counter++
0017a3bc: 28820200 slti r2,r4,0x0200
0017a3c0: 1440fffb bne r2,r0,0x0017a3b0
0017a3c4: 24630005 addiu r3,r3,0x0005
<---Loop--->

0017a3c8: 0805e912 j 0x0017a448
0017a3cc: 32420001 andi r2,r18,0x0001

<---Loop--> Else:
0017a3d0: 00c01821 addu r3,r6,r0
0017a3d4: a0600000 sb r0,0x0000(r3) no panels are apart of the aoe
0017a3d8: a0600001 sb r0,0x0001(r3) no panels are yellow
0017a3dc: 24840001 addiu r4,r4,0x0001
0017a3e0: 28820200 slti r2,r4,0x0200
0017a3e4: 1440fffb bne r2,r0,0x0017a3d4
0017a3e8: 24630005 addiu r3,r3,0x0005
<---Loop--->

0017a3ec: 00051880 sll r3,r5,0x02
0017a3f0: 00651821 addu r3,r3,r5
0017a3f4: 3c028019 lui r2,0x8019
0017a3f8: 24422dd8 addiu r2,r2,0x2dd8
0017a3fc: 00628021 addu r16,r3,r2 r16 = caster panel
0017a400: 26640001 addiu r4,r19,0x0001 r4 = range
0017a404: 24420500 addiu r2,r2,0x0500
0017a408: 00628821 addu r17,r3,r2 r17 = caster panel + 500? (high AoE?)
0017a40c: 34020001 ori r2,r0,0x0001
0017a410: a2040000 sb r4,0x0000(r16) save range to caster panel
0017a414: a2240000 sb r4,0x0000(r17) save range to caster panel+
0017a418: a2020001 sb r2,0x0001(r16) caster panel is targeted
0017a41c: 32420020 andi r2,r18,0x0020 Weapon Range flag
0017a420: 10400006 beq r2,r0,0x0017a43c branch if false
0017a424: 02602021 addu r4,r19,r0 r4 = range
0017a428: 0c05e688 jal 0x00179a20 Weapon Range Routine
0017a42c: 02802021 addu r4,r20,r0 r4 = Caster ID data
0017a430: a2000000 sb r0,0x0000(r16)
0017a434: 0805e911 j 0x0017a444 Calculate tiles hit by ability
0017a438: a2200000 sb r0,0x0000(r17)
0017a43c: 0c05e546 jal 0x00179518
0017a440: 00002821 addu r5,r0,r0
0017a444: 32420001 andi r2,r18,0x0001
0017a448: 10400002 beq r2,r0,0x0017a454
0017a44c: 32420010 andi r2,r18,0x0010
0017a450: a2a00000 sb r0,0x0000(r21)
0017a454: 10400003 beq r2,r0,0x0017a464
0017a458: 02c02021 addu r4,r22,r0
0017a45c: 0c05e9ef jal 0x0017a7bc some map calculation
0017a460: 02e02821 addu r5,r23,r0
0017a464: 32420008 andi r2,r18,0x0008
0017a468: 10400005 beq r2,r0,0x0017a480
0017a46c: 33c400ff andi r4,r30,0x00ff
0017a470: 93a70030 lbu r7,0x0030(r29)
0017a474: 00003021 addu r6,r0,r0
0017a478: 0c05e4a9 jal 0x001792a4 check vert tolerance and if tiles can be chosen
0017a47c: 00e02821 addu r5,r7,r0
0017a480: 93a70028 lbu r7,0x0028(r29)
0017a484: 00000000 nop
0017a488: 10e00006 beq r7,r0,0x0017a4a4
0017a48c: 00000000 nop
0017a490: 93a70038 lbu r7,0x0038(r29)
0017a494: 00000000 nop
0017a498: 30e20020 andi r2,r7,0x0020
0017a49c: 10400004 beq r2,r0,0x0017a4b0
0017a4a0: 324200c0 andi r2,r18,0x00c0
0017a4a4: 0c05e497 jal 0x0017925c check vert tolerance and if tiles can be chosen?
0017a4a8: 00000000 nop
0017a4ac: 324200c0 andi r2,r18,0x00c0
0017a4b0: 10400003 beq r2,r0,0x0017a4c0
0017a4b4: 02802021 addu r4,r20,r0
0017a4b8: 0c05e9b7 jal 0x0017a6dc
0017a4bc: 02402821 addu r5,r18,r0
0017a4c0: 324200d0 andi r2,r18,0x00d0
0017a4c4: 14400005 bne r2,r0,0x0017a4dc
0017a4c8: 00000000 nop
0017a4cc: 0c05e96f jal 0x0017a5bc
0017a4d0: 00000000 nop
0017a4d4: 0805e939 j 0x0017a4e4
0017a4d8: 00000000 nop
0017a4dc: 0c05e993 jal 0x0017a64c
0017a4e0: 00000000 nop
0017a4e4: 8fbf0064 lw r31,0x0064(r29)
0017a4e8: 8fbe0060 lw r30,0x0060(r29)
0017a4ec: 8fb7005c lw r23,0x005c(r29)
0017a4f0: 8fb60058 lw r22,0x0058(r29)
0017a4f4: 8fb50054 lw r21,0x0054(r29)
0017a4f8: 8fb40050 lw r20,0x0050(r29)
0017a4fc: 8fb3004c lw r19,0x004c(r29)
0017a500: 8fb20048 lw r18,0x0048(r29)
0017a504: 8fb10044 lw r17,0x0044(r29)
0017a508: 8fb00040 lw r16,0x0040(r29)
0017a50c: 27bd0068 addiu r29,r29,0x0068
0017a510: 03e00008 jr r31
0017a514: 00000000 nop


It's not done yet as I've been documenting the Weapon Range Routine.


00179a20:
00000000: 27bdffe0 addiu r29,r29,-0x0020
00000004: 00803821 addu r7,r4,r0 Caster ID = r7
00000008: afbf0018 sw r31,0x0018(r29)
0000000c: afb10014 sw r17,0x0014(r29)
00000010: afb00010 sw r16,0x0010(r29)
00000014: 90f10048 lbu r17,0x0048(r7) Caster Y
00000018: 3c02800e lui r2,0x800e
0000001c: 90424e9c lbu r2,0x4e9c(r2) Max Map X
00000020: 00000000 nop
00000024: 02220018 mult r17,r2 Caster Y * Max X
00000028: 90e4001d lbu r4,0x001d(r7) Caster Right hand Weapon
0000002c: 90e2005a lbu r2,0x005a(r7) Caster Cur. Status 3
00000030: 90f00047 lbu r16,0x0047(r7) Caster X
00000034: 30420002 andi r2,r2,0x0002 Check for Frog
00000038: 00001812 mflo r3
0000003c: 10400002 beq r2,r0,0x00000048 If Caster is Frogged
00000040: 02032821 addu r5,r16,r3 Caster Y * Max X + Caster X
00000044: 00002021 addu r4,r0,r0 Right Hand is empty
00000048: 308300ff andi r3,r4,0x00ff Rh weapon/frog = r3
0000004c: 340200ff ori r2,r0,0x00ff
00000050: 14620006 bne r3,r2,0x0000006c If Caster has a Rh weapon
00000054: 00000000 nop
00000058: 90e4001f lbu r4,0x001f(r7) Caster Left Hand Weapon
0000005c: 00000000 nop
00000060: 14830003 bne r4,r3,0x00000070 If Caster has a Lh weapon
00000064: 308200ff andi r2,r4,0x00ff
00000068: 00002021 addu r4,r0,r0 Left Hand is empty
0000006c: 308200ff andi r2,r4,0x00ff r2 = weapon
00000070: 2c420080 sltiu r2,r2,0x0080
00000074: 14400002 bne r2,r0,0x00000080 Is item in hand a weapon?
00000078: 00051880 sll r3,r5,0x02
0000007c: 00002021 addu r4,r0,r0
00000080: 000420c0 sll r4,r4,0x03
00000084: 3c028006 lui r2,0x8006
00000088: 24423ab8 addiu r2,r2,0x3ab8 Get Weapon data
0000008c: 00822021 addu r4,r4,r2 point to weapon in hand
00000090: 00651821 addu r3,r3,r5
00000094: 3c028019 lui r2,0x8019
00000098: 24422dd8 addiu r2,r2,0x2dd8
0000009c: 00622821 addu r5,r3,r2 Get Caster tile
000000a0: 24420500 addiu r2,r2,0x0500
000000a4: 00621821 addu r3,r3,r2 Get Caster tile + 500 (high tile?)
000000a8: 34020001 ori r2,r0,0x0001
000000ac: 90880000 lbu r8,0x0000(r4) Get Weapon Range(r8)
000000b0: 90860001 lbu r6,0x0001(r4) Get Weapon Attack Flags(r6)
000000b4: 25040001 addiu r4,r8,0x0001 r4 = Range + 1
000000b8: a0a40000 sb r4,0x0000(r5) Save Weapon Range to Caster Panel
000000bc: a0640000 sb r4,0x0000(r3) Save Weapon Range to Caster Panel+
000000c0: a0a20001 sb r2,0x0001(r5) Caster panel is targeted
000000c4: 30c200c0 andi r2,r6,0x00c0 Is Weapon Striking/Lunging?
000000c8: 10400005 beq r2,r0,0x000000e0 Branch if false
000000cc: 00e02021 addu r4,r7,r0 Save Caster data to r4
000000d0: 0c05e6d6 jal 0x00179b58 jump to ?
000000d4: 00c02821 addu r5,r6,r0 Save Weapon Attack Flags
000000d8: 0805e6ce j 0x00179b38 Jump to last jal
000000dc: 00000000 nop
000000e0: 30c20020 andi r2,r6,0x0020 Is Weapon Direct?
000000e4: 10400009 beq r2,r0,0x0000010c branch if false
000000e8: 01002021 addu r4,r8,r0 Store Weapon Range
000000ec: 0c05e546 jal 0x00179518 Limit Range to Map Function
000000f0: 00002821 addu r5,r0,r0
000000f4: 02002021 addu r4,r16,r0 Save Caster X
000000f8: 02202821 addu r5,r17,r0 Save Caster Y
000000fc: 0c05e509 jal 0x00179424 Remove Close Range Routine
00000100: 34060002 ori r6,r0,0x0002
00000104: 0805e6ce j 0x00179b38 jump to last jal
00000108: 00000000 nop
0000010c: 00e02021 addu r4,r7,r0 Save Caster data
00000110: 0c05e62c jal 0x001798b0 jump to ?
00000114: 01002821 addu r5,r8,r0 save Weapon Range
00000118: 0c05e761 jal 0x00179d84 jump to ?
0000011c: 00000000 nop
00000120: 8fbf0018 lw r31,0x0018(r29)
00000124: 8fb10014 lw r17,0x0014(r29)
00000128: 8fb00010 lw r16,0x0010(r29)
addiu r29,r29,0x0020
jr r31
nop


Stupid pSX binary dumping...Not finished yet either as I have to finish documenting the last couple routines (hindered by aforementioned lack of binary dumping). Too bad, that when things were getting interesting.

Like this little tidbit for instance:


Remove Close Range Routine
r4 = Caster X
r5 = Caster Y
r6 = 2
00179424: 27bdfff0 addiu r29,r29,0xfff0
00179428: 3c02800e lui r2,0x800e
0017942c: 90424ea0 lbu r2,0x4ea0(r2) r2 = Max Map Y
00179430: 00000000 nop
00179434: 18400035 blez r2,0x0017950c End if Y is negative
00179438: 00004021 addu r8,r0,r0 r8 = Y counter
0017943c: 00a8102a slt r2,r5,r8 If Caster Y < Y Counter
00179440: 14400002 bne r2,r0,0x0017944c Branch if true
00179444: 01054823 subu r9,r8,r5 Y Counter - Caster Y = r9
00179448: 00a84823 subu r9,r5,r8 Caster Y - Y Counter = r9
0017944c: 3c02800e lui r2,0x800e
00179450: 90424e9c lbu r2,0x4e9c(r2) r2 = Max Map X
00179454: 00000000 nop
00179458: 18400026 blez r2,0x001794f4 go to Y counter++ if negative
0017945c: 00003821 addu r7,r0,r0 r7 = X Counter
00179460: 0087102a slt r2,r4,r7 If Caster X < X Counter
00179464: 14400002 bne r2,r0,0x00179470 Branch if true
00179468: 00e41023 subu r2,r7,r4 r2 = X Counter - Caster X
0017946c: 00871023 subu r2,r4,r7 r2 = Caster X - X Counter
00179470: 01221021 addu r2,r9,r2 Caster Y- + Caster X- = r2
00179474: 00c2102a slt r2,r6,r2 if Caster-Counter Sum > 2
00179478: 14400018 bne r2,r0,0x001794dc skip AoE blanking if true
0017947c: 00000000 nop
00179480: 3c02800e lui r2,0x800e
00179484: 90424e9c lbu r2,0x4e9c(r2) r2 = Max Map X
00179488: 00000000 nop
0017948c: 01020018 mult r8,r2 Y Counter * Max X
00179490: 00001812 mflo r3
00179494: 00671821 addu r3,r3,r7 Y Counter * Max X + X Counter
00179498: 00031080 sll r2,r3,0x02
0017949c: 00431021 addu r2,r2,r3
001794a0: 3c018019 lui r1,0x8019
001794a4: 00220821 addu r1,r1,r2
001794a8: a0202dd8 sb r0,0x2dd8(r1) Blank Counter Low Tile's AoE data
001794ac: 3c02800e lui r2,0x800e
001794b0: 90424e9c lbu r2,0x4e9c(r2) r2 = Max Map X
001794b4: 00000000 nop
001794b8: 01020018 mult r8,r2 Y Counter * Max X
001794bc: 24e20100 addiu r2,r7,0x0100 r2 = X Counter + 0x0100
001794c0: 00001812 mflo r3
001794c4: 00621821 addu r3,r3,r2
001794c8: 00031080 sll r2,r3,0x02
001794cc: 00431021 addu r2,r2,r3
001794d0: 3c018019 lui r1,0x8019
001794d4: 00220821 addu r1,r1,r2
001794d8: a0202dd8 sb r0,0x2dd8(r1) Blank Counter High Tile's AoE data
001794dc: 3c02800e lui r2,0x800e
001794e0: 90424e9c lbu r2,0x4e9c(r2) r2 = Max Map X
001794e4: 24e70001 addiu r7,r7,0x0001 X Counter ++
001794e8: 00e2102a slt r2,r7,r2 If X Counter < Max X
001794ec: 1440ffdd bne r2,r0,0x00179464 Branch back if True
001794f0: 0087102a slt r2,r4,r7 If Caster X < X Counter
001794f4: 3c02800e lui r2,0x800e
001794f8: 90424ea0 lbu r2,0x4ea0(r2) r2 = Max Map Y
001794fc: 25080001 addiu r8,r8,0x0001 Y Counter++
00179500: 0102102a slt r2,r8,r2 If Y Counter < Max Y
00179504: 1440ffce bne r2,r0,0x00179440 Branch Back if true
00179508: 00a8102a slt r2,r5,r8 If Caster Y < Y Counter
0017950c: 27bd0010 addiu r29,r29,0x0010
00179510: 03e00008 jr r31
00179514: 00000000 nop

Yep, this is the routine that removes the inner range from ranged weapons like Bows and Books and stuff. Interesting how it does it. This is complete by the way.

Celdia's PM reminded me of something I tried with Weapon Range. I actually *did* managed to hack it so it allowed abilities to have AoE (it currently doesn't). Yeah, Weapon Range. AoE.

All I had to do was:

0017babc: 31220020 andi r2,r9,0x0020
to
0017babc: 31220020 andi r2,r0,0x0000

Yep. That's it. Only problem? The AoE was there, but you couldn't actually hit anyone with *any* of the highlighted tiles except the actual targeted tile! Weirdest thing. I'm pretty sure my current work will uncover why that was.

Quote from: Jack of All Trades on May 27, 2014, 08:07:19 pm
Wait, not only did you code Abyssal Wave, but you fixed Golem too? Fantastic Work. I have a question. Can you set any distance you want on the cone? I'm thinking about changing the dragons breath attacks to 2 square cones.


I keep forgetting to responding. I didn't fix Golem, I just found, or refound, reminded Raven to speak up? Anyways, yes, Conic AoE works at any range, and any AoE.

You can also use Conic AoE to make a boss skill, like say this for instance. Cluster around the boss so you can't wipe your whole party in one shot.

I just need to remind everyone that you must change AoE to 128 + actual AoE if you want to use Conic. 64 + AoE if you want to use Linear again, and 32 + AoE if you want to use Tri Attack.

Celdia

Quote from: Dokurider on May 30, 2014, 04:20:39 pm
Quotecode code code

Uhhh....
Quote from: Dokurider on May 30, 2014, 04:20:39 pm
Yep, this is the routine that removes the inner range from ranged weapons like Bows and Books and stuff.

Quote from: Dokurider on May 30, 2014, 04:20:39 pm
Weapon Range. AoE.


...I would like to subscribe to your newsletter, sir.

Dokurider

Oh yeah one more thing. The Cone AoE hack is standalone. It no longer needs the Target Unit Hack to work. It doesn't even need the Kanji Space hack anyone technically, but best do that anyways to be safe.

Timbo

Huzzah. Standalone cone hack. Woo!
  • Modding version: PSX
  • Discord username: Timbo

RavenOfRazgriz

Quote from: Dokurider on May 30, 2014, 05:54:19 pmIt doesn't even need the Kanji Space hack anyone technically, but best do that anyways to be safe.
Nothing ever "needs" the Kanji Space Nopper, all that hack does is make it easier for an ASMer to see how large their workspace is.  If you're not actively ASM hacking or working on a team where someone is you should never need to apply it unless the person making the ASM did something particularly brain-dead.

Choto

idk why psx disassembled like that... but take this. It's a disassembly of scus and battle.bin (and also another file with World.bin and Wldcore). So all you need to do is ctrl-F the address you're looking for and it will take you right to the routine. Then you can copypaste it wherever you want. Just convenient

Dokurider

So, I spent the weekend annotating code. Made some interesting discoveries.

Range Routine
0017a290: 27bdff98 addiu r29,r29,0xff98
0017a294: 27a50010 addiu r5,r29,0x0010
0017a298: afbf0064 sw r31,0x0064(r29)
0017a29c: afbe0060 sw r30,0x0060(r29)
0017a2a0: afb7005c sw r23,0x005c(r29)
0017a2a4: afb60058 sw r22,0x0058(r29)
0017a2a8: afb50054 sw r21,0x0054(r29)
0017a2ac: afb40050 sw r20,0x0050(r29)
0017a2b0: afb3004c sw r19,0x004c(r29)
0017a2b4: afb20048 sw r18,0x0048(r29)
0017a2b8: afb10044 sw r17,0x0044(r29)
0017a2bc: 0c01788b jal 0x0005e22c
0017a2c0: afb00040 sw r16,0x0040(r29)
0017a2c4: 93a30010 lbu r3,0x0010(r29) get caster id
0017a2c8: 00000000 nop
0017a2cc: 000310c0 sll r2,r3,0x03
0017a2d0: 00431023 subu r2,r2,r3
0017a2d4: 00021180 sll r2,r2,0x06
0017a2d8: 3c038019 lui r3,0x8019
0017a2dc: 246308cc addiu r3,r3,0x08cc load unit data
0017a2e0: 0043a021 addu r20,r2,r3 get caster data
0017a2e4: 87a30012 lh r3,0x0012(r29) load ability id?
0017a2e8: 00000000 nop
0017a2ec: 000310c0 sll r2,r3,0x03
0017a2f0: 00431023 subu r2,r2,r3
0017a2f4: 00021040 sll r2,r2,0x01
0017a2f8: 3c038006 lui r3,0x8006
0017a2fc: 2463fbf0 addiu r3,r3,0xfbf0 load ability flags
0017a300: 00431021 addu r2,r2,r3
0017a304: 90470001 lbu r7,0x0001(r2) load effect area
0017a308: 90530000 lbu r19,0x0000(r2) load range
0017a30c: a3a70028 sb r7,0x0028(r29) save AoE to stack
0017a310: 90470002 lbu r7,0x0002(r2) load verticle
0017a314: 90520003 lbu r18,0x0003(r2) load flags 1
0017a318: a3a70030 sb r7,0x0030(r29) save vertical to stack
0017a31c: 90420006 lbu r2,0x0006(r2) load flags 4
0017a320: 00000000 nop
0017a324: a3a20038 sb r2,0x0038(r29) save flags 4 to stack
0017a328: 92960047 lbu r22,0x0047(r20) load caster x coordinate
0017a32c: 92970048 lbu r23,0x0048(r20) load caster y coordinate
0017a330: 0c060428 jal 0x001810a0 map location calc
0017a334: 02802021 addu r4,r20,r0
0017a338: 00402821 addu r5,r2,r0 save target tile id?
0017a33c: 000510c0 sll r2,r5,0x03
0017a340: 3c038019 lui r3,0x8019
0017a344: 2463f8cc addiu r3,r3,0xf8cc load tile data
0017a348: 00431021 addu r2,r2,r3
0017a34c: 3c068019 lui r6,0x8019
0017a350: 24c62dd8 addiu r6,r6,0x2dd8 load panel grid pointer
0017a354: 90430003 lbu r3,0x0003(r2) load height halves + depths
0017a358: 3c04800e lui r4,0x800e
0017a35c: 90844e9c lbu r4,0x4e9c(r4) load map max X
0017a360: 3063001f andi r3,r3,0x001f ignore depth data
0017a364: 02e40018 mult r23,r4 caster y * max x
0017a368: 90440002 lbu r4,0x0002(r2) load tile height
0017a36c: 90420003 lbu r2,0x0003(r2) load height halves
0017a370: 00042040 sll r4,r4,0x01
0017a374: 00832021 addu r4,r4,r3 height + halves
0017a378: 00021142 srl r2,r2,0x05 r2 = Depth(Ignore Halves)
0017a37c: 00021040 sll r2,r2,0x01
0017a380: 0082f021 addu r30,r4,r2 height + halves + depth = frame pointer(r30)???
0017a384: 00051880 sll r3,r5,0x02
0017a388: 00651821 addu r3,r3,r5
0017a38c: 0066a821 addu r21,r3,r6 save target tile?
0017a390: 326300ff andi r3,r19,0x00ff r3 = Range
0017a394: 00001012 mflo r2 get Caster Y * max X
0017a398: 00562821 addu r5,r2,r22 + caster x
0017a39c: 340200ff ori r2,r0,0x00ff
0017a3a0: 1462000b bne r3,r2,0x0017a3d0 don't branch if range = 255
0017a3a4: 00002021 addu r4,r0,r0
0017a3a8: 34050001 ori r5,r0,0x0001
0017a3ac: 00c01821 addu r3,r6,r0

<---Loop--> If Range = 255
0017a3b0: a0650000 sb r5,0x0000(r3) all panels are apart of aoe
0017a3b4: a0600001 sb r0,0x0001(r3) no panels are yellow
0017a3b8: 24840001 addiu r4,r4,0x0001 counter++
0017a3bc: 28820200 slti r2,r4,0x0200
0017a3c0: 1440fffb bne r2,r0,0x0017a3b0
0017a3c4: 24630005 addiu r3,r3,0x0005
<---Loop--->

0017a3c8: 0805e912 j 0x0017a448
0017a3cc: 32420001 andi r2,r18,0x0001

<---Loop--> Else:
0017a3d0: 00c01821 addu r3,r6,r0
0017a3d4: a0600000 sb r0,0x0000(r3) no panels are apart of the aoe
0017a3d8: a0600001 sb r0,0x0001(r3) no panels are yellow
0017a3dc: 24840001 addiu r4,r4,0x0001
0017a3e0: 28820200 slti r2,r4,0x0200
0017a3e4: 1440fffb bne r2,r0,0x0017a3d4
0017a3e8: 24630005 addiu r3,r3,0x0005
<---Loop--->

0017a3ec: 00051880 sll r3,r5,0x02
0017a3f0: 00651821 addu r3,r3,r5
0017a3f4: 3c028019 lui r2,0x8019
0017a3f8: 24422dd8 addiu r2,r2,0x2dd8
0017a3fc: 00628021 addu r16,r3,r2 r16 = caster panel
0017a400: 26640001 addiu r4,r19,0x0001 r4 = range
0017a404: 24420500 addiu r2,r2,0x0500
0017a408: 00628821 addu r17,r3,r2 r17 = caster panel + 500? (high AoE?)
0017a40c: 34020001 ori r2,r0,0x0001
0017a410: a2040000 sb r4,0x0000(r16) save range to caster panel
0017a414: a2240000 sb r4,0x0000(r17) save range to caster panel+
0017a418: a2020001 sb r2,0x0001(r16) caster panel is targeted
0017a41c: 32420020 andi r2,r18,0x0020 Weapon Range flag
0017a420: 10400006 beq r2,r0,0x0017a43c branch if false
0017a424: 02602021 addu r4,r19,r0 r4 = range
0017a428: 0c05e688 jal 0x00179a20 Weapon Range Routine
0017a42c: 02802021 addu r4,r20,r0 r4 = Caster ID data
0017a430: a2000000 sb r0,0x0000(r16) Remove Range from Caster Panel
0017a434: 0805e911 j 0x0017a444 Calculate tiles hit by ability
0017a438: a2200000 sb r0,0x0000(r17) Remove Range from Caster Panel+
0017a43c: 0c05e546 jal 0x00179518 Generate Range Routine
0017a440: 00002821 addu r5,r0,r0 r5 = 0
0017a444: 32420001 andi r2,r18,0x0001 If Can't Target Self
0017a448: 10400002 beq r2,r0,0x0017a454 Branch if False
0017a44c: 32420010 andi r2,r18,0x0010 If Vertical Fixed
0017a450: a2a00000 sb r0,0x0000(r21) Remove Caster Panel from Range
0017a454: 10400003 beq r2,r0,0x0017a464 Branch if False
0017a458: 02c02021 addu r4,r22,r0 r4 = Caster X
0017a45c: 0c05e9ef jal 0x0017a7bc Vertical Fixed Routine
0017a460: 02e02821 addu r5,r23,r0 r5 = Caster Y
0017a464: 32420008 andi r2,r18,0x0008 If Vertical Fixed
0017a468: 10400005 beq r2,r0,0x0017a480 Branch if False
0017a46c: 33c400ff andi r4,r30,0x00ff r4 = Height Value if Non Zero (Negative?)
0017a470: 93a70030 lbu r7,0x0030(r29) r7 = load vertical from stack
0017a474: 00003021 addu r6,r0,r0 r6 = 0
0017a478: 0c05e4a9 jal 0x001792a4 Vertical Tolerance Formula
0017a47c: 00e02821 addu r5,r7,r0 r5 = Vertical
0017a480: 93a70028 lbu r7,0x0028(r29) r7 = Load AoE from Stack
0017a484: 00000000 nop
0017a488: 10e00006 beq r7,r0,0x0017a4a4 Branch if AoE = 0
0017a48c: 00000000 nop
0017a490: 93a70038 lbu r7,0x0038(r29) r7 = Load Ability Flags 4
0017a494: 00000000 nop
0017a498: 30e20020 andi r2,r7,0x0020 If Direct/Stop at Obstacle
0017a49c: 10400004 beq r2,r0,0x0017a4b0 Branch if False
0017a4a0: 324200c0 andi r2,r18,0x00c0 If Unknown Flags 0x80/0x40 (!!!)
0017a4a4: 0c05e497 jal 0x0017925c Clear Data from Untargetable Tiles
0017a4a8: 00000000 nop
0017a4ac: 324200c0 andi r2,r18,0x00c0 If Unknown Flags 0x80/0x40 (!!!)
0017a4b0: 10400003 beq r2,r0,0x0017a4c0 Branch if False
0017a4b4: 02802021 addu r4,r20,r0 r4 = Caster Data
0017a4b8: 0c05e9b7 jal 0x0017a6dc Evaluate Unknown Flags 0x80/0x40 (!!!)
0017a4bc: 02402821 addu r5,r18,r0 r5 = Ability Flags 1
0017a4c0: 324200d0 andi r2,r18,0x00d0 If Unknown Flags 0x80/0x40 or Vertical Fixed
0017a4c4: 14400005 bne r2,r0,0x0017a4dc Branch if True
0017a4c8: 00000000 nop
0017a4cc: 0c05e96f jal 0x0017a5bc Identify Cross Sections
0017a4d0: 00000000 nop
0017a4d4: 0805e939 j 0x0017a4e4
0017a4d8: 00000000 nop
0017a4dc: 0c05e993 jal 0x0017a64c Identify Cross Sections (Clone)
0017a4e0: 00000000 nop
0017a4e4: 8fbf0064 lw r31,0x0064(r29)
0017a4e8: 8fbe0060 lw r30,0x0060(r29)
0017a4ec: 8fb7005c lw r23,0x005c(r29)
0017a4f0: 8fb60058 lw r22,0x0058(r29)
0017a4f4: 8fb50054 lw r21,0x0054(r29)
0017a4f8: 8fb40050 lw r20,0x0050(r29)
0017a4fc: 8fb3004c lw r19,0x004c(r29)
0017a500: 8fb20048 lw r18,0x0048(r29)
0017a504: 8fb10044 lw r17,0x0044(r29)
0017a508: 8fb00040 lw r16,0x0040(r29)
0017a50c: 27bd0068 addiu r29,r29,0x0068
0017a510: 03e00008 jr r31
0017a514: 00000000 nop

I'm not sure what the significance of 0x1a23d8 (192dd8 + 500) or what it's used for, but it comes up quite often. Also Unknown Flags 1 and 2!!! Finally, we can find out once and for all what these flags do. Let's look at this routine right now:


Expand Range from Ally/Enemy (Nonfunctioning)
r4 = Caster Data
r5 = Ability Flags 1

0017a6dc: 27bdffc8 addiu r29,r29,-0x0038
0017a6e0: afb10014 sw r17,0x0014(r29)
0017a6e4: 00808821 addu r17,r4,r0 r17 = Caster Data
0017a6e8: afb7002c sw r23,0x002c(r29)
0017a6ec: 30b70080 andi r23,r5,0x0080 r23 = Unknown Flag 1
0017a6f0: afb60028 sw r22,0x0028(r29)
0017a6f4: 30b60040 andi r22,r5,0x0040 r22 = Unknown Flag 2
0017a6f8: afb3001c sw r19,0x001c(r29)
0017a6fc: 00009821 addu r19,r0,r0 r19 = Counter
0017a700: afb40020 sw r20,0x0020(r29)
0017a704: 34140001 ori r20,r0,0x0001 r20 = True
0017a708: afbf0030 sw r31,0x0030(r29)
0017a70c: afb50024 sw r21,0x0024(r29)
0017a710: afb20018 sw r18,0x0018(r29)
0017a714: afb00010 sw r16,0x0010(r29)
0017a718: 92350005 lbu r21,0x0005(r17) r21 = ENTD flags
0017a71c: 92230001 lbu r3,0x0001(r17) r3 = Unit ID
0017a720: 340200ff ori r2,r0,0x00ff r2 = 0x00ff
0017a724: 10620015 beq r3,r2,0x0017a77c Branch if Unit ID(Caster) doesn't exist (FF)?
0017a728: 02202021 addu r4,r17,r0 r4 = Caster Data
0017a72c: 922201ba lbu r2,0x01ba(r17) r2 = Modified ENTD Flags
0017a730: 00000000 nop
0017a734: 02a28026 xor r16,r21,r2 r16 = ENTD Flags
0017a738: 0c060428 jal 0x001810a0 Get Unit Tile ID
0017a73c: 02009021 addu r18,r16,r0 r18 = ENTD Flags
0017a740: 00021880 sll r3,r2,0x02 r3 = Caster Tile ID
0017a744: 00621821 addu r3,r3,r2
0017a748: 3c028019 lui r2,0x8019
0017a74c: 24422dd8 addiu r2,r2,0x2dd8 r2 = Tile Grid Data (0x192dd8)
0017a750: 12e00005 beq r23,r0,0x0017a768 If Unknown Flag = False
0017a754: 00621821 addu r3,r3,r2 r3 = Caster Tile Data
0017a758: 32020030 andi r2,r16,0x0030 r2 = Red or Blue Flag
0017a75c: 14400002 bne r2,r0,0x0017a768 Branch if Red or Blue Team
0017a760: 00000000 nop
0017a764: a0740001 sb r20,0x0001(r3) Caster Tile is Targeted
0017a768: 12c00004 beq r22,r0,0x0017a77c If Unknown Flag 2 = False
0017a76c: 32420030 andi r2,r18,0x0030 r2 = Red or Blue Team
0017a770: 10400002 beq r2,r0,0x0017a77c Branch if neither Team
0017a774: 00000000 nop
0017a778: a0740001 sb r20,0x0001(r3) Caster Tile is Targeted
0017a77c: 26730001 addiu r19,r19,0x0001 Counter++
0017a780: 2a620015 slti r2,r19,0x0015 If Counter < 0x0015
0017a784: 1440ffe5 bne r2,r0,0x0017a71c Branch Back if True
0017a788: 00000000 nop
0017a78c: 8fbf0030 lw r31,0x0030(r29)
0017a790: 8fb7002c lw r23,0x002c(r29)
0017a794: 8fb60028 lw r22,0x0028(r29)
0017a798: 8fb50024 lw r21,0x0024(r29)
0017a79c: 8fb40020 lw r20,0x0020(r29)
0017a7a0: 8fb3001c lw r19,0x001c(r29)
0017a7a4: 8fb20018 lw r18,0x0018(r29)
0017a7a8: 8fb10014 lw r17,0x0014(r29)
0017a7ac: 8fb00010 lw r16,0x0010(r29)
0017a7b0: 27bd0038 addiu r29,r29,0x0038
0017a7b4: 03e00008 jr r31
0017a7b8: 00000000 nop

I...uh, um, what? It seems this Routine does nothing at all. Unless I missed something, this routine only loops right back onto the caster and only the caster.
I'm not well versed in ENTD, but I'm thinking this routine *was* supposed to go through and target every Team Allied Unit. Exactly what Targeted means in the context of Range, I have no real clue.  The Caster's Tile is targeted, does that mean that it's...supposed to generate range from other units or something? But that was true, then why does it loop 0x15 times? You're only allowed to have 0x0f units. I have no clue about anything except this was most likely broken deliberately. Any guesses?

Cross Section Identification 

0017a5bc: 00003021 addu r6,r0,r0 r6 = 0
0017a5c0: 00002821 addu r5,r0,r0 r5 = 0
0017a5c4: 3407003f ori r7,r0,0x003f r7 = 0x003f
0017a5c8: 3c038019 lui r3,0x8019
0017a5cc: 2463f8cc addiu r3,r3,-0x0734 r3 = Tile Data (0x18f8cc)
0017a5d0: 3c048019 lui r4,0x8019
0017a5d4: 24842dd8 addiu r4,r4,0x2dd8 r4 = Tile Grid Data (0x192dd8)
0017a5d8: 90820000 lbu r2,0x0000(r4) r2 = Tile's Range
0017a5dc: 00000000 nop
0017a5e0: 1040000f beq r2,r0,0x0017a620 Branch if Range = 0
0017a5e4: 00000000 nop
0017a5e8: 90620006 lbu r2,0x0006(r3) r2 = Load Select/Targetable
0017a5ec: 00000000 nop
0017a5f0: 30420001 andi r2,r2,0x0001 If Tile is Unselectable
0017a5f4: 1440000a bne r2,r0,0x0017a620 Branch if True
0017a5f8: 00000000 nop
0017a5fc: 90620000 lbu r2,0x0000(r3) r2 = Load Cross Section
0017a600: 00000000 nop
0017a604: 3042003f andi r2,r2,0x003f If Cross Section
0017a608: 10470005 beq r2,r7,0x0017a620 Branch if True
0017a60c: 00000000 nop
0017a610: 90620005 lbu r2,0x0005(r3) r2 = Load 5th byte (?)
0017a614: 24c60001 addiu r6,r6,0x0001 r6++
0017a618: 0805e98b j 0x0017a62c
0017a61c: 34420040 ori r2,r2,0x0040 r2 = 0x0040
0017a620: 90620005 lbu r2,0x0005(r3) r2 = Load 5th byte (?)
0017a624: 00000000 nop
0017a628: 304200bf andi r2,r2,0x00bf r2 = 0x00bf
0017a62c: a0620005 sb r2,0x0005(r3) Save 0x40 (Cross Section) or 0xbf
0017a630: 24630008 addiu r3,r3,0x0008 Next Tile
0017a634: 24a50001 addiu r5,r5,0x0001 r5++
0017a638: 28a20200 slti r2,r5,0x0200 If r5 < 0x200
0017a63c: 1440ffe6 bne r2,r0,0x0017a5d8 Branch Back
0017a640: 24840005 addiu r4,r4,0x0005 Next Tile
0017a644: 03e00008 jr r31
0017a648: 00c01021 addu r2,r6,r0 r2 = 0x200

Anyone know what a Cross Section is?

Cross Section Identification 2

0017a64c: 00003021 addu r6,r0,r0 r6 = 0
0017a650: 00002821 addu r5,r0,r0 r5 = Loop Counter
0017a654: 3407003f ori r7,r0,0x003f r7 = If Cross Section
0017a658: 3c038019 lui r3,0x8019
0017a65c: 2463f8cc addiu r3,r3,-0x0734 r3 = Tile Data (18f8cc)
0017a660: 3c048019 lui r4,0x8019
0017a664: 24842dd8 addiu r4,r4,0x2dd8 r4 = Tile Grid Data (192dd8)
0017a668: 90820001 lbu r2,0x0001(r4) r2 = Load Tile Targeted
0017a66c: 00000000 nop
0017a670: 1040000f beq r2,r0,0x0017a6b0 Branch if not targeted
0017a674: 00000000 nop
0017a678: 90620006 lbu r2,0x0006(r3) Load Tile Unselectable
0017a67c: 00000000 nop
0017a680: 30420001 andi r2,r2,0x0001 If Tile is Unselectable
0017a684: 1440000a bne r2,r0,0x0017a6b0 Branch if True
0017a688: 00000000 nop
0017a68c: 90620000 lbu r2,0x0000(r3) Load Tile Geomancy
0017a690: 00000000 nop
0017a694: 3042003f andi r2,r2,0x003f If Tile = Cross Section
0017a698: 10470005 beq r2,r7,0x0017a6b0 Branch if not Cross Section
0017a69c: 00000000 nop
0017a6a0: 90620005 lbu r2,0x0005(r3) Load ?
0017a6a4: 24c60001 addiu r6,r6,0x0001 r6++
0017a6a8: 0805e9af j 0x0017a6bc
0017a6ac: 34420040 ori r2,r2,0x0040 5th byte = 0x0040
0017a6b0: 90620005 lbu r2,0x0005(r3) Load ?
0017a6b4: 00000000 nop
0017a6b8: 304200bf andi r2,r2,0x00bf 5th byte = 0x00bf
0017a6bc: a0620005 sb r2,0x0005(r3) Save 0x0040 or 0x00bf to 5th byte
0017a6c0: 24630008 addiu r3,r3,0x0008 Next Tile
0017a6c4: 24a50001 addiu r5,r5,0x0001 Loop Counter++
0017a6c8: 28a20200 slti r2,r5,0x0200 If Loop Counter < 0x0200
0017a6cc: 1440ffe6 bne r2,r0,0x0017a668 Branch Back if True
0017a6d0: 24840005 addiu r4,r4,0x0005 Next Tile
0017a6d4: 03e00008 jr r31
0017a6d8: 00c01021 addu r2,r6,r0 r2 = Number of loops

Can you spot the difference? Neither can I.

You can find the rest of all the routines I annotated starting from here at the FFH wiki.

Quote from: Choto on May 30, 2014, 08:25:36 pm
idk why psx disassembled like that... but take this. It's a disassembly of scus and battle.bin (and also another file with World.bin and Wldcore). So all you need to do is ctrl-F the address you're looking for and it will take you right to the routine. Then you can copypaste it wherever you want. Just convenient

It disassembled like that because I was being sloppy. But thanks. This'll be a great help and it'll save me some time.

And for Celdia, here's my fftpatch I used in testing. Use it, see if it still crashes. I can't get my game to crash though, even after using Weapon Strike/Range.

Celdia

Tried your fftp, Doku. The only change is now I get an unhandled exception error that actually crashes the emulator entirely instead of just freezing the game. I don't know what I'm doing differently from you here, but I can't get it to work.

Choto

June 02, 2014, 07:36:55 pm #33 Last Edit: June 02, 2014, 07:47:57 pm by Choto
Ok.. i'll try to shed some light on what I can.

First, be aware that andi r2, r2, 0xbf removes the 0x40 flag. (0xff - 0x40 = 0xbf). This is commonly referred to as "masking bits". You AND the byte with whatever bits you want to stay, and the rest get set to 0. Conversely, ori r2, r2, 0x40 adds the 0x40 flag. (0x00 + 0x40 = 0x40). Only one of the previous operations are done in the routines you mentioned per loop, so either the flag is being added or removed to each tile.

The 0x80192dd8 + 0x500 is pointing to the higher plane of panels (for when there's a bridge or something). So each panel has 0x05 bytes of data in that section and there are 0x10 X and 0x10 Y. 5*0x10*0x10 = 0x500 bytes of data for each plane of tiles. (Theoretically, there are 0x10 by 0x10 panels for each plane... if you had a map with a higher and lower panel at each location on the map, the game needs to account for this and there would be 0x500 + 0x500 tiles total.) Conveniently, say you need to find the bridge panel in Zirekile Falls. Find its lower panel location (0x192dd8 + whatever) and add 0x500, and you'll have the location for the bridge panel. Sorry if that was mad confusing.

Ya 0x17a6dc routines seems borked. I'm not quite sure what they intended but it could very easily be repurposed to target all allies and target all enemies. r23 seems to have meant to be the Team Indicator (target allies or target enemies). Maybe they realized they could just make 255 aoe and the target ally/target enemy flags.

In any case, Free space for us!

I marked up the first cross section routine. It seems to either store or remove the 0x40 flag in 0x05 of tile data (0x182fcc) based on wether or not a tile type is found for that panel. Then it returns the number of tiles with tile type ID's not equal to 0.

0017a5bc: 00003021 addu r6,r0,r0            r6 = 0
0017a5c0: 00002821 addu r5,r0,r0            r5 = 0
0017a5c4: 3407003f ori r7,r0,0x003f            r7 = 0x003f
0017a5c8: 3c038019 lui r3,0x8019
0017a5cc: 2463f8cc addiu r3,r3,-0x0734         r3 = Tile Data (0x18f8cc)
0017a5d0: 3c048019 lui r4,0x8019
0017a5d4: 24842dd8 addiu r4,r4,0x2dd8         r4 = Tile Grid Data (0x192dd8)
0017a5d8: 90820000 lbu r2,0x0000(r4)         r2 = Tile's Range
0017a5dc: 00000000 nop
0017a5e0: 1040000f beq r2,r0,0x0017a620         Branch if Range = 0 (tile not considered)
0017a5e4: 00000000 nop
0017a5e8: 90620006 lbu r2,0x0006(r3)         r2 = Load Select/Targetable
0017a5ec: 00000000 nop
0017a5f0: 30420001 andi r2,r2,0x0001         If Tile is Unselectable
0017a5f4: 1440000a bne r2,r0,0x0017a620         Branch if True
0017a5f8: 00000000 nop
0017a5fc: 90620000 lbu r2,0x0000(r3)         r2 = Load tile type
0017a600: 00000000 nop
0017a604: 3042003f andi r2,r2,0x003f         Mask off higher bits (those tile type ID's are not used)
0017a608: 10470005 beq r2,r7,0x0017a620         Branch if no tile type found
0017a60c: 00000000 nop
0017a610: 90620005 lbu r2,0x0005(r3)         r2 = Load 5th byte (?)
0017a614: 24c60001 addiu r6,r6,0x0001         counter++
0017a618: 0805e98b j 0x0017a62c
0017a61c: 34420040 ori r2,r2,0x0040            add 0x0040 flag (some targeting thing?)
0017a620: 90620005 lbu r2,0x0005(r3)         r2 = Load 5th byte (?)
0017a624: 00000000 nop
0017a628: 304200bf andi r2,r2,0x00bf         r2 = 0x00bf (remove 0x40 flag)
0017a62c: a0620005 sb r2,0x0005(r3)            save original value either WITH 0x40 or WITHOUT 0x40
0017a630: 24630008 addiu r3,r3,0x0008         Next Tile
0017a634: 24a50001 addiu r5,r5,0x0001         r5++ (Do for all tiles on this plane)
0017a638: 28a20200 slti r2,r5,0x0200         If r5 < 0x200
0017a63c: 1440ffe6 bne r2,r0,0x0017a5d8         Branch Back
0017a640: 24840005 addiu r4,r4,0x0005         Next Tile
0017a644: 03e00008 jr r31
0017a648: 00c01021 addu r2,r6,r0            r2 = number of tiles found (r6 is only incremented if 0x05 in 0x182fcc data is not 0


Still have no clue what that does because I'm not sure about that 0x40 flag. It must have something to do with targeting. That's wierd I thought I knew what that flag was.... anyway onto the next one:

Cross Section Identification 2
0017a64c: 00003021 addu r6,r0,r0               r6 = 0
0017a650: 00002821 addu r5,r0,r0               r5 = Loop Counter
0017a654: 3407003f ori r7,r0,0x003f               r7 = 0x3f
0017a658: 3c038019 lui r3,0x8019
0017a65c: 2463f8cc addiu r3,r3,-0x0734            r3 = Tile Data (18f8cc)
0017a660: 3c048019 lui r4,0x8019
0017a664: 24842dd8 addiu r4,r4,0x2dd8            r4 = Tile Grid Data (192dd8)
0017a668: 90820001 lbu r2,0x0001(r4)            r2 = Load Tile Targeted
0017a66c: 00000000 nop
0017a670: 1040000f beq r2,r0,0x0017a6b0            Branch if not targeted
0017a674: 00000000 nop
0017a678: 90620006 lbu r2,0x0006(r3)            Load Tile Unselectable
0017a67c: 00000000 nop
0017a680: 30420001 andi r2,r2,0x0001            If Tile is Unselectable
0017a684: 1440000a bne r2,r0,0x0017a6b0            Branch if True
0017a688: 00000000 nop
0017a68c: 90620000 lbu r2,0x0000(r3)            Load Tile Type
0017a690: 00000000 nop
0017a694: 3042003f andi r2,r2,0x003f            mask off higher unused bits
0017a698: 10470005 beq r2,r7,0x0017a6b0            Branch if no valid tile ID found
0017a69c: 00000000 nop
0017a6a0: 90620005 lbu r2,0x0005(r3)            Load targeting flags?
0017a6a4: 24c60001 addiu r6,r6,0x0001            number of targeted tiles++
0017a6a8: 0805e9af j 0x0017a6bc
0017a6ac: 34420040 ori r2,r2,0x0040               add 0x40 flag
0017a6b0: 90620005 lbu r2,0x0005(r3)            Load targeting flags
0017a6b4: 00000000 nop
0017a6b8: 304200bf andi r2,r2,0x00bf            remove 0x40 flag
0017a6bc: a0620005 sb r2,0x0005(r3)               save flags either WITH 0x40 or WITHOUT 0x40
0017a6c0: 24630008 addiu r3,r3,0x0008            Next Tile
0017a6c4: 24a50001 addiu r5,r5,0x0001            Do for all tiles on this plane
0017a6c8: 28a20200 slti r2,r5,0x0200            If Loop Counter < 0x0200
0017a6cc: 1440ffe6 bne r2,r0,0x0017a668            Branch Back if True
0017a6d0: 24840005 addiu r4,r4,0x0005            Next Tile
0017a6d4: 03e00008 jr r31
0017a6d8: 00c01021 addu r2,r6,r0               r2 = Number of targeted tiles found


The only difference with this routine is this line:
0017a668: 90820001 lbu r2,0x0001(r4)            r2 = Load Tile Targeted

So I think that the first routine counts the number of Targetable (red) panels and returns that number after giving them the 0x40 flag. The second counts the number of Targeted (YELLOW) panels and returns that number after giving them the 0x40 flag.

So I guess the 0x40 flag means "Targeted or Targetable"? That's all I got.

Also, holy fuckin thanks for adding those routines on the wiki!

Dokurider

June 03, 2014, 04:12:22 pm #34 Last Edit: June 03, 2014, 04:24:03 pm by Dokurider
Don't despair yet, Celdia. I'm working on an update for Conic AoE. I wanted to release it today because it was supposed to be some simple changes (proper resizing when against a border, etc.), but I got bogged down by my own retarded mistakes. I'll see if I can release it tomorrow.

QuoteThe 0x80192dd8 + 0x500 is pointing to the higher plane of panels (for when there's a bridge or something). So each panel has 0x05 bytes of data in that section and there are 0x10 X and 0x10 Y. 5*0x10*0x10 = 0x500 bytes of data for each plane of tiles. (Theoretically, there are 0x10 by 0x10 panels for each plane... if you had a map with a higher and lower panel at each location on the map, the game needs to account for this and there would be 0x500 + 0x500 tiles total.) Conveniently, say you need to find the bridge panel in Zirekile Falls. Find its lower panel location (0x192dd8 + whatever) and add 0x500, and you'll have the location for the bridge panel. Sorry if that was mad confusing.


Actually, I understand higher panels all too well. No, what I was trying to get at was why use +0x500 when it could have just +0x100 just as easily.

QuoteSo I think that the first routine counts the number of Targetable (red) panels and returns that number after giving them the 0x40 flag. The second counts the number of Targeted (YELLOW) panels and returns that number after giving them the 0x40 flag.

So I guess the 0x40 flag means "Targeted or Targetable"? That's all I got.

One of them is the ending routine for Vertical Threshold/Unknown Flag 1 and 2 and the other is for all the rest. I'm thinking it's some kind of setup for parsing.

While I was experimenting around, I tried to give another skill Linear AoE. While the AoE did come out linear, the range wasn't. I think this means that Linear Range is actually hardcoded to slots instead of being directly tied to the Linear Flag and the shape of the AoE itself. This means that Choto's Flame Wall (as well as easily dealing with Conic AoE's directional nightmare) is genuinely a possibility.

EDIT:
http://finalfantasy.wikia.com/wiki/Lionel_Castle#Lionel_Castle_Oratory
Is...that cross...supposed to be the alleged Cross Section?
faceinhands.jpg

Celdia

Quote from: Dokurider on June 03, 2014, 04:12:22 pm
http://finalfantasy.wikia.com/wiki/Lionel_Castle#Lionel_Castle_Oratory
Is...that cross...supposed to be the alleged Cross Section?
faceinhands.jpg


Actually, if you meant the cross statue behind the altar, that comes up as Furniture. Cross Section is shown in the picture here.

Dokurider

Attached is the updated Conic AoE. Removed a possible conflict, AoE now properly resizes when against the map border, and a general slim down of the code. It should also be able to handle map sizes larger than 0x000f now. See if this version works for you, Celdia. If it doesn't, tell me the map, and secondary you are using.

To do:
Fix resizing issue when Caster is far away from the border
Deal with Cone AoE targeting untargetable tiles
Find out what happens when you use the AoE off of higher elevation.


I made a really interesting discovery today, one that some, maybe many, people already know about, but I sure as hell didn't.


Vertical Fixed Routine
r4 = Caster X
r5 = Caster Y
0017a7bc: 308400ff andi r4,r4,0x00ff r4 = Caster X
0017a7c0: 30a500ff andi r5,r5,0x00ff                r5 = Caster Y
0017a7c4: 00a05021 addu r10,r5,r0 r10 = Caster Y
0017a7c8: 2406ffe1 addiu r6,r0,-0x001f r6 = -0x001f
0017a7cc: 3c0c8019 lui r12,0x8019
0017a7d0: 258c2dd8 addiu r12,r12,0x2dd8 r12 = Tile Grid Data (0x192dd8)
0017a7d4: 258d0500 addiu r13,r12,0x0500 r13 = 0x1932d8 (?)
0017a7d8: 340b0001 ori r11,r0,0x0001 r11 = True
0017a7dc: 3c08800e lui r8,0x800e
0017a7e0: 91084e9c lbu r8,0x4e9c(r8) r8 = Max Map X
0017a7e4: 00000000 nop
0017a7e8: 01480018 mult r10,r8 Caster Y * Max X
0017a7ec: 00864821 addu r9,r4,r6 r9 = Caster X - 0x001f
0017a7f0: 00001012 mflo r2
0017a7f4: 00491821 addu r3,r2,r9 r3 = (Caster Y * Max X) + (Caster X - 0x001f)
0017a7f8: 00031080 sll r2,r3,0x02
0017a7fc: 00433821 addu r7,r2,r3 r7 = Tile ID
0017a800: 0520000a bltz r9,0x0017a82c Branch if Caster X -0x1f is negative
0017a804: 00ec1821 addu r3,r7,r12 r3 = Current Tile Data
0017a808: 0128102a slt r2,r9,r8 If Caster X- < Max X
0017a80c: 10400007 beq r2,r0,0x0017a82c Branch if False
0017a810: 00000000 nop
0017a814: 90620000 lbu r2,0x0000(r3) r2 = Current Tile's Range
0017a818: 00000000 nop
0017a81c: 10400003 beq r2,r0,0x0017a82c Branch if no Range
0017a820: 00ed1021 addu r2,r7,r13 r2 = Tile ID + 0x500
0017a824: a06b0001 sb r11,0x0001(r3) Current Tile = Targeted
0017a828: a04b0001 sb r11,0x0001(r2) Current Tile + 0x500 = Targeted
0017a82c: 24c60001 addiu r6,r6,0x0001 r6++
0017a830: 28c20020 slti r2,r6,0x0020 if r6 < 0x20
0017a834: 1440ffe9 bne r2,r0,0x0017a7dc Branch if True
0017a838: 00804821 addu r9,r4,r0 r9 = Caster X
0017a83c: 2406ffe1 addiu r6,r0,-0x001f r6 = -0x001f
0017a840: 3c088019 lui r8,0x8019                   
0017a844: 25082dd8 addiu r8,r8,0x2dd8               r8 = Tile Grid Data (0x192dd8)
0017a848: 250b0500 addiu r11,r8,0x0500              r11 = 0x1932d8 (?)
0017a84c: 34070001 ori r7,r0,0x0001 r7 = True
0017a850: 3c02800e lui r2,0x800e
0017a854: 90424e9c lbu r2,0x4e9c(r2) r2 = Max Map X
0017a858: 00a65021 addu r10,r5,r6                   r10 = Caster Y - 0x001f
0017a85c: 01420018 mult r10,r2                      (Caster Y - 0x001f) * Max X
0017a860: 00001012 mflo r2
0017a864: 00491821 addu r3,r2,r9 r3 = (Caster Y - 0x001f) * Max X + Caster X
0017a868: 00031080 sll r2,r3,0x02 r2 = Tile ID
0017a86c: 00432021 addu r4,r2,r3 r4 = Tile ID + Tile ID
0017a870: 0540000d bltz r10,0x0017a8a8 Branch if (Caster Y - 0x001f) is negative
0017a874: 00881821 addu r3,r4,r8 r3 = Current Tile Data
0017a878: 3c02800e lui r2,0x800e
0017a87c: 90424ea0 lbu r2,0x4ea0(r2) r2 = Max Map Y
0017a880: 00000000 nop
0017a884: 0142102a slt r2,r10,r2 If (Caster Y - 0x001f) < Max Y
0017a888: 10400007 beq r2,r0,0x0017a8a8 Branch if False
0017a88c: 00000000 nop
0017a890: 90620000 lbu r2,0x0000(r3) r2 = Current Tile's Range
0017a894: 00000000 nop
0017a898: 10400003 beq r2,r0,0x0017a8a8 Branch if Range = 0
0017a89c: 008b1021 addu r2,r4,r11 r2 = Current Tile Data + 0x500
0017a8a0: a0670001 sb r7,0x0001(r3) Current Tile = Targeted
0017a8a4: a0470001 sb r7,0x0001(r2) Current Tile + 0x500 = Targeted
0017a8a8: 24c60001 addiu r6,r6,0x0001 r6++
0017a8ac: 28c20020 slti r2,r6,0x0020 If r6 < 0x20
0017a8b0: 1440ffe7 bne r2,r0,0x0017a850 Branch Back if True
0017a8b4: 00000000 nop
0017a8b8: 03e00008 jr r31
0017a8bc: 00000000 nop

Notice anything odd about this routine? That for a routine that's supposed to handle, y'know, vertical, it, at no point, even considers vertical. You see, through some experimentation last night, I actually found that Vertical Fixed actually determines whether a skill has Linear AoE. wat? It's confirmed after I made Cure Linear and gave Earth Slash normal range. I'm not even sure if this flag even handles vertical anymore.

So, when you guys play around with Cone AoE and give a range over 1, please flag it as 'Vertical Fixed', because that's what I originally coded for.

QuoteCross Section

Ooohhh. That makes much more sense.

Celdia

Gave it a go. Still hanging when I try to select a target tile, but the error output is a LOT goddamned shorter now. Also tried swapping between my .fftp and yours to see if there was any difference but the error comes out the same, as seen below. First try was Chemist with Battle Skill secondary, 2nd try was Battle Skill alone with no secondary. All testing was done at Doguola Pass, from about the middle of the map, with no targeting tiles outside of the bounds of the map.

Dokurider

I wish someone else was trying this out so I'd have a better idea of what's happening here. What bios are you using?

Dokurider

Actually I have a more productive idea.  In fftp, go to slot 0183 in ENTD, make your changes to Ramza, then start a new game. If THAT doesn't work, then make a save state and send it to me and I'll download it tomorrow.