Chocobo Check

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

ROUTINE : CHOCOBO CHECK

  PARAMETERS:
     r4 = Unit
  
  RETURNS:
     r2   =   0, If proper statuses not found and/or unit is not a chocobo
           1, If unit is a chocobo with proper status and riding check was not passed
           2, If unit is a chocobo with proper status and riding check was passed

SECTION 1 : SET UP ROUTINE AND CALL OTHER ROUTINE

001743c8: 27bdffe8 addiu r29,r29,0xffe8
001743cc: afb00010 sw r16,0x0010(r29)
001743d0: 00808021 addu r16,r4,r0
001743d4: afbf0014 sw r31,0x0014(r29)
001743d8: 92020003 lbu r2,0x0003(r16)         #   r2 = [Current job ID of unit]
001743dc: 00000000 nop
001743e0: 2442ffa2 addiu r2,r2,0xffa2         #   r2 = r2 - 0x5E (94)
001743e4: 2c420003 sltiu r2,r2,0x0003         #   IF (Unit is not a chocobo)   Note: Condition is (UNSIGNED r2 < 3); can only happen for jobs 0x5E - 0x60
001743e8: 10400005 beq r2,r0,0x 00174400         #      RETURN 0
001743ec: 02002021 addu r4,r16,r0         
001743f0: 0c01786c jal 0x0005e1b0            #   Routine: Check status flags (r4 = current unit, r5 = 10)
001743f4: 3405000a ori r5,r0,0x000a            
001743f8: 10400003 beq r2,r0,0x 00174408         #   IF (Routine result == 0)
001743fc: 00000000 nop                     #      JUMP to [SECTION 2]
00174400: 0805d107 j 0x 0017441c               #   RETURN 0
00174404: 00001021 addu r2,r0,r0

SECTION 2 : CHECK RIDDEN UNIT

00174408: 92030182 lbu r3,0x0182(r16)
0017440c: 00000000 nop
00174410: 14600002 bne r3,r0,0x 0017441c         #   IF (Something to do with riding?)
00174414: 34020002 ori r2,r0,0x0002            #      RETURN 2
00174418: 34020001 ori r2,r0,0x0001            #    RETURN 1

SECTION 3 : RETURN r2

0017441c: 8fbf0014 lw r31,0x0014(r29)
00174420: 8fb00010 lw r16,0x0010(r29)
00174424: 27bd0018 addiu r29,r29,0x0018
00174428: 03e00008 jr r31
0017442c: 00000000 nop


Return Locations

00174844: Store movement stuff into scratch pad
00174994: Store movement stuff into scratch pad
0017de2c: Check if another unit is on the same Tile