Calculate Distance Between Units
Jump to navigation
Jump to search
BATTLE.BIN : Calculate Distance Between Units ------------------------------------------------------------------------------------------ Parameters - r4 : Acting Unit data pointer (battle) r5 : Considered Unit data pointer Returns r2 : distance between the 2 units (Distance X + Distance Y) ----------------------------------------------------------------------------------------- 0019936c: 90860047 lbu r6,0x0047(r4) |Load Acting Unit's X 00199370: 90a30047 lbu r3,0x0047(r5) |Load Target Unit's X 00199374: 90840048 lbu r4,0x0048(r4) |Load Acting Unit's Y 00199378: 90a20048 lbu r2,0x0048(r5) |Load Target Unit's Y 0019937c: 00c33023 subu r6,r6,r3 |Attacker X - Target X 00199380: 04c10002 bgez r6,0x0019938c #If delta X is negative 00199384: 00822023 subu r4,r4,r2 |Attacker Y - Target Y 00199388: 00063023 subu r6,r0,r6 |Delta X becomes positive 0019938c: 04810002 bgez r4,0x00199398 #If Delta Y is negative 00199390: 00000000 nop | 00199394: 00042023 subu r4,r0,r4 |Delta Y becomes positive 00199398: 03e00008 jr r31 Returns 0019939c: 00c41021 addu r2,r6,r4 |r2 = Delta X + Delta Y
Return Locations
BATTLE.BIN 00198b9c: Find_Peril_Most_Unit_(00198b04) 0019926c: Calculate_Physical?_Target 00199308: Calculate_Physical?_Target 0019d0f8: AI_Target_Unit_for_Direct_vs_Arc_Attack_(0019cd9c)