Difference between revisions of "Composite frame loading for parameter sets"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
  001aa1f8: 27bdff80 addiu r29,r29,0xff80
 
  001aa1f8: 27bdff80 addiu r29,r29,0xff80
 
  001aa1fc: afb40070 sw r20,0x0070(r29)
 
  001aa1fc: afb40070 sw r20,0x0070(r29)
  001aa200: 00a0a021 addu r20,r5,r0
+
  001aa200: 00a0a021 addu r20,r5,r0             # blue value
 
  001aa204: afb50074 sw r21,0x0074(r29)
 
  001aa204: afb50074 sw r21,0x0074(r29)
  001aa208: 00c0a821 addu r21,r6,r0
+
  001aa208: 00c0a821 addu r21,r6,r0             # green value
 
  001aa20c: afb60078 sw r22,0x0078(r29)
 
  001aa20c: afb60078 sw r22,0x0078(r29)
 
  001aa210: afb10064 sw r17,0x0064(r29)
 
  001aa210: afb10064 sw r17,0x0064(r29)
Line 19: Line 19:
 
  001aa238: 00021400 sll r2,r2,0x10
 
  001aa238: 00021400 sll r2,r2,0x10
 
  001aa23c: 1c40005a bgtz r2,0x001aa3a8 branch if still running parameter
 
  001aa23c: 1c40005a bgtz r2,0x001aa3a8 branch if still running parameter
  001aa240: 00e0b021 addu r22,r7,r0
+
  001aa240: 00e0b021 addu r22,r7,r0             # Red value
 
   
 
   
 
  if getting new parameter
 
  if getting new parameter
Line 140: Line 140:
 
  001aa3e4: 00000000 nop
 
  001aa3e4: 00000000 nop
 
  001aa3e8: 00449821 addu r19,r2,r4 r19 = frame address
 
  001aa3e8: 00449821 addu r19,r2,r4 r19 = frame address
  001aa3ec: 86700002 lh r16,0x0002(r19) load 0x02 of frame data // some VRAM flag?
+
  001aa3ec: 86700002 lh r16,0x0002(r19) load 0x02 of frame data // Number of graphics?
  001aa3f0: 90c20003 lbu r2,0x0003(r6) load ?? r6 = 1d17d8 // check the VRAM flag?
+
  001aa3f0: 90c20003 lbu r2,0x0003(r6) load Num Graphics
 
  001aa3f4: 00000000 nop
 
  001aa3f4: 00000000 nop
 
  001aa3f8: 10500007 beq r2,r16,0x001aa418 branch if equal // Error check? below finds a new r6 pointer if there's an inequality
 
  001aa3f8: 10500007 beq r2,r16,0x001aa418 branch if equal // Error check? below finds a new r6 pointer if there's an inequality
Line 150: Line 150:
 
  001aa40c: 324400ff andi r4,r18,0x00ff
 
  001aa40c: 324400ff andi r4,r18,0x00ff
 
  001aa410: 00403021 addu r6,r2,r0
 
  001aa410: 00403021 addu r6,r2,r0
  001aa414: ae260020 sw r6,0x0020(r17) store effect construction datas pointer
+
  001aa414: ae260020 sw r6,0x0020(r17) store effect construction data pointer
 
  001aa418: 1a000013 blez r16,0x001aa468 branch if 0x03 in frame data <= 0
 
  001aa418: 1a000013 blez r16,0x001aa468 branch if 0x03 in frame data <= 0
 
  001aa41c: 00002821 addu r5,r0,r0 r5 = counter
 
  001aa41c: 00002821 addu r5,r0,r0 r5 = counter
Line 163: Line 163:
 
  001aa440: 24420004 addiu r2,r2,0x0004 counter*24 + 04
 
  001aa440: 24420004 addiu r2,r2,0x0004 counter*24 + 04
 
  001aa444: 02621021 addu r2,r19,r2 r2 = next frames address?
 
  001aa444: 02621021 addu r2,r19,r2 r2 = next frames address?
  001aa448: ac820008 sw r2,0x0008(r4) store next frames address in counter*4 + address + 0x08
+
  001aa448: ac820008 sw r2,0x0008(r4) store next frames address in counter*4 + address + 0x08 // sets pointers to each graphic's polygon construction data
 
  001aa44c: 24a20001 addiu r2,r5,0x0001 counter++
 
  001aa44c: 24a20001 addiu r2,r5,0x0001 counter++
 
  001aa450: 00402821 addu r5,r2,r0
 
  001aa450: 00402821 addu r5,r2,r0
Line 177: Line 177:
 
   
 
   
 
  if not changing frames
 
  if not changing frames
  001aa478: a0d40000 sb r20,0x0000(r6) store r5 input (depending on flags... could be a function of some input, or 0x80)
+
  001aa478: a0d40000 sb r20,0x0000(r6) store blue
  001aa47c: a0d50001 sb r21,0x0001(r6) store r6 input (ditto)
+
  001aa47c: a0d50001 sb r21,0x0001(r6) store green
  001aa480: a0d60002 sb r22,0x0002(r6) store r7 input (")
+
  001aa480: a0d60002 sb r22,0x0002(r6) store Red
 
  001aa484: 96220006 lhu r2,0x0006(r17) load function byte
 
  001aa484: 96220006 lhu r2,0x0006(r17) load function byte
 
  001aa488: 00000000 nop
 
  001aa488: 00000000 nop

Latest revision as of 01:41, 9 July 2023

001aa1f8: 27bdff80 addiu r29,r29,0xff80
001aa1fc: afb40070 sw r20,0x0070(r29)
001aa200: 00a0a021 addu r20,r5,r0              # blue value
001aa204: afb50074 sw r21,0x0074(r29)
001aa208: 00c0a821 addu r21,r6,r0              # green value
001aa20c: afb60078 sw r22,0x0078(r29)
001aa210: afb10064 sw r17,0x0064(r29)
001aa214: 00808821 addu r17,r4,r0		effect current parameter data pointer
001aa218: afbf007c sw r31,0x007c(r29)
001aa21c: afb3006c sw r19,0x006c(r29)
001aa220: afb20068 sw r18,0x0068(r29)
001aa224: afb00060 sw r16,0x0060(r29)
001aa228: 96220016 lhu r2,0x0016(r17)		load duration byte
001aa22c: 8e260020 lw r6,0x0020(r17)
001aa230: 2442fffe addiu r2,r2,0xfffe		duration byte - 2
001aa234: a6220016 sh r2,0x0016(r17)		store new
001aa238: 00021400 sll r2,r2,0x10		
001aa23c: 1c40005a bgtz r2,0x001aa3a8		branch if still running parameter
001aa240: 00e0b021 addu r22,r7,r0              # Red value

if getting new parameter
001aa244: 9622001c lhu r2,0x001c(r17)		load counter
001aa248: 8e230018 lw r3,0x0018(r17)		load address to parameter data
001aa24c: 00000000 nop
001aa250: 00622021 addu r4,r3,r2
001aa254: 90830000 lbu r3,0x0000(r4)		load new frame byte
001aa258: 00000000 nop
001aa25c: 30620080 andi r2,r3,0x0080		
001aa260: 1440001d bne r2,r0,0x001aa2d8		branch if special function
001aa264: 34020002 ori r2,r0,0x0002
001aa268: 9222001f lbu r2,0x001f(r17)		load current frame byte
001aa26c: 00000000 nop
001aa270: 10430005 beq r2,r3,0x001aa288		branch if current frame = new frame?
001aa274: 00000000 nop
001aa278: 96220006 lhu r2,0x0006(r17)
001aa27c: a223001f sb r3,0x001f(r17)		store new frame
001aa280: 34420001 ori r2,r2,0x0001
001aa284: a6220006 sh r2,0x0006(r17)		set changing frame flag
001aa288: 9622001c lhu r2,0x001c(r17)		counter?
001aa28c: 8e230018 lw r3,0x0018(r17)		load current parameter address
001aa290: 00000000 nop
001aa294: 00431021 addu r2,r2,r3		add em
001aa298: 90440001 lbu r4,0x0001(r2)		load duration byte
001aa29c: 9622001c lhu r2,0x001c(r17)		load counter?
001aa2a0: 8e230018 lw r3,0x0018(r17)		load parametric data pointer
001aa2a4: 00000000 nop
001aa2a8: 00431021 addu r2,r2,r3
001aa2ac: a6240016 sh r4,0x0016(r17)		store duration byte
001aa2b0: 90420002 lbu r2,0x0002(r2)		load 3rd byte (always 0x1 ?)
001aa2b4: 86230016 lh r3,0x0016(r17)		load duration byte
001aa2b8: 00000000 nop
001aa2bc: 1060003a beq r3,r0,0x001aa3a8		branch if 0
001aa2c0: a2220014 sb r2,0x0014(r17)		store 3rd byte
001aa2c4: 9622001c lhu r2,0x001c(r17)
001aa2c8: 00000000 nop
001aa2cc: 24420003 addiu r2,r2,0x0003		increment counter
001aa2d0: 0806a8ea j 0x001aa3a8
001aa2d4: a622001c sh r2,0x001c(r17)		store new counter

Special function
001aa2d8: 3063007f andi r3,r3,0x007f		remove 0x80 byte
001aa2dc: 1062000e beq r3,r2,0x001aa318		branch if = 2
001aa2e0: 28620003 slti r2,r3,0x0003
001aa2e4: 10400005 beq r2,r0,0x001aa2fc		branch if not 2, 1 or 0
001aa2e8: 34020001 ori r2,r0,0x0001
001aa2ec: 10620008 beq r3,r2,0x001aa310		branch if = 1
001aa2f0: 00000000 nop
001aa2f4: 0806a891 j 0x001aa244			if 0, loop above?
001aa2f8: 00000000 nop

if not 2, 1 or 0
001aa2fc: 34020003 ori r2,r0,0x0003
001aa300: 10620016 beq r3,r2,0x001aa35c		branch if = 3
001aa304: 00000000 nop
001aa308: 0806a891 j 0x001aa244			Loop above. endless? I don't see anywhere that increments the counter here. maybe get next parameter? ignore if not 80, 81, 82, or 83?
001aa30c: 00000000 nop

if = 1 (end of parameter set - set counter to 0.)
001aa310: 0806a891 j 0x001aa244			get next parameter
001aa314: a620001c sh r0,0x001c(r17)		store new counter = 0

if special function = 2 (start of new parameter set - get XX XX and YY YY displacements. then execute next SHP)
001aa318: 90830002 lbu r3,0x0002(r4)		load XX
001aa31c: 90820001 lbu r2,0x0001(r4)		load XX
001aa320: 9624001c lhu r4,0x001c(r17)		load counter
001aa324: 8e250018 lw r5,0x0018(r17)		load address
001aa328: 00031a00 sll r3,r3,0x08		XX in upper halfword
001aa32c: 00431021 addu r2,r2,r3		add to duration
001aa330: 00852021 addu r4,r4,r5		counter + address
001aa334: a6220008 sh r2,0x0008(r17)		store Total XX XX
001aa338: 90850003 lbu r5,0x0003(r4)		load YY
001aa33c: 9622001c lhu r2,0x001c(r17)		load counter
001aa340: 90830004 lbu r3,0x0004(r4)		load YY
001aa344: 24420005 addiu r2,r2,0x0005		counter+5
001aa348: 00031a00 sll r3,r3,0x08
001aa34c: 00a32821 addu r5,r5,r3
001aa350: a622001c sh r2,0x001c(r17)		store new counter (next SHP)
001aa354: 0806a891 j 0x001aa244			get next parameter
001aa358: a625000a sh r5,0x000a(r17)		Store total YY YY

if special function = 3
001aa35c: 90820001 lbu r2,0x0001(r4)		load input XX?
001aa360: 96230008 lhu r3,0x0008(r17)		load last XX XX
001aa364: 9624001c lhu r4,0x001c(r17)		load counter
001aa368: 8e250018 lw r5,0x0018(r17)		load address
001aa36c: 00021600 sll r2,r2,0x18		
001aa370: 00021603 sra r2,r2,0x18		obtain first byte of XX XX
001aa374: 00431021 addu r2,r2,r3		Obtain new XX XX
001aa378: 9623001c lhu r3,0x001c(r17)		load counter
001aa37c: 00852021 addu r4,r4,r5		counter + address
001aa380: a6220008 sh r2,0x0008(r17)		store new XX XX
001aa384: 90820002 lbu r2,0x0002(r4)		load input YY?
001aa388: 24630003 addiu r3,r3,0x0003		counter+3
001aa38c: 00021600 sll r2,r2,0x18
001aa390: a623001c sh r3,0x001c(r17)		store new counter
001aa394: 9623000a lhu r3,0x000a(r17)		load last YY YY
001aa398: 00021603 sra r2,r2,0x18		obtain first byte of YY YY
001aa39c: 00431021 addu r2,r2,r3		obtain new YY YY
001aa3a0: 0806a891 j 0x001aa244			get next parameter
001aa3a4: a622000a sh r2,0x000a(r17)		store new YY YY

Continue regularly loading SHP here:
001aa3a8: 96220006 lhu r2,0x0006(r17)			
001aa3ac: 00000000 nop
001aa3b0: 30420001 andi r2,r2,0x0001		new frame flag?
001aa3b4: 10400030 beq r2,r0,0x001aa478		branch if not changing to new frame
001aa3b8: 00000000 nop
001aa3bc: 9223001e lbu r3,0x001e(r17)		load 1e // the length of computational data before frame data pointers? lol
001aa3c0: 3c04801c lui r4,0x801c
001aa3c4: 8c84bf78 lw r4,-0x4088(r4)		start of frame data address
001aa3c8: 9222001f lbu r2,0x001f(r17)		load current frame byte
001aa3cc: 00831821 addu r3,r4,r3		frame data address + 0x1e
001aa3d0: 84630000 lh r3,0x0000(r3)		load 2 
001aa3d4: 00021040 sll r2,r2,0x01		current frame*2
001aa3d8: 00431021 addu r2,r2,r3		current frame*2 + 2
001aa3dc: 00821021 addu r2,r4,r2		start of frame data + frame address pointer
001aa3e0: 94420000 lhu r2,0x0000(r2)		load address pointer
001aa3e4: 00000000 nop
001aa3e8: 00449821 addu r19,r2,r4		r19 = frame address
001aa3ec: 86700002 lh r16,0x0002(r19)		load 0x02 of frame data // Number of graphics?
001aa3f0: 90c20003 lbu r2,0x0003(r6)		load Num Graphics
001aa3f4: 00000000 nop
001aa3f8: 10500007 beq r2,r16,0x001aa418	branch if equal // Error check? below finds a new r6 pointer if there's an inequality
001aa3fc: 02009021 addu r18,r16,r0
001aa400: 0c0694ad jal 0x001a52b4		???
001aa404: 00c02021 addu r4,r6,r0
001aa408: 0c06948b jal 0x001a522c		???
001aa40c: 324400ff andi r4,r18,0x00ff
001aa410: 00403021 addu r6,r2,r0
001aa414: ae260020 sw r6,0x0020(r17)		store effect construction data pointer
001aa418: 1a000013 blez r16,0x001aa468		branch if 0x03 in frame data <= 0
001aa41c: 00002821 addu r5,r0,r0		r5 = counter
001aa420: 02003821 addu r7,r16,r0
001aa424: 00051c00 sll r3,r5,0x10
001aa428: 00031c03 sra r3,r3,0x10
001aa42c: 00032080 sll r4,r3,0x02		counter*4
001aa430: 00862021 addu r4,r4,r6		counter*4 + address
001aa434: 00031040 sll r2,r3,0x01		counter*2
001aa438: 00431021 addu r2,r2,r3		counter*3
001aa43c: 000210c0 sll r2,r2,0x03		counter*24
001aa440: 24420004 addiu r2,r2,0x0004		counter*24 + 04
001aa444: 02621021 addu r2,r19,r2		r2 = next frames address?
001aa448: ac820008 sw r2,0x0008(r4)		store next frames address in counter*4 + address + 0x08 // sets pointers to each graphic's polygon construction data
001aa44c: 24a20001 addiu r2,r5,0x0001		counter++
001aa450: 00402821 addu r5,r2,r0
001aa454: 00021400 sll r2,r2,0x10
001aa458: 00021403 sra r2,r2,0x10
001aa45c: 0047102a slt r2,r2,r7
001aa460: 1440fff1 bne r2,r0,0x001aa428
001aa464: 00051c00 sll r3,r5,0x10
001aa468: 96220006 lhu r2,0x0006(r17)		function thing
001aa46c: 00000000 nop
001aa470: 3042fffe andi r2,r2,0xfffe		remove changing to new frame byte
001aa474: a6220006 sh r2,0x0006(r17)

if not changing frames
001aa478: a0d40000 sb r20,0x0000(r6)		store blue
001aa47c: a0d50001 sb r21,0x0001(r6)		store green
001aa480: a0d60002 sb r22,0x0002(r6)		store Red
001aa484: 96220006 lhu r2,0x0006(r17)		load function byte
001aa488: 00000000 nop
001aa48c: 30430006 andi r3,r2,0x0006
001aa490: 34020002 ori r2,r0,0x0002
001aa494: 1062004c beq r3,r2,0x001aa5c8		branch if 0x02
001aa498: 28620003 slti r2,r3,0x0003
001aa49c: 10400005 beq r2,r0,0x001aa4b4		branch if not 0x00 or 0x01
001aa4a0: 00000000 nop
001aa4a4: 1060000a beq r3,r0,0x001aa4d0		branch if 0
001aa4a8: 00000000 nop

if changing frames (which means something :b:roke)
001aa4ac: 0806a9e6 j 0x001aa798
001aa4b0: 00000000 nop

if not 2, 1, or 0
001aa4b4: 34020004 ori r2,r0,0x0004
001aa4b8: 10620065 beq r3,r2,0x001aa650		branch if 4
001aa4bc: 34020006 ori r2,r0,0x0006
001aa4c0: 10620098 beq r3,r2,0x001aa724		branch if 6
001aa4c4: 00000000 nop
001aa4c8: 0806a9e6 j 0x001aa798
001aa4cc: 00000000 nop

if function bytes && 6 == 0 (Matrix * vector?)
001aa4d0: 3c10800a lui r16,0x800a
001aa4d4: 26108a24 addiu r16,r16,0x8a24		80098a24 (Camera elements)
001aa4d8: 0c00742a jal 0x0001d0a8              Store_Rotation_matrix_elements_to_GTE - puts camera rotation in MX
001aa4dc: 02002021 addu r4,r16,r0
001aa4e0: 0c00744e jal 0x0001d138		Store_Translation_Vectors_to_GTE - puts camera position in CV
001aa4e4: 02002021 addu r4,r16,r0
001aa4e8: 9622000c lhu r2,0x000c(r17)		load ??
001aa4ec: 96230008 lhu r3,0x0008(r17)		load XX XX
001aa4f0: 27a40018 addiu r4,r29,0x0018		Vector pointer = stack + 0x18 (0x18 = x (h), 0x1a = y (h), 0x1c = z (w))
001aa4f4: 00431021 addu r2,r2,r3		X = XX XX + ??
001aa4f8: a7a20018 sh r2,0x0018(r29)		store X into vector
001aa4fc: 9622000e lhu r2,0x000e(r17)		load ??
001aa500: 9623000a lhu r3,0x000a(r17)		load YY YY
001aa504: 27a50028 addiu r5,r29,0x0028		store resultant vector to stack + 0x28 (0x28 = X coords, 0x2c = Y Coords, 0x30 = Z Coords)
001aa508: 00431021 addu r2,r2,r3		Y = YY YY + ?
001aa50c: a7a2001a sh r2,0x001a(r29)		store Y into vector
001aa510: 96220010 lhu r2,0x0010(r17)		load Z
001aa514: 27a60034 addiu r6,r29,0x0034		Store leading 1s or 0s in stack + 0x34
001aa518: 0c00755e jal 0x0001d578              Get vector*Matrix from GTE		CV + V * MX
001aa51c: a7a2001c sh r2,0x001c(r29)		store Z into vector
001aa520: 8fa20030 lw r2,0x0030(r29)		load Z Coords
001aa524: 92230014 lbu r3,0x0014(r17)		load current 3rd byte in parameter (always 0x1?)
001aa528: 00022083 sra r4,r2,0x02		Z / 4
001aa52c: 2463ffff addiu r3,r3,0xffff		0x1 - 0x1?
001aa530: 2c620005 sltiu r2,r3,0x0005		set if 3rd byte < 0x6?
001aa534: 10400010 beq r2,r0,0x001aa578		branch if not
001aa538: 00031080 sll r2,r3,0x02		3rd byte*4 (0?)
001aa53c: 3c01801a lui r1,0x801a
001aa540: 00220821 addu r1,r1,r2
001aa544: 8c220e34 lw r2,0x0e34(r1)		load return address
001aa548: 00000000 nop
001aa54c: 00400008 jr r2
001aa550: 00000000 nop
			I am not sure how many of these there could even be... but I've included everything that branches into this routine:
				001a0e34: 801aa554 
				001a0e38: 801aa55c 
				001a0e3c: 801aa564 
				001a0e40: 801aa56c 
				001a0e44: 801aa574 

001aa554: 0806a95e j 0x001aa578
001aa558: 2484fff8 addiu r4,r4,0xfff8		Z / 4 - 8

001aa55c: 0806a95e j 0x001aa578
001aa560: 34040008 ori r4,r0,0x0008		Z / 4 == 8

001aa564: 0806a95e j 0x001aa578
001aa568: 3404017e ori r4,r0,0x017e		Z / 4 == 0x17e

001aa56c: 0806a95e j 0x001aa578
001aa570: 34040010 ori r4,r0,0x0010		Z / 4 == 0x10

001aa574: 2484fff0 addiu r4,r4,0xfff0		Z / 4 - 0x10

001aa578: 04800087 bltz r4,0x001aa798		END if Z / 4 < 0
001aa57c: 2882017f slti r2,r4,0x017f		r2 = 1 if Z / 4 < 0x17f
001aa580: 14400002 bne r2,r0,0x001aa58c	
001aa584: 27a50050 addiu r5,r29,0x0050		stack + 0x50
001aa588: 3404017e ori r4,r0,0x017e		cap Z / 4 at 0x17e
001aa58c: 97a20028 lhu r2,0x0028(r29)		Load X Vector
001aa590: 97a3002c lhu r3,0x002c(r29)		Load other Y Vector
001aa594: a7a20050 sh r2,0x0050(r29)		Store X Vector in 0x50 + stack
001aa598: 00041080 sll r2,r4,0x02		Z / 4 * 4 (rounding applies, to make this a pointer)
001aa59c: a7a30052 sh r3,0x0052(r29)		store Y vector component
001aa5a0: 3c03801c lui r3,0x801c
001aa5a4: 8c63c088 lw r3,-0x3f78(r3)		*801bc088 (points to a big math table. might vary? I got 0x80057118)
001aa5a8: 86260012 lh r6,0x0012(r17)		Load Angle
001aa5ac: 00431021 addu r2,r2,r3		Z pointer + table pointer?
001aa5b0: afa20010 sw r2,0x0010(r29)		store pointer to Z table in stack + 0x10
001aa5b4: 8e240020 lw r4,0x0020(r17)		load pointer to some SHP data?
001aa5b8: 3c07800c lui r7,0x800c
001aa5bc: 24e77ca0 addiu r7,r7,0x7ca0		r7 = Camera zoom pointer
001aa5c0: 0806a9e4 j 0x001aa790
001aa5c4: 00000000 nop

if function && 6 = 2 (pure vector translation?)
001aa5c8: 9622000c lhu r2,0x000c(r17)		load X something
001aa5cc: 96230008 lhu r3,0x0008(r17)		load XX XX
001aa5d0: 3c04800a lui r4,0x800a
001aa5d4: 94848a38 lhu r4,-0x75c8(r4)		0x80098a38 (Camera X shift)
001aa5d8: 00431021 addu r2,r2,r3		X total
001aa5dc: 00441021 addu r2,r2,r4		X total + ?
001aa5e0: a7a20050 sh r2,0x0050(r29)		Store X vector component in 0x50 + stack
001aa5e4: 9622000e lhu r2,0x000e(r17)		Load Y something
001aa5e8: 9623000a lhu r3,0x000a(r17)		load YY YY
001aa5ec: 3c04800a lui r4,0x800a
001aa5f0: 94848a3c lhu r4,-0x75c4(r4)		0x80098a3c (Camera Y shift)
001aa5f4: 00431021 addu r2,r2,r3		Y total
001aa5f8: 00441021 addu r2,r2,r4		Y total + ?
001aa5fc: a7a20052 sh r2,0x0052(r29)		Store total Y vector in 0x52 + stack
001aa600: 86240010 lh r4,0x0010(r17)		Z
001aa604: 00000000 nop
001aa608: 04810003 bgez r4,0x001aa618		branch if Z >= 0
001aa60c: 2882017f slti r2,r4,0x017f		set if Z < 0x17f
001aa610: 00002021 addu r4,r0,r0		set Z to 0 if underneath bounds
001aa614: 2882017f slti r2,r4,0x017f		and you feel the need to do this again. genius
001aa618: 14400002 bne r2,r0,0x001aa624	branch if 0 <= Z <= 0x17e
001aa61c: 27a50050 addiu r5,r29,0x0050		r5 = stack pointer + 0x50
001aa620: 3404017e ori r4,r0,0x017e		cap Z at 0x17e
001aa624: 00041080 sll r2,r4,0x02		r2 = Z pointer
001aa628: 3c03801c lui r3,0x801c
001aa62c: 8c63c088 lw r3,-0x3f78(r3)		pointer to current primative location
001aa630: 86260012 lh r6,0x0012(r17)		Load angle
001aa634: 00431021 addu r2,r2,r3		GPU primative table
001aa638: afa20010 sw r2,0x0010(r29)		store in 0x10 + stack
001aa63c: 8e240020 lw r4,0x0020(r17)		load some SHP data pointer again
001aa640: 3c07800c lui r7,0x800c
001aa644: 24e77ca0 addiu r7,r7,0x7ca0		r7 = Camera zoom pointer
001aa648: 0806a9e4 j 0x001aa790
001aa64c: 00000000 nop

if Function && 6 = 4 (Vector * Matrix)
001aa650: 3c10800a lui r16,0x800a
001aa654: 26108a24 addiu r16,r16,0x8a24	r16 = 0x80098a24 (Camera elements)
001aa658: 0c00742a jal 0x0001d0a8               Store Rotation matrix elements to GTE return camera rotation in MX
001aa65c: 02002021 addu r4,r16,r0		r4 = r16
001aa660: 0c00744e jal 0x0001d138               Store Translation Vectors to GTE return camera position in CV
001aa664: 02002021 addu r4,r16,r0		r4 = r16
001aa668: 9622000c lhu r2,0x000c(r17)		X something
001aa66c: 96230008 lhu r3,0x0008(r17)		load XX XX
001aa670: 27a40018 addiu r4,r29,0x0018		parse vector pointer to 0x18 stack
001aa674: 00431021 addu r2,r2,r3
001aa678: a7a20018 sh r2,0x0018(r29)		Store total X Vector
001aa67c: 9622000e lhu r2,0x000e(r17)		Y something
001aa680: 9623000a lhu r3,0x000a(r17)		load YY YY
001aa684: 27a50028 addiu r5,r29,0x0028		return results to stack 0x28
001aa688: 00431021 addu r2,r2,r3
001aa68c: a7a2001a sh r2,0x001a(r29)		store total Y vector
001aa690: 96220010 lhu r2,0x0010(r17)		Load Z
001aa694: 27a60034 addiu r6,r29,0x0034		stack + 0x34 for leading 1s or 0s
001aa698: 0c00755e jal 0x0001d578                Get vector*matrix from GTE
001aa69c: a7a2001c sh r2,0x001c(r29)		Store total Z vector
001aa6a0: 8fa20030 lw r2,0x0030(r29)		Load Z
001aa6a4: 92230014 lbu r3,0x0014(r17)		Load current 3rd byte of parameter
001aa6a8: 00022083 sra r4,r2,0x02		Z / 4
001aa6ac: 2463ffff addiu r3,r3,0xffff		0x03 - 1
001aa6b0: 2c620005 sltiu r2,r3,0x0005		set if *0x03 - 1 is less than 0x5
001aa6b4: 10400010 beq r2,r0,0x001aa6f8	branch if not
001aa6b8: 00031080 sll r2,r3,0x02		3rd byte word
001aa6bc: 3c01801a lui r1,0x801a
001aa6c0: 00220821 addu r1,r1,r2
001aa6c4: 8c220e4c lw r2,0x0e4c(r1)		return word
001aa6c8: 00000000 nop
001aa6cc: 00400008 jr r2
001aa6d0: 00000000 nop
				001a0e4c: 801aa6d4 
				001a0e50: 801aa6dc 
				001a0e54: 801aa6e4 
				001a0e58: 801aa6ec 
				001a0e5c: 801aa6f4 

001aa6d4: 0806a9be j 0x001aa6f8
001aa6d8: 2484fff8 addiu r4,r4,0xfff8		Z / 4 - 8

001aa6dc: 0806a9be j 0x001aa6f8
001aa6e0: 34040008 ori r4,r0,0x0008		Z / 4 = 8

001aa6e4: 0806a9be j 0x001aa6f8
001aa6e8: 3404017e ori r4,r0,0x017e		Z / 4 = 0x017e

001aa6ec: 0806a9be j 0x001aa6f8
001aa6f0: 34040010 ori r4,r0,0x0010		Z / 4 = 0x10

001aa6f4: 2484fff0 addiu r4,r4,0xfff0		Z / 4 - 0x10

001aa6f8: 04800027 bltz r4,0x001aa798		END if Z / 4 < 0
001aa6fc: 2882017f slti r2,r4,0x017f
001aa700: 14400002 bne r2,r0,0x001aa70c	Cap Z / 4 at 0x17e
001aa704: 27a50050 addiu r5,r29,0x0050		r5 points to 0x50 + stack (X and Y Vector components)
001aa708: 3404017e ori r4,r0,0x017e		^
001aa70c: 97a20028 lhu r2,0x0028(r29)		X vector
001aa710: 97a3002c lhu r3,0x002c(r29)		Y vector
001aa714: a7a20050 sh r2,0x0050(r29)		Store final X vector component
001aa718: 00041080 sll r2,r4,0x02		r2 = Z / 4 * 4 (rounding applies)
001aa71c: 0806a9dd j 0x001aa774
001aa720: a7a30052 sh r3,0x0052(r29)		Store final Y vector component

if function && 6 == 6 (no change?)
001aa724: 9622000c lhu r2,0x000c(r17)		load X something?
001aa728: 96230008 lhu r3,0x0008(r17)		Load XX XX
001aa72c: 00000000 nop
001aa730: 00431021 addu r2,r2,r3		total XX
001aa734: a7a20050 sh r2,0x0050(r29)		Store total XX
001aa738: 9622000e lhu r2,0x000e(r17)		Load Y something?
001aa73c: 9623000a lhu r3,0x000a(r17)		Load YY YY
001aa740: 00000000 nop
001aa744: 00431021 addu r2,r2,r3
001aa748: a7a20052 sh r2,0x0052(r29)		Store total YY
001aa74c: 86240010 lh r4,0x0010(r17)		load Z
001aa750: 00000000 nop
001aa754: 04810003 bgez r4,0x001aa764		set z to 0 if less than 0,
001aa758: 2882017f slti r2,r4,0x017f
001aa75c: 00002021 addu r4,r0,r0
001aa760: 2882017f slti r2,r4,0x017f
001aa764: 14400002 bne r2,r0,0x001aa770	cap z at 0x17e if greater than -0x17e
001aa768: 27a50050 addiu r5,r29,0x0050		r5 = vector pointer
001aa76c: 3404017e ori r4,r0,0x017e
001aa770: 00041080 sll r2,r4,0x02		absolute depth

Function 4 return:
001aa774: 3c03801c lui r3,0x801c
001aa778: 8c63c088 lw r3,-0x3f78(r3)		gpu primative table
001aa77c: 86260012 lh r6,0x0012(r17)		Load angle
001aa780: 00431021 addu r2,r2,r3		
001aa784: afa20010 sw r2,0x0010(r29)		Store Z pointer in stack
001aa788: 8e240020 lw r4,0x0020(r17)		load pointer to graphic construction data
001aa78c: 00003821 addu r7,r0,r0		r7 = 0

Function 2 and Function 0 return:
001aa790: 0c0694e5 jal 0x001a5394			Construct Polygon Data For Effects
001aa794: 00000000 nop
001aa798: 8fbf007c lw r31,0x007c(r29)
001aa79c: 8fb60078 lw r22,0x0078(r29)
001aa7a0: 8fb50074 lw r21,0x0074(r29)
001aa7a4: 8fb40070 lw r20,0x0070(r29)
001aa7a8: 8fb3006c lw r19,0x006c(r29)
001aa7ac: 8fb20068 lw r18,0x0068(r29)
001aa7b0: 8fb10064 lw r17,0x0064(r29)
001aa7b4: 8fb00060 lw r16,0x0060(r29)
001aa7b8: 27bd0080 addiu r29,r29,0x0080
001aa7bc: 03e00008 jr r31
001aa7c0: 00000000 nop