Difference between revisions of "Set panels affected by ability"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m (Nyzer moved page Set panels affected by ability? to Set panels affected by ability: Fucking question marks)
 
(No difference)

Latest revision as of 03:15, 19 October 2024

BATTLE.BIN - Main Skillset/ability loading
---------------------------------------------------------------------------------------
Parameter : r4 = Pointer to data coming from Acting unit misc 0x15e

Returns : r2 = Nb of targeted Tiles
---------------------------------------------------------------------------------------
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           |-->Copy_Byte_Data_(20_Bytes) Copy equivalent of misc 15e to Stack
0017a2c0: afb00040 sw r16,0x0040(r29)       |
0017a2c4: 93a30010 lbu r3,0x0010(r29)       |Caster ID
0017a2c8: 00000000 nop                      |
0017a2cc: 000310c0 sll r2,r3,0x03           |
0017a2d0: 00431023 subu r2,r2,r3            |
0017a2d4: 00021180 sll r2,r2,0x06           |Unit offset in battle stats (0x1c0)
0017a2d8: 3c038019 lui r3,0x8019            |
0017a2dc: 246308cc addiu r3,r3,0x08cc       |0x801908cc
0017a2e0: 0043a021 addu r20,r2,r3           |Pointer to Caster Battle stats
0017a2e4: 87a30012 lh r3,0x0012(r29)        |Ability ID
0017a2e8: 00000000 nop                      |
0017a2ec: 000310c0 sll r2,r3,0x03           |
0017a2f0: 00431023 subu r2,r2,r3            |
0017a2f4: 00021040 sll r2,r2,0x01           |Ability offset in data 2
0017a2f8: 3c038006 lui r3,0x8006            |
0017a2fc: 2463fbf0 addiu r3,r3,-0x0410      |0x8005fbf0
0017a300: 00431021 addu r2,r2,r3            |Pointer to Ability data 2
0017a304: 90470001 lbu r7,0x0001(r2)        |Effect Area (AoE)
0017a308: 90530000 lbu r19,0x0000(r2)       |Range
0017a30c: a3a70028 sb r7,0x0028(r29)        |save AoE to stack
0017a310: 90470002 lbu r7,0x0002(r2)        |Vertical
0017a314: 90520003 lbu r18,0x0003(r2)       |Flags 1
0017a318: a3a70030 sb r7,0x0030(r29)        |save vertical to stack
0017a31c: 90420006 lbu r2,0x0006(r2)        |Flags 4
0017a320: 00000000 nop                      |
0017a324: a3a20038 sb r2,0x0038(r29)        |save flags 4 to stack
0017a328: 92960047 lbu r22,0x0047(r20)      |Caster X coordinate
0017a32c: 92970048 lbu r23,0x0048(r20)      |Caster Y coordinate
0017a330: 0c060428 jal 0x001810a0           |-->Map Location Calculation Returns Caster Tile ID
0017a334: 02802021 addu r4,r20,r0           |send Caster data pointer
0017a338: 00402821 addu r5,r2,r0            |Caster's Tile ID
0017a33c: 000510c0 sll r2,r5,0x03           |
0017a340: 3c038019 lui r3,0x8019            |
0017a344: 2463f8cc addiu r3,r3,-0x734       |0x8018f8cc
0017a348: 00431021 addu r2,r2,r3            |Pointer to Caster Tile data
0017a34c: 3c068019 lui r6,0x8019            |
0017a350: 24c62dd8 addiu r6,r6,0x2dd8       |Pointer to targetable grid
0017a354: 90430003 lbu r3,0x0003(r2)        |Caster Tile halves + depth
0017a358: 3c04800e lui r4,0x800e            |
0017a35c: 90844e9c lbu r4,0x4e9c(r4)        |Map Max X
0017a360: 3063001f andi r3,r3,0x001f        |Keep Halves only
0017a364: 02e40018 mult r23,r4              |
0017a368: 90440002 lbu r4,0x0002(r2)        |Caster Tile Height
0017a36c: 90420003 lbu r2,0x0003(r2)        |Caster Tile Height + depth
0017a370: 00042040 sll r4,r4,0x01           |
0017a374: 00832021 addu r4,r4,r3            |height*2 + halves
0017a378: 00021142 srl r2,r2,0x05           |
0017a37c: 00021040 sll r2,r2,0x01           |Tile depth*2 only
0017a380: 0082f021 addu r30,r4,r2           |Height * 2 + Depth *2 + Halves
0017a384: 00051880 sll r3,r5,0x02           |
0017a388: 00651821 addu r3,r3,r5            |Caster Tile ID *5
0017a38c: 0066a821 addu r21,r3,r6           |Pointer to Caster Tile in Targetable grid
0017a390: 326300ff andi r3,r19,0x00ff       |Range
0017a394: 00001012 mflo r2                  |Caster Y * Max X
0017a398: 00562821 addu r5,r2,r22           |(Y*MaxX)+X
0017a39c: 340200ff ori r2,r0,0x00ff         |
0017a3a0: 1462000b bne r3,r2,0x0017a3d0     #If Range = 255
0017a3a4: 00002021 addu r4,r0,r0                |
0017a3a8: 34050001 ori r5,r0,0x0001             |
0017a3ac: 00c01821 addu r3,r6,r0                |Pointer to targetable grid
                                                @LOOP - Highlight all tiles in targetable grid
0017a3b0: a0650000 sb r5,0x0000(r3)                 |Store 0x01 at 0x00
0017a3b4: a0600001 sb r0,0x0001(r3)                 |Disable green panel 
0017a3b8: 24840001 addiu r4,r4,0x0001               |Counter +1
0017a3bc: 28820200 slti r2,r4,0x0200                |check limit
0017a3c0: 1440fffb bne r2,r0,0x0017a3b0         Λ Loop 0x200 times
0017a3c4: 24630005 addiu r3,r3,0x0005               |Targetable grid offset
0017a3c8: 0805e912 j 0x0017a448                 >>Avoid not 255 section
0017a3cc: 32420001 andi r2,r18,0x0001           |
                                            Else : Range <> 0x255
0017a3d0: 00c01821 addu r3,r6,r0                |Pointer to targetable grid
                                                @LOOP - reset all tiles in targetable grid
0017a3d4: a0600000 sb r0,0x0000(r3)                 |Nullify 0x00
0017a3d8: a0600001 sb r0,0x0001(r3)                 |Nullify 0x01
0017a3dc: 24840001 addiu r4,r4,0x0001               |Counter + 1
0017a3e0: 28820200 slti r2,r4,0x0200                |
0017a3e4: 1440fffb bne r2,r0,0x0017a3d4         Λ Loop 0x200 times
0017a3e8: 24630005 addiu r3,r3,0x0005               |Targetable grid offset
0017a3ec: 00051880 sll r3,r5,0x02                   |
0017a3f0: 00651821 addu r3,r3,r5                |Caster Tile ID*5  (without elevation)
0017a3f4: 3c028019 lui r2,0x8019                |
0017a3f8: 24422dd8 addiu r2,r2,0x2dd8           |
0017a3fc: 00628021 addu r16,r3,r2               |Pointer to Caster tile in targetable grid (low elevation)
0017a400: 26640001 addiu r4,r19,0x0001          |Ability Range +1
0017a404: 24420500 addiu r2,r2,0x0500           |
0017a408: 00628821 addu r17,r3,r2               |Pointer to Caster tile in targetable grid (high elevation)
0017a40c: 34020001 ori r2,r0,0x0001             |
0017a410: a2040000 sb r4,0x0000(r16)            |Store range at 0x00  low
0017a414: a2240000 sb r4,0x0000(r17)            |Store range at 0x00 high
0017a418: a2020001 sb r2,0x0001(r16)            |Enable green panel
0017a41c: 32420020 andi r2,r18,0x0020           |
0017a420: 10400006 beq r2,r0,0x0017a43c         #If Ability has [Weapon Range]
0017a424: 02602021 addu r4,r19,r0               |r4 = range
0017a428: 0c05e688 jal 0x00179a20                   |-->Set targeting for weapon attack?
0017a42c: 02802021 addu r4,r20,r0                   |Send Pointer to Caster battle stats
0017a430: a2000000 sb r0,0x0000(r16)                |Nullify Range from Caster Panel
0017a434: 0805e911 j 0x0017a444                     >>Calculate tiles hit by ability
0017a438: a2200000 sb r0,0x0000(r17)                |Nullify Range from Caster Panel+
0017a43c: 0c05e546 jal 0x00179518               |-->Calculate Tiles Hit by Ability Spread an AoE Aroud Caster tile (based on ability's range)
0017a440: 00002821 addu r5,r0,r0                |
0017a444: 32420001 andi r2,r18,0x0001           |If Can't Target Self
0017a448: 10400002 beq r2,r0,0x0017a454         #If Ability has [Can't Target Self]
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         #If Ability has [Vertical fixed]
0017a458: 02c02021 addu r4,r22,r0                   |send Caster X
0017a45c: 0c05e9ef jal 0x0017a7bc                   |-->Vertical Fixed Routine
0017a460: 02e02821 addu r5,r23,r0                   |send Caster Y
0017a464: 32420008 andi r2,r18,0x0008           |Vertical  Tolerance ?
0017a468: 10400005 beq r2,r0,0x0017a480         #If Ability has [Vertical tolerance]
0017a46c: 33c400ff andi r4,r30,0x00ff               |Caster Tile Height Value 
0017a470: 93a70030 lbu r7,0x0030(r29)               | load vertical from stack
0017a474: 00003021 addu r6,r0,r0                    |r6 = 0
0017a478: 0c05e4a9 jal 0x001792a4                   |-->Check Vert Tolerance and if Tiles can be Chosen
0017a47c: 00e02821 addu r5,r7,r0                    |Send Ability Vertical
0017a480: 93a70028 lbu r7,0x0028(r29)           | Load AoE from Stack
0017a484: 00000000 nop                          |
0017a488: 10e00006 beq r7,r0,0x0017a4a4         #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                |
0017a49c: 10400004 beq r2,r0,0x0017a4b0             #If Ability don' have [Stop at obstacle]  Avoid Next routine
0017a4a0: 324200c0 andi r2,r18,0x00c0                   |If Unknown Flags 0x80/0x40 (!!!)
0017a4a4: 0c05e497 jal 0x0017925c               |-->Clear Some stuff for Untargetable Terrain
0017a4a8: 00000000 nop                          |
0017a4ac: 324200c0 andi r2,r18,0x00c0           |If Unknown Flags 0x80/0x40 (!!!)
0017a4b0: 10400003 beq r2,r0,0x0017a4c0         #If Ability has Flags1 0x80 or 0x40
0017a4b4: 02802021 addu r4,r20,r0                   |r4 = Caster Data
0017a4b8: 0c05e9b7 jal 0x0017a6dc                   |-->Target Ally/Enemy with Range Routine
0017a4bc: 02402821 addu r5,r18,r0                   |r5 = Ability Flags 1
0017a4c0: 324200d0 andi r2,r18,0x00d0           |If [Force Self Target] 0x40 or Linear
0017a4c4: 14400005 bne r2,r0,0x0017a4dc         #If Ability don't have  Flags1 Force self Target , 0x40 nor Linear
0017a4c8: 00000000 nop                              |
0017a4cc: 0c05e96f jal 0x0017a5bc                   |-->Identify Cross Sections Routine
0017a4d0: 00000000 nop                              |
0017a4d4: 0805e939 j 0x0017a4e4                     >>Exit
0017a4d8: 00000000 nop                              |
                                                Else
0017a4dc: 0c05e993 jal 0x0017a64c                   |-->Identify Cross Sections Routine (Clone)
0017a4e0: 00000000 nop                              |
0017a4e4: 8fbf0064 lw r31,0x0064(r29)       END
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

Return location

Battle.bin
0017aa9c: Calculate_Target_Panels