Get unit misc data that matches r4 ID

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Get unit misc data that matches r4 ID

Seems to do the same thing that Find_Current_Misc_Unit_Data_Pointer_(external_ID)?
------------------------------------------
Need r4 = Unit X ID
Return r2 = Unit X misc data pointer / If not found = 0x00
------------------------------------------
0007a724: 3c03800a lui r3,0x800a
0007a728: 8c638a54 lw r3,-0x75ac(r3)           r3 = pointer to last units misc data? ( 0x80098a54 ) 
0007a72c: 00000000 nop
0007a730: 1060000e beq r3,r0,0x0007a76c        #If r3 <> 0x00  (skip if unit is the first unit ?) / Else branch to END
0007a734: 00001021 addu r2,r0,r0                   |return r2 = 0
0007a738: 3084ffff andi r4,r4,0xffff               |r4 = r4 last 2 bytes
0007a73c: 8c620134 lw r2,0x0134(r3)                @  r2 = units data ( 0x80098b88 ) 
0007a740: 00000000 nop                        
0007a744: 10400005 beq r2,r0,0x0007a75c                #If r2 <> 0x00 - Else branch (scan previous unit)
0007a748: 00000000 nop                                     |
0007a74c: 9042018a lbu r2,0x018a(r2)                       |r2 = unit ID (unit data 0x018a )
0007a750: 00000000 nop                                     |
0007a754: 10440005 beq r2,r4,0x0007a76c                    #If r2 <> r4 (Inherited unit ID from call) / Else branch to END (with r2 = r4's unit pointer) if unit ID is the last unit ID?
0007a758: 00601021 addu r2,r3,r0			    |r2 = r3 (=r4's unit misc data pointer)
0007a75c: 8c630000 lw r3,0x0000(r3)                    E#      |load previous units misc data
0007a760: 00000000 nop                                         |
0007a764: 1460fff5 bne r3,r0,0x0007a73c            >step back until first unit is reached
0007a768: 00001021 addu r2,r0,r0                      |return r2 = 0?
0007a76c: 03e00008 jr r31
0007a770: 00000000 nop

Return location

0006847c: X/Y_Data_Gathering_for_Attacks?
000686e4: AT_List_Check_if_Unit_is_Charging_Ability
00068840: Set_evade_special_effects_based_on_Evade_Type
00068ba8: Set_targets_animation_2
00068bb0: Set_targets_animation_2
00068ea8: Special_Status_Flag_Enabling?
00068c98: Call_Bow_Hardcoding_routine
00068ca4: Call_Bow_Hardcoding_routine
00068e68: Jump_to_68d08_2
00069110: Jump_to_set_item_graphic/palette
0006bd14: 0006bce4_-_0006bda4
0006d4b8: 0006d434_-_0006d594
00070ea8: In_between_turn_events
0007175c: Get_next_acting_unit?
00072a4c: 00072a10_-_00072a84
000727ec: Movement/action_direction_setting?
000731a4: 00073164_-_000731d4
000733ac: Battle_Message_Display
000735bc: 000734cc_-_00073634
0007374c: Store_target_coordinates,_attack_display_types
00073b08: Action_phase_control
00073c24: Set_some_target_coordinates/attacker_animation,_others
00073d24: Set_some_target_coordinates/attacker_animation,_others
00073d60: Set_some_target_coordinates/attacker_animation,_others
00073e48: Set_some_target_coordinates/attacker_animation,_others
00073eb0: Set_some_target_coordinates/attacker_animation,_others
00074a74: 00074a3c_-_00074abc
00076b0c: 000769b0_-_00076b78
00077a44: 000779a0_-_00077b54
00077aec: 000779a0_-_00077b54
800774b0: ?_0x773f8  dup. 000773f8_-_0007775c
800775c0: ?_0x773f8  dup. 000773f8_-_0007775c
800776f0: ?_0x773f8  dup. 000773f8_-_0007775c
000826bc: 00082620_-_00082788
00083c94: Sprite_display_setting_for_all_units_based_on_attack
00084aa8: Load_Unit_graphics_from_sprite_sheet
0008999c: 000898a0_-_00089b9c
00089fa8: 00089f24_-_0008a114
0008a5e4: 0008a4ac_-_0008a6d4
0008abb8: 0008ab34_-_0008adf4
0008c064: 0008c054_-_0008c0a8
0008c44c: 0008c43c_-_0008c464
0008c484: Set_Unit_Xmod,_Y_Mod_and_Height_data_from_unit_ID
0008cee0: Find_Unit's_Misc_Data_Pointer_(+0x15c)
0008dcac: Find_Unit's_Misc_Data_Pointer_and_Load_Spritesheet_Value
0008dfbc: Get_Unit_Tile_data_pointer_from_Unit_ID
0008e208: 0008e1f8_-_0008e230
0008e258: 0008e234_-_0008e2c4
0008e264: 0008e234_-_0008e2c4