Chocobo Check

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
ROUTINE : CHOCOBO CHECK
 PARAMETERS: r4 = Unit data pointer
 RETURNS:  r2 = 0x00 if unit not mountable (because of status or not a chocobo)
           r2 = 0x01 if unit is a mountable chocobo, not ridden
           r2 = 0x02 if unit is a mountable chocobo already ridden  (mount info <> 0x00 (unit data 0x182))
-------------------------------------------------------------------------------------------------------------- 
001743c8: 27bdffe8 addiu r29,r29,0xffe8     |
001743cc: afb00010 sw r16,0x0010(r29)       |
001743d0: 00808021 addu r16,r4,r0           |r16 = unit data pointer
001743d4: afbf0014 sw r31,0x0014(r29)       |
001743d8: 92020003 lbu r2,0x0003(r16)       |r2 = unit JOB ID
001743dc: 00000000 nop                      |
001743e0: 2442ffa2 addiu r2,r2,-0x005e      |r2 = r2 - 0x5E  (Chocobo Job ID = 0x5e)
001743e4: 2c420003 sltiu r2,r2,0x0003       |r2 = 0x01 if Unit job ID is 0x5e, 0x5f or 0x60  (Note: r2 is unsigned so can only happen for jobs 0x5E - 0x60)
001743e8: 10400005 beq r2,r0,0x00174400     #If Unit has the job chocobo /Else branch then jump to End with r2 = 0x00
001743ec: 02002021 addu r4,r16,r0                |r4 = unit data pointer
001743f0: 0c01786c jal 0x0005e1b0                |-->Status set check Check if unit has a unmountable status - return r2 = 0x01 if so
001743f4: 3405000a ori r5,r0,0x000a              |r5 = 0x0A (set to check in the routine above)
001743f8: 10400003 beq r2,r0,0x00174408          #If unit have one of the checked status / Else branch to mount info check
001743fc: 00000000 nop                               | 
00174400: 0805d107 j 0x0017441c             #Else    |>> jump to End (r2 = 0x00)  Not a chocobo or chocobo not mountable
00174404: 00001021 addu r2,r0,r0                     
00174408: 92030182 lbu r3,0x0182(r16)            #Else   r3 = Unit mount info (unit has no unmountable status)
0017440c: 00000000 nop                           |
00174410: 14600002 bne r3,r0,0x0017441c          #if unit is not riding or being ridden /Else branch to End With r2 = 0x02
00174414: 34020002 ori r2,r0,0x0002              |r2 = 0x02
00174418: 34020001 ori r2,r0,0x0001                  |r2 = 0x01
0017441c: 8fbf0014 lw r31,0x0014(r29)       |End
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