Difference between revisions of "End of Turn"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
  End of Turn
+
  '''BATTLE.BIN''' - End of Turn  
  00183c6c: 000410c0 sll r2,r4,0x03 r2 = r4* 8?
+
---------------------------------------------------------------------------------------
  00183c70: 00441023 subu r2,r2,r4 r2 = r2 - r4
+
Parameters : r4 = Unit ID
  00183c74: 00021180 sll r2,r2,0x06 r2 *
+
Returns : r2 = 0x01 (always..)
  00183c78: 3c038019 lui r3,0x8019
+
  00183c7c: 246308cc addiu r3,r3,0x08cc Unit Data pointer?
+
This routine checks CT bonus at end of turn (AI simulation only ?)
  00183c80: 00433821 addu r7,r2,r3 r7=unit data pointer
+
---------------------------------------------------------------------------------------
  00183c84: 3c018019 lui r1,0x8019
+
  00183c6c: 000410c0 sll r2,r4,0x03           |
  00183c88: 00220821 addu r1,r1,r2
+
  00183c70: 00441023 subu r2,r2,r4           |
  00183c8c: 902308cd lbu r3,0x08cd(r1) load unit id
+
  00183c74: 00021180 sll r2,r2,0x06           |{{f/std|Unit offset in battle data}}
  00183c90: 340200ff ori r2,r0,0x00ff r2 = ff
+
  00183c78: 3c038019 lui r3,0x8019           |
  00183c94: 1062001c beq r3,r2,0x00183d08 skip routine unit doesn't exist
+
  00183c7c: 246308cc addiu r3,r3,0x08cc       |
  00183c98: 34020001 ori r2,r0,0x0001 r2 = 01
+
  00183c80: 00433821 addu r7,r2,r3           |{{f/adr|Pointer to Unit battle stats}}
  00183c9c: 90e20186 lbu r2,0x0186(r7) Load Characters turn
+
  00183c84: 3c018019 lui r1,0x8019           |
  00183ca0: 00000000 nop
+
  00183c88: 00220821 addu r1,r1,r2           |
  00183ca4: 10400018 beq r2,r0,0x00183d08 Skip routine if turn over
+
  00183c8c: 902308cd lbu r3,0x08cd(r1)       |{{f/load|Unit ID}}
  00183ca8: 34020001 ori r2,r0,0x0001
+
  00183c90: 340200ff ori r2,r0,0x00ff         |{{f/std|<nowiki>r2 = ff</nowiki>}}
  00183cac: 90e60039 lbu r6,0x0039(r7) Load CT
+
  00183c94: 1062001c beq r3,r2,0x00183d08     {{f/Cond|If unit doesn't exist : }} {{f/loc| exit routine }}
  00183cb0: 90e3005c lbu r3,0x005c(r7) load status
+
  00183c98: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  00183cb4: 90e50187 lbu r5,0x0187(r7) Load movement taken
+
  00183c9c: 90e20186 lbu r2,0x0186(r7)       |{{f/load|Unit Turn flag}}
  00183cb8: 90e40188 lbu r4,0x0188(r7) Load action taken
+
  00183ca0: 00000000 nop                     |
  00183cbc: 30620008 andi r2,r3,0x0008 Don't move check
+
  00183ca4: 10400018 beq r2,r0,0x00183d08     {{f/Cond|If this is not Unit turn }} {{f/loc| exit routine }}
  00183cc0: 00a22825 or r5,r5,r2 r5 = no movement allowed check
+
  00183ca8: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  00183cc4: 30630004 andi r3,r3,0x0004 r3 = don't act check
+
  00183cac: 90e60039 lbu r6,0x0039(r7)       |{{f/load|Unit CT}}
  00183cc8: 90e20058 lbu r2,0x0058(r7) load performing check?
+
  00183cb0: 90e3005c lbu r3,0x005c(r7)       |{{f/load|Unit Current status 5}}
  00183ccc: 00641825 or r3,r3,r4 r3 = action allowed check
+
  00183cb4: 90e50187 lbu r5,0x0187(r7)       |{{f/load|Load movement taken}}
  00183cd0: 30420001 andi r2,r2,0x0001 r2 = performing check
+
  00183cb8: 90e40188 lbu r4,0x0188(r7)       |{{f/load|Load action taken}}
  00183cd4: 14a00002 bne r5,r0,0x00183ce0 branch if movement taken
+
  00183cbc: 30620008 andi r2,r3,0x0008       |{{f/std|Don't move check}}
  00183cd8: 00621825 or r3,r3,r2 r3 = 1 if don't act, action taken, or performing
+
  00183cc0: 00a22825 or r5,r5,r2             |{{f/std|<nowiki>r5 = Movement taken or disallowed</nowiki>}}
  00183cdc: 24c60014 addiu r6,r6,0x0014 Award 20 CT?
+
  00183cc4: 30630004 andi r3,r3,0x0004       |{{f/std|don't act check}}
  00183ce0: 14600003 bne r3,r0,0x00183cf0 Branch if action taken
+
  00183cc8: 90e20058 lbu r2,0x0058(r7)       |{{f/load|Unit Current status 1}}
  00183ce4: 30c2ffff andi r2,r6,0xffff
+
  00183ccc: 00641825 or r3,r3,r4             |{{f/std|<nowiki>r3 = Action taken or disallowed</nowiki>}}
  00183ce8: 24c60014 addiu r6,r6,0x0014 Award 20 CT?
+
  00183cd0: 30420001 andi r2,r2,0x0001       |{{f/std|Check [Performing]}}
  00183cec: 30c2ffff andi r2,r6,0xffff
+
  00183cd4: 14a00002 bne r5,r0,0x00183ce0     {{f/Cond|If Movement is not taken}}
  00183cf0: 2c42003d sltiu r2,r2,0x003d If CT < 61?
+
  00183cd8: 00621825 or r3,r3,r2                 |
  00183cf4: 14400002 bne r2,r0,0x00183d00 branch if ct < 61
+
  00183cdc: 24c60014 addiu r6,r6,0x0014           |{{f/std|20 CT bonus}}
  00183cf8: 34020001 ori r2,r0,0x0001 return r2 = 01
+
  00183ce0: 14600003 bne r3,r0,0x00183cf0     {{f/Cond|If Action not taken nor perfoming}}
  00183cfc: 3406003c ori r6,r0,0x003c r6 = 60
+
  00183ce4: 30c2ffff andi r2,r6,0xffff           |{{f/std|}}
  00183d00: a0e60039 sb r6,0x0039(r7) store r6 as CT
+
  00183ce8: 24c60014 addiu r6,r6,0x0014           |{{f/std|20 CT bonus}}
  00183d04: a0e00186 sb r0,0x0186(r7) store store turn over
+
  00183cec: 30c2ffff andi r2,r6,0xffff           |
 +
  00183cf0: 2c42003d sltiu r2,r2,0x003d       |{{f/std|}}
 +
  00183cf4: 14400002 bne r2,r0,0x00183d00     {{f/Cond|If CT is more than 60}}
 +
  00183cf8: 34020001 ori r2,r0,0x0001             |{{f/std|}}
 +
  00183cfc: 3406003c ori r6,r0,0x003c             |{{f/std|Cap CT at 60}}
 +
  00183d00: a0e60039 sb r6,0x0039(r7)         |{{f/store|store r6 as CT}}
 +
  00183d04: a0e00186 sb r0,0x0186(r7)         |{{f/store|store store turn over}}
 
  00183d08: 03e00008 jr r31
 
  00183d08: 03e00008 jr r31
 
  00183d0c: 00000000 nop
 
  00183d0c: 00000000 nop
Returns r2 = 1 (turn over?
+
===Return location===
 
+
'''Battle.bin'''
== Return Locations ==
+
  000755dc: [[Set_move/act_based_on_skillset]]
 
+
  00076504: [[00076430_-_00076654]]
  000755d4: - [[Routine at 75310]]
+
  00076630: [[00076430_-_00076654]]
  000764fc: - [[Routine at 76430]]
+
  00182e4c: [[In_between_turn_control_routine]]
  00076628: - ^^
+
  00183c58: [[Set_move/act_flags]]
  00182e44: - [[Routine at 1827f0]] - huge routine
+
  0019d530: [[AI_End_of_turn,_in_between_turn,_etc.]]
  00183c50: - [[Various Flags r4= data pointer]]
 
  0019d528: - [[Routine at 19d37c]] - AI?
 

Latest revision as of 07:46, 1 August 2023

BATTLE.BIN - End of Turn 
---------------------------------------------------------------------------------------
Parameters : r4 = Unit ID
Returns : r2 = 0x01 (always..)

This routine checks CT bonus at end of turn (AI simulation only ?)
---------------------------------------------------------------------------------------
00183c6c: 000410c0 sll r2,r4,0x03           |
00183c70: 00441023 subu r2,r2,r4            |
00183c74: 00021180 sll r2,r2,0x06           |Unit offset in battle data
00183c78: 3c038019 lui r3,0x8019            |
00183c7c: 246308cc addiu r3,r3,0x08cc       |
00183c80: 00433821 addu r7,r2,r3            |Pointer to Unit battle stats
00183c84: 3c018019 lui r1,0x8019            |
00183c88: 00220821 addu r1,r1,r2            |
00183c8c: 902308cd lbu r3,0x08cd(r1)        |Unit ID
00183c90: 340200ff ori r2,r0,0x00ff         |r2 = ff
00183c94: 1062001c beq r3,r2,0x00183d08     #If unit doesn't exist :   exit routine 
00183c98: 34020001 ori r2,r0,0x0001             |r2 = 0x01
00183c9c: 90e20186 lbu r2,0x0186(r7)        |Unit Turn flag
00183ca0: 00000000 nop                      |
00183ca4: 10400018 beq r2,r0,0x00183d08     #If this is not Unit turn   exit routine 
00183ca8: 34020001 ori r2,r0,0x0001             |r2 = 0x01
00183cac: 90e60039 lbu r6,0x0039(r7)        |Unit CT
00183cb0: 90e3005c lbu r3,0x005c(r7)        |Unit Current status 5
00183cb4: 90e50187 lbu r5,0x0187(r7)        |Load movement taken
00183cb8: 90e40188 lbu r4,0x0188(r7)        |Load action taken
00183cbc: 30620008 andi r2,r3,0x0008        |Don't move check
00183cc0: 00a22825 or r5,r5,r2              |r5 = Movement taken or disallowed
00183cc4: 30630004 andi r3,r3,0x0004        |don't act check
00183cc8: 90e20058 lbu r2,0x0058(r7)        |Unit Current status 1
00183ccc: 00641825 or r3,r3,r4              |r3 = Action taken or disallowed
00183cd0: 30420001 andi r2,r2,0x0001        |Check [Performing]
00183cd4: 14a00002 bne r5,r0,0x00183ce0     #If Movement is not taken
00183cd8: 00621825 or r3,r3,r2                  |
00183cdc: 24c60014 addiu r6,r6,0x0014           |20 CT bonus
00183ce0: 14600003 bne r3,r0,0x00183cf0     #If Action not taken nor perfoming
00183ce4: 30c2ffff andi r2,r6,0xffff            |
00183ce8: 24c60014 addiu r6,r6,0x0014           |20 CT bonus
00183cec: 30c2ffff andi r2,r6,0xffff            |
00183cf0: 2c42003d sltiu r2,r2,0x003d       |
00183cf4: 14400002 bne r2,r0,0x00183d00     #If CT is more than 60
00183cf8: 34020001 ori r2,r0,0x0001             |
00183cfc: 3406003c ori r6,r0,0x003c             |Cap CT at 60
00183d00: a0e60039 sb r6,0x0039(r7)         |store r6 as CT
00183d04: a0e00186 sb r0,0x0186(r7)         |store store turn over
00183d08: 03e00008 jr r31
00183d0c: 00000000 nop

Return location

Battle.bin
000755dc: Set_move/act_based_on_skillset
00076504: 00076430_-_00076654
00076630: 00076430_-_00076654
00182e4c: In_between_turn_control_routine
00183c58: Set_move/act_flags
0019d530: AI_End_of_turn,_in_between_turn,_etc.