Handle Tutorial Command

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: HANDLE TUTORIAL COMMAND
#       Handles a tutorial command.
#       Returns:
#           r2 = ?
Commands

ID          Length      Purpose                     Parameter(s)
----------------------------------------------------------------
< 0x10      1           Left shift??                None
0x10        4           Display Message             MessageID (2 bytes), Y (1 byte)
0x11        3           Change Dialog?              MessageID (2 bytes)
0x12        1           Wait for message?           None
0x13        6           Draw Circle                 X (1 byte), Y (1 byte), Size (1 byte), Width Modifier (1 byte), Height Modifier (1 byte)
0x14        1           Wait (for something)?       None
0x15        2           Wait (specified time)       Time (1 byte)
0x16        1           Wait for message?           None
0x17        1           End tutorial                None
8012dae0: 27bdffe0 addiu r29,r29,-0x0020
8012dae4: afbf001c sw r31,0x001c(r29)
8012dae8: afbe0018 sw r30,0x0018(r29)
8012daec: 03a0f021 addu r30,r29,r0
8012daf0: 3c028019 lui r2,0x8019
8012daf4: 9042e48c lbu r2,-0x1b74(r2)               #   *0x8018e48c
8012daf8: 00000000 nop
8012dafc: 14400004 bne r2,r0,0x8012db10             #   if (*0x8018e48c == 0) {
8012db00: 00000000 nop
8012db04: 34020001 ori r2,r0,0x0001
8012db08: 0804b72f j 0x8012dcbc                     #       return 1;
8012db0c: 00000000 nop                              #   }
8012db10: 00002021 addu r4,r0,r0
8012db14: 0c0076d6 jal 0x8001db58                   #   buttonInput = Get Inverted Button Input ();
8012db18: 00000000 nop
8012db1c: 3c01801d lui r1,0x801d
8012db20: ac22c578 sw r2,-0x3a88(r1)                #   *0x801cc578 = buttonInput
8012db24: 3c02801d lui r2,0x801d
8012db28: 8c42c578 lw r2,-0x3a88(r2)                #   buttonInput
8012db2c: 3403090c ori r3,r0,0x090c                 #   0x90c (L1 + R1 + Select + Start)
8012db30: 14430003 bne r2,r3,0x8012db40             #   if (buttonInput == 0x90c) {
8012db34: 00000000 nop
8012db38: 0c04af67 jal 0x8012bd9c                   #       0012bd9c - 0012bdb8();     // Restart?
8012db3c: 00000000 nop                              #   }
8012db40: 3c02801d lui r2,0x801d
8012db44: 9442c578 lhu r2,-0x3a88(r2)               #   buttonInput
8012db48: 3c018019 lui r1,0x8019
8012db4c: a4223cb2 sh r2,0x3cb2(r1)                 #   *0x80193cb2 = buttonInput
8012db50: 3c028019 lui r2,0x8019
8012db54: 84423cb0 lh r2,0x3cb0(r2)                 #   *0x80193cb0
8012db58: 00000000 nop
8012db5c: 10400003 beq r2,r0,0x8012db6c             #   if (*0x80193cb0 != 0) {
8012db60: 00000000 nop
8012db64: 0c04b99d jal 0x8012e674                   #       0012e674 - 0012e71c ();
8012db68: 00000000 nop                              #   }
8012db6c: 3c02801d lui r2,0x801d
8012db70: 8c42c570 lw r2,-0x3a90(r2)                #   commandPtr
8012db74: 00000000 nop
8012db78: 90430000 lbu r3,0x0000(r2)                #   command = *commandPtr
8012db7c: 00000000 nop
8012db80: a3c30014 sb r3,0x0014(r30)                #   command
8012db84: 93c20014 lbu r2,0x0014(r30)               #   command
8012db88: 00000000 nop
8012db8c: 2c430010 sltiu r3,r2,0x0010
8012db90: 10600005 beq r3,r0,0x8012dba8             #   if (command < 0x10) {
8012db94: 00000000 nop
8012db98: 0c04b772 jal 0x8012ddc8                   #       Handle Tutorial Command: Shift ();
8012db9c: 00000000 nop
8012dba0: 0804b72c j 0x8012dcb0
8012dba4: 00000000 nop
8012dba8: 93c20014 lbu r2,0x0014(r30)
8012dbac: 34030010 ori r3,r0,0x0010
8012dbb0: 14430005 bne r2,r3,0x8012dbc8             #   } else if (command == 0x10) {
8012dbb4: 00000000 nop
8012dbb8: 0c04b7a6 jal 0x8012de98                   #       Handle Tutorial Command: Display Message();
8012dbbc: 00000000 nop
8012dbc0: 0804b72c j 0x8012dcb0
8012dbc4: 00000000 nop
8012dbc8: 93c20014 lbu r2,0x0014(r30)
8012dbcc: 34030013 ori r3,r0,0x0013
8012dbd0: 14430005 bne r2,r3,0x8012dbe8             #   } else if (command == 0x13) {
8012dbd4: 00000000 nop
8012dbd8: 0c04b82e jal 0x8012e0b8                   #       0012e0b8 - 0012e670 ();     // Draw Circle
8012dbdc: 00000000 nop
8012dbe0: 0804b72c j 0x8012dcb0
8012dbe4: 00000000 nop
8012dbe8: 93c20014 lbu r2,0x0014(r30)
8012dbec: 34030014 ori r3,r0,0x0014
8012dbf0: 14430005 bne r2,r3,0x8012dc08             #   } else if (command == 0x14) {
8012dbf4: 00000000 nop
8012dbf8: 0c04b9c8 jal 0x8012e720                   #       Handle Tutorial Command: Wait (0x14) ();
8012dbfc: 00000000 nop
8012dc00: 0804b72c j 0x8012dcb0
8012dc04: 00000000 nop
8012dc08: 93c20014 lbu r2,0x0014(r30)
8012dc0c: 34030015 ori r3,r0,0x0015
8012dc10: 14430005 bne r2,r3,0x8012dc28             #   } else if (command == 0x15) {
8012dc14: 00000000 nop
8012dc18: 0c04ba91 jal 0x8012ea44                   #       Handle Tutorial Command: Wait (Time) ();
8012dc1c: 00000000 nop
8012dc20: 0804b72c j 0x8012dcb0
8012dc24: 00000000 nop
8012dc28: 93c20014 lbu r2,0x0014(r30)
8012dc2c: 34030016 ori r3,r0,0x0016
8012dc30: 14430005 bne r2,r3,0x8012dc48             #   } else if (command == 0x16) {
8012dc34: 00000000 nop
8012dc38: 0c04bac2 jal 0x8012eb08                   #       0012eb08 - 0012ebcc ();     // Wait for Message (0x16)?
8012dc3c: 00000000 nop
8012dc40: 0804b72c j 0x8012dcb0
8012dc44: 00000000 nop
8012dc48: 93c20014 lbu r2,0x0014(r30)
8012dc4c: 34030017 ori r3,r0,0x0017
8012dc50: 14430009 bne r2,r3,0x8012dc78             #   } else if (command == 0x17) {
8012dc54: 00000000 nop
8012dc58: 0c04b735 jal 0x8012dcd4                   #       result = 0012dcd4 - 0012ddc4 ();    // End tutorial?
8012dc5c: 00000000 nop
8012dc60: 00401821 addu r3,r2,r0
8012dc64: 00601021 addu r2,r3,r0
8012dc68: 0804b72f j 0x8012dcbc                     #       return result;
8012dc6c: 00000000 nop
8012dc70: 0804b72c j 0x8012dcb0
8012dc74: 00000000 nop
8012dc78: 93c20014 lbu r2,0x0014(r30)
8012dc7c: 34030012 ori r3,r0,0x0012
8012dc80: 14430005 bne r2,r3,0x8012dc98             #   } else if (command == 0x12) {
8012dc84: 00000000 nop
8012dc88: 0c04b7e0 jal 0x8012df80                   #       Handle Tutorial Command: Wait for Message ();
8012dc8c: 00000000 nop
8012dc90: 0804b72c j 0x8012dcb0
8012dc94: 00000000 nop
8012dc98: 93c20014 lbu r2,0x0014(r30)
8012dc9c: 34030011 ori r3,r0,0x0011
8012dca0: 14430003 bne r2,r3,0x8012dcb0             #   } else if (command == 0x11) {
8012dca4: 00000000 nop
8012dca8: 0c04b7f9 jal 0x8012dfe4                   #       Handle Tutorial Command: Change Dialog ();
8012dcac: 00000000 nop                              #   }
8012dcb0: 34020001 ori r2,r0,0x0001                 #   return 1;
8012dcb4: 0804b72f j 0x8012dcbc
8012dcb8: 00000000 nop
8012dcbc: 03c0e821 addu r29,r30,r0
8012dcc0: 8fbf001c lw r31,0x001c(r29)
8012dcc4: 8fbe0018 lw r30,0x0018(r29)
8012dcc8: 27bd0020 addiu r29,r29,0x0020
8012dccc: 03e00008 jr r31
8012dcd0: 00000000 nop