Set Rotation matrix elements
Jump to navigation
Jump to search
Parameters : r4 = pointer 1 : 0x00 Angle A 0x02 Angle B 0x04 Angle C r5 = pointer 2 (will hold return values) Returns : On pointer 2 (r5) 0x00 Cos(C)*Cos(B)*4096 0x02 -Sin(C)*cos(B)*4096 0x04 Sin(B)*4096 0x06 ( [Sin(C)*Cos(A)]-[Cos(C)*Sin(B)*Sin(A)] )*4096 0x08 ( [Cos(C)*Cos(A)]+ [Sin(C)*Sin(B)*Sin(A)] )*4096 0x0a Cos(B)*Sin(A)*4096 0x0c ( [Sin(C)*Sin(A)]+[Cos(C)*Sin(B)*Cos(A)] )*4096 0x0e ( [Cos(C)*Sin(A)]-[Sin(C)*Sin(B)*Cos(A)] )*4096 0x10 Cos(B)*Cos(A)*4096 --------------------------------------------------------------------------------------------------------- 0001d658: 848f0000 lh r15,0x0000(r4) |r15 = value at 0x00 (A) 0001d65c: 00a01021 addu r2,r5,r0 |r2 = Stack pointer 2 0001d660: 05e1000e bgez r15,0x0001d69c #If A < 0x00 0001d664: 31f90fff andi r25,r15,0x0fff |r25 = remainder of A/4096 0001d668: 000f7823 subu r15,r0,r15 |r15 = positive value of A 0001d66c: 05e10001 bgez r15,0x0001d674 #if A < 0x00 (never true ? And useless) does nothing since it jumps two lines below…) 0001d670: 31ef0fff andi r15,r15,0x0fff |r15 = remainder of A/4096 0001d674: 000fc080 sll r24,r15,0x02 |r24 = A remainder * 4 0001d678: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d67c: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d680: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(A)*4096 & Sin(A)*4096 0001d684: 00000000 nop | 0001d688: 0019c400 sll r24,r25,0x10 | 0001d68c: 0018c403 sra r24,r24,0x10 |r24 = sin(A)*4096 0001d690: 00185823 subu r11,r0,r24 |r11 = - sin(A)*4096 0001d694: 080075af j 0x0001d6bc >>jump to next angle 0001d698: 00194403 sra r8,r25,0x10 |r8 = cos(A)*4096 0001d69c: 0019c080 sll r24,r25,0x02 |Else (r15>0x00) r24 = r15 remainder * 4 0001d6a0: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d6a4: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d6a8: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(A)*4096 & Sin(A)*4096 0001d6ac: 00000000 nop | 0001d6b0: 0019c400 sll r24,r25,0x10 | 0001d6b4: 00185c03 sra r11,r24,0x10 |r11 = sin(A)*4096 0001d6b8: 00194403 sra r8,r25,0x10 |r8 = cos(A)*4096 0001d6bc: 848f0002 lh r15,0x0002(r4) |r2 = Angle value at Stack pointer 1 0x02 (B) 0001d6c0: 00000000 nop | 0001d6c4: 05e1000e bgez r15,0x0001d700 #if B< 0x00 0001d6c8: 31f90fff andi r25,r15,0x0fff |r25 = remainder of B/4096 0001d6cc: 000f7823 subu r15,r0,r15 |r15 = positive value of B 0001d6d0: 05e10001 bgez r15,0x0001d6d8 if B < 0x00 (never true ? And useless jump 2 lines below) 0001d6d4: 31ef0fff andi r15,r15,0x0fff |r15 = remainder of B/4096 0001d6d8: 000fc080 sll r24,r15,0x02 |r24 = r15 remainder * 4 0001d6dc: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d6e0: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d6e4: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(B)*4096 & Sin(B)*4096 0001d6e8: 00000000 nop | 0001d6ec: 00196400 sll r12,r25,0x10 | 0001d6f0: 000c6403 sra r12,r12,0x10 |r12 = Sin(B)*4096 0001d6f4: 000c7023 subu r14,r0,r12 |r14 = - Sin(B)*4096 0001d6f8: 080075c9 j 0x0001d724 >>jump to next angle 0001d6fc: 00194c03 sra r9,r25,0x10 |r9 = cos(B)*4096 0001d700: 0019c080 sll r24,r25,0x02 #Else (B > 0x00) r24 = r15 remainder * 4 0001d704: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d708: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d70c: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(B)*4096 & Sin(B)*4096 0001d710: 00000000 nop | 0001d714: 00197400 sll r14,r25,0x10 | 0001d718: 000e7403 sra r14,r14,0x10 |r14 = sin(B)*4096 0001d71c: 000e6023 subu r12,r0,r14 |r12 = -Sin(B)*4096 0001d720: 00194c03 sra r9,r25,0x10 |r9 = cos(B)*4096 0001d724: 012b0019 multu r9,r11 |(cos(B)*4096) * (sin(A)*4096) 0001d728: 848f0004 lh r15,0x0004(r4) |r15 = value at 0x04 (C) 0001d72c: a4ae0004 sh r14,0x0004(r5) |Store sinus(B) at pointer 2 0x04 0001d730: 0000c012 mflo r24 |r24 = cos(B)* sin(A) *4096² 0001d734: 0018c823 subu r25,r0,r24 |r25 = - cos(B)* sin(A) *4096² 0001d738: 00197303 sra r14,r25,0x0c |r14 = - cos(B)* sin(A) *4096 0001d73c: 01280019 multu r9,r8 |cos(B)*4096 * cos(A)*4096 0001d740: a4ae000a sh r14,0x000a(r5) |Store - cos(B)* sin(A) *4096 at pointer 2 0x0a 0001d744: 05e10011 bgez r15,0x0001d78c #if C< 0x00 0001d748: 31f90fff andi r25,r15,0x0fff |r25 = remainder of C/4096 0001d74c: 0000c012 mflo r24 |r24 = cos(B)* cos(A)*4096² 0001d750: 00187303 sra r14,r24,0x0c |r14 = cos(B)* cos(A)*4096 0001d754: a4ae0010 sh r14,0x0010(r5) |Store cos(B)* cos(A)*4096 at pointer 2 0x10 0001d758: 000f7823 subu r15,r0,r15 |r15 = positive value of C 0001d75c: 05e10001 bgez r15,0x0001d764 #Useless two lines branch 0001d760: 31ef0fff andi r15,r15,0x0fff |r15 = remainder positive value of C 0001d764: 000fc080 sll r24,r15,0x02 |r24 = offset for cos&sin table (angle * 4) 0001d768: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d76c: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d770: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(C)*4096 & Sin(C)*4096 0001d774: 00000000 nop | 0001d778: 0019c400 sll r24,r25,0x10 | 0001d77c: 0018c403 sra r24,r24,0x10 |r24 = Sin(C)*4096 0001d780: 00186823 subu r13,r0,r24 |r13 = -Sin(C)*4096 0001d784: 080075ee j 0x0001d7b8 >>Jump to multiplication 0001d788: 00195403 sra r10,r25,0x10 |r10 = Cos(C)*4096 0001d78c: 00007812 mflo r15 #Else (C > 0x00) r15 = cos(B)* cos(A)*4096² 0001d790: 000f7303 sra r14,r15,0x0c |r14 = cos(B)* cos(A)*4096 0001d794: a4ae0010 sh r14,0x0010(r5) |Store cos(B)* cos(A)*4096 at pointer 2 0x10 0001d798: 0019c080 sll r24,r25,0x02 |r24 = offset for cos&sin table (angle * 4) 0001d79c: 3c198003 lui r25,0x8003 |r25 = 0x80030000 0001d7a0: 0338c821 addu r25,r25,r24 |r25 = 0x80030000 + offset 0001d7a4: 8f39bee8 lw r25,-0x4118(r25) |r25 = Cos(C)*4096 & Sin(C)*4096 0001d7a8: 00000000 nop | 0001d7ac: 0019c400 sll r24,r25,0x10 | 0001d7b0: 00186c03 sra r13,r24,0x10 |r13 = Sin(C)*4096 0001d7b4: 00195403 sra r10,r25,0x10 |r10 = Cos(C)*4096 0001d7b8: 01490019 multu r10,r9 |Cos(C)*4096 * cos(B)*4096 0001d7bc: 00000000 nop | 0001d7c0: 00000000 nop | 0001d7c4: 00007812 mflo r15 |r15 = Cos(C)*4096 * cos(B)*4096 0001d7c8: 000f7303 sra r14,r15,0x0c |r14 = Cos(C)*cos(B)*4096 0001d7cc: a4ae0000 sh r14,0x0000(r5) |Store Cos(C)*cos(B)*4096 at pointer 2 0x00 0001d7d0: 01a90019 multu r13,r9 |Sin(C)*4096 * cos(B)*4096 0001d7d4: 00000000 nop | 0001d7d8: 00000000 nop | 0001d7dc: 00007812 mflo r15 |r15 = Sin(C)*cos(B)*4096² 0001d7e0: 000f7023 subu r14,r0,r15 |r14 = - Sin(C)*cos(B)*4096² 0001d7e4: 000e7b03 sra r15,r14,0x0c |r15 = - Sin(C)*cos(B)*4096 0001d7e8: 014c0019 multu r10,r12 |Cos(C)*4096 * Sin(B)*4096 0001d7ec: a4af0002 sh r15,0x0002(r5) |store - Sin(C)*cos(B)*4096 at pointer 2 0x02 0001d7f0: 00000000 nop | 0001d7f4: 00007812 mflo r15 |r15 = Cos(C)*Sin(B)*4096² 0001d7f8: 000fc303 sra r24,r15,0x0c |r24 = Cos(C)*Sin(B)*4096 0001d7fc: 00000000 nop | 0001d800: 030b0019 multu r24,r11 |Cos(C)*Sin(B)*4096 * (sin(A)*4096) 0001d804: 00000000 nop | 0001d808: 00000000 nop | 0001d80c: 00007812 mflo r15 |r15 = Cos(C)*Sin(B)*sin(A)*4096² 0001d810: 000f7303 sra r14,r15,0x0c |r14 = Cos(C)*Sin(B)*sin(A)*4096 0001d814: 00000000 nop | 0001d818: 01a80019 multu r13,r8 |Sin(C)*4096 * cos(A)*4096 0001d81c: 00000000 nop | 0001d820: 00000000 nop | 0001d824: 00007812 mflo r15 |r15 = Sin(C)* cos(A)*4096² 0001d828: 000fcb03 sra r25,r15,0x0c |r25 = Sin(C)* cos(A)*4096 0001d82c: 032e7823 subu r15,r25,r14 |r15 = (Sin(C)* cos(A)*4096) - (Cos(C)*Sin(B)*sin(A)*4096) 0001d830: 03080019 multu r24,r8 |Cos(C)*Sin(B)*4096 * cos(A)*4096 0001d834: a4af0006 sh r15,0x0006(r5) |Store ( Sin(C)*cos(A) - Cos(C)*Sin(B)*sin(A) )*4096 at pointer 2 0x06 0001d838: 00000000 nop | 0001d83c: 00007012 mflo r14 |r14 = Cos(C)*Sin(B)*cos(A)*4096² 0001d840: 000e7b03 sra r15,r14,0x0c |r15 = Cos(C)*Sin(B)*cos(A)*4096 0001d844: 00000000 nop | 0001d848: 01ab0019 multu r13,r11 |Sin(C)*4096 * (sin(A)*4096) 0001d84c: 00000000 nop | 0001d850: 00000000 nop | 0001d854: 00007012 mflo r14 |r14 = Sin(C)*sin(A)*4096² 0001d858: 000ecb03 sra r25,r14,0x0c |r25 = Sin(C)*sin(A)*4096 0001d85c: 032f7021 addu r14,r25,r15 |r14 = (Sin(C)*sin(A)*4096) + Cos(C)*Sin(B)*cos(A)*4096 0001d860: 01ac0019 multu r13,r12 |Sin(C)*4096 * Sin(B)*4096 0001d864: a4ae000c sh r14,0x000c(r5) |Store ( Sin(C)*sin(A) + Cos(C)*Sin(B)*cos(A) )*4096 0001d868: 00000000 nop | 0001d86c: 00007812 mflo r15 |r15 = Sin(C)*Sin(B)*4096² 0001d870: 000fc303 sra r24,r15,0x0c |r24 = Sin(C)*Sin(B)*4096 0001d874: 00000000 nop | 0001d878: 030b0019 multu r24,r11 |(Sin(C)*Sin(B)*4096) * (sin(A)*4096) 0001d87c: 00000000 nop | 0001d880: 00000000 nop | 0001d884: 00007812 mflo r15 |r15 = Sin(C)*Sin(B)*sin(A)*4096² 0001d888: 000f7303 sra r14,r15,0x0c |r14 = Sin(C)*Sin(B)*sin(A)*4096 0001d88c: 00000000 nop | 0001d890: 01480019 multu r10,r8 |Cos(C)*4096 * cos(A)*4096 0001d894: 00000000 nop | 0001d898: 00000000 nop | 0001d89c: 00007812 mflo r15 |r15 = Cos(C)*cos(A)*4096² 0001d8a0: 000fcb03 sra r25,r15,0x0c |r25 = Cos(C)*cos(A)*4096 0001d8a4: 032e7821 addu r15,r25,r14 |r15 = Cos(C)*cos(A)*4096 + Sin(C)*Sin(B)*sin(A)*4096 0001d8a8: 03080019 multu r24,r8 |Sin(C)*Sin(B)*4096 * cos(A)*4096 0001d8ac: a4af0008 sh r15,0x0008(r5) |Store ( Cos(C)*cos(A)*4096 + Sin(C)*Sin(B)*sin(A) )*4096 at pointer 2 0x08 0001d8b0: 00000000 nop | 0001d8b4: 00007012 mflo r14 |r14 = Sin(C)*Sin(B)*cos(A)*4096² 0001d8b8: 000e7b03 sra r15,r14,0x0c |r15 = Sin(C)*Sin(B)*cos(A)*4096 0001d8bc: 00000000 nop | 0001d8c0: 014b0019 multu r10,r11 |Cos(C)*4096 * (sin(A)*4096) 0001d8c4: 00000000 nop | 0001d8c8: 00000000 nop | 0001d8cc: 00007012 mflo r14 |r14 = Cos(C)*sin(A)*4096² 0001d8d0: 000ecb03 sra r25,r14,0x0c |r25 = Cos(C)*sin(A)*4096 0001d8d4: 032f7023 subu r14,r25,r15 |r14 = Cos(C)*sin(A)*4096 - Sin(C)*Sin(B)*cos(A)*4096 0001d8d8: a4ae000e sh r14,0x000e(r5) |store ( Cos(C)*sin(A) - Sin(C)*Sin(B)*cos(A) )*4096 at pointer 2 0x0e 0001d8dc: 03e00008 jr r31 0001d8e0: 00000000 nop
Return locations
Battle.bin 000e8d18: Background_Tile_Color_For_Targeting/Movement 000e8d8c: Background_Tile_Color_For_Targeting/Movement 000e9070: Background_Tile_Color_For_Targeting/Movement 000e91b8: Background_Tile_Color_For_Targeting/Movement 000e9874: Background_Tile_Color_For_Targeting/Movement 000ee9dc: 000ee95c_-_000eeaf4 000eea08: 000ee95c_-_000eeaf4 000eead8: 000ee95c_-_000eeaf4 001471a4: 0014703c_-_001472d8 001a626c: Emitter_Control_Routine 001a6900: Emitter_Control_Routine 001a6d8c: Emitter_Control_Routine 001a6fd8: Emitter_Control_Routine 001a810c: 001a7f5c_-_001a8668 001a8270: 001a7f5c_-_001a8668 001a8464: 001a7f5c_-_001a8668 001ae388: 001ae340 - 001af104 001ae43c: 001ae340 - 001af104 001afc08: 001afb38 - 001afd8c A = 0° B = Attacker to Target angle value (XY plan) C = 0° 001b11ac: 001b0ffc - 001b1538 REQUIRE.OUT 001ca834 001c7b78 - 001c8b90 001caa60 001ca664 - 001cafd0 001cab34 001ca664 - 001cafd0 001cab3c 001ca664 - 001cafd0 WORLD.BIN 000e06bc: 000e0480_-_000e0978 000fa580: 000fa3ac_-_000fa720