Difference between revisions of "Construct Polygon Data For Effects"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
Line 136: Line 136:
 
  001a55a0: 01007021 addu r14,r8,r0 r14 = 0x801bbf50
 
  001a55a0: 01007021 addu r14,r8,r0 r14 = 0x801bbf50
 
  001a55a4: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)
 
  001a55a4: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)
  001a55a8: c9810004 lwc2 gtedr01_vz0,0x0004(r12) [x0,y0,z0] = graphic sprite sheet location
+
  001a55a8: c9810004 lwc2 gtedr01_vz0,0x0004(r12) [x0,y0,z0] = top left corner of graphic
 
  001a55ac: c9a20000 lwc2 gtedr02_vxy1,0x0000(r13)
 
  001a55ac: c9a20000 lwc2 gtedr02_vxy1,0x0000(r13)
  001a55b0: c9a30004 lwc2 gtedr03_vz1,0x0004(r13) [x1,y1,z1] = Graphic location on screen
+
  001a55b0: c9a30004 lwc2 gtedr03_vz1,0x0004(r13) [x1,y1,z1] = top right corner of graphic
 
  001a55b4: c9c40000 lwc2 gtedr04_vxy2,0x0000(r14)
 
  001a55b4: c9c40000 lwc2 gtedr04_vxy2,0x0000(r14)
  001a55b8: c9c50004 lwc2 gtedr05_vz2,0x0004(r14) [x2,y2,z2] = Graphic bottom left corner on screen
+
  001a55b8: c9c50004 lwc2 gtedr05_vz2,0x0004(r14) [x2,y2,z2] = bottom left corner of graphic (All when displayed on screen)
 
  001a55bc: 00000000 nop
 
  001a55bc: 00000000 nop
 
  001a55c0: 00000000 nop
 
  001a55c0: 00000000 nop

Revision as of 08:38, 22 March 2022

001a5394: 27bdffc0 addiu r29,r29,0xffc0		- 0x40
001a5398: afb50034 sw r21,0x0034(r29)
001a539c: 0080a821 addu r21,r4,r0
001a53a0: afb10024 sw r17,0x0024(r29)
001a53a4: 00a08821 addu r17,r5,r0			r5 = pointer to vector [x,y,z] in stack
001a53a8: afb00020 sw r16,0x0020(r29)
001a53ac: 00c08021 addu r16,r6,r0			r16 = Angle value
001a53b0: afb3002c sw r19,0x002c(r29)
001a53b4: 00e09821 addu r19,r7,r0			camera zoom pointer
001a53b8: afb40030 sw r20,0x0030(r29)
001a53bc: 8fb40050 lw r20,0x0050(r29)			some Z related pointer
001a53c0: 34040001 ori r4,r0,0x0001
001a53c4: afbf003c sw r31,0x003c(r29)
001a53c8: afb60038 sw r22,0x0038(r29)
001a53cc: 0c0694cf jal 0x001a533c			001a533c - 001a5390
001a53d0: afb20028 sw r18,0x0028(r29)
001a53d4: 00409021 addu r18,r2,r0			r18 = return pointer (temporary frame data?)
001a53d8: 02402021 addu r4,r18,r0 			r4 = return pointer
001a53dc: 34050001 ori r5,r0,0x0001			r5 = 1
001a53e0: 34060001 ori r6,r0,0x0001			r6 = 1
001a53e4: 34070001 ori r7,r0,0x0001			r7 = 1
001a53e8: 0c009533 jal 0x000254cc			000254cc - 00025520 - store something in temporary frame data with all these... yes/no checks
001a53ec: afa00010 sw r0,0x0010(r29)			r0 = 0
001a53f0: 3c0400ff lui r4,0x00ff
001a53f4: 3484ffff ori r4,r4,0xffff
001a53f8: 3c05ff00 lui r5,0xff00
001a53fc: 00108400 sll r16,r16,0x10
001a5400: 8e430000 lw r3,0x0000(r18)
001a5404: 8e820000 lw r2,0x0000(r20)			odd extensive table. the following process swaps return pointers with what's in temp. frame data and the table.
001a5408: 00651824 and r3,r3,r5
001a540c: 00441024 and r2,r2,r4
001a5410: 00621825 or r3,r3,r2
001a5414: ae430000 sw r3,0x0000(r18)
001a5418: 8e820000 lw r2,0x0000(r20)
001a541c: 02442024 and r4,r18,r4
001a5420: 00451024 and r2,r2,r5
001a5424: 00441025 or r2,r2,r4
001a5428: ae820000 sw r2,0x0000(r20)
001a542c: 86220000 lh r2,0x0000(r17)			up to here. Load XX
001a5430: 00108403 sra r16,r16,0x10
001a5434: 3c01801c lui r1,0x801c
001a5438: ac22c0b0 sw r2,-0x3f50(r1)			store vector XX in 0x801bc0b0
001a543c: 86220002 lh r2,0x0002(r17)			load YY
001a5440: 3c01801c lui r1,0x801c
001a5444: ac22c0b4 sw r2,-0x3f4c(r1)			store vector YY in 0x801bc0b4
001a5448: 0c006f0a jal 0x0001bc28			Cos call function calculates cosine of r4 
001a544c: 02002021 addu r4,r16,r0			r4 = angle value
001a5450: 02002021 addu r4,r16,r0			r4 = angle value
001a5454: 0c006ed7 jal 0x0001bb5c			Call Sin function calculates sin of r4
001a5458: 00408821 addu r17,r2,r0			Preserve Cos(θ) in r17
001a545c: 02208021 addu r16,r17,r0			
001a5460: 00402021 addu r4,r2,r0			move sin(θ) to r4
001a5464: 12600022 beq r19,r0,0x001a54f0		If Camera zoom pointer is not Null // Else apply standard rotational matrix, with no magnification/shrinking
001a5468: 00801021 addu r2,r4,r0			put sin(θ) in r2
001a546c: 00111c00 sll r3,r17,0x10
001a5470: 8e620000 lw r2,0x0000(r19)			Load camera zoom X
001a5474: 00031c03 sra r3,r3,0x10			cos(θ)
001a5478: 00620018 mult r3,r2				X-Zoom*cos(θ)
001a547c: 00001012 mflo r2
001a5480: 00021303 sra r2,r2,0x0c			>> 0xc
001a5484: 3c01801c lui r1,0x801c
001a5488: a422c09c sh r2,-0x3f64(r1)			Store X-Zoom*cos(θ) at Matrix element r_11
001a548c: 8e620004 lw r2,0x0004(r19)			load Camera zoom Y
001a5490: 00000000 nop
001a5494: 00620018 mult r3,r2				
001a5498: 00041c00 sll r3,r4,0x10
001a549c: 00031c03 sra r3,r3,0x10			sin(θ)
001a54a0: 00001012 mflo r2
001a54a4: 00021303 sra r2,r2,0x0c			Y-Zoom * cos(θ) >> 0xc
001a54a8: 3c01801c lui r1,0x801c
001a54ac: a422c0a4 sh r2,-0x3f5c(r1)			Store Y-zoom*cos(θ) at Matrix element r_22
001a54b0: 8e640004 lw r4,0x0004(r19)			Load Y-Zoom
001a54b4: 00031023 subu r2,r0,r3			-sin(θ)
001a54b8: 00440018 mult r2,r4
001a54bc: 00001012 mflo r2				Y-Zoom * sin(θ)
001a54c0: 00021303 sra r2,r2,0x0c			>> 0xc
001a54c4: 3c01801c lui r1,0x801c
001a54c8: a422c09e sh r2,-0x3f62(r1)			Store Y-Zoom * sin(θ) at Matrix element r_21
001a54cc: 8e620000 lw r2,0x0000(r19)			Load X-Zoom
001a54d0: 00000000 nop
001a54d4: 00620018 mult r3,r2				X-Zoom * -sin(θ)
001a54d8: 00001012 mflo r2
001a54dc: 00021303 sra r2,r2,0x0c			>> 0xc
001a54e0: 3c01801c lui r1,0x801c
001a54e4: a422c0a2 sh r2,-0x3f5e(r1)			Store X-Zoom* -sin(θ) at Matrix element r_12
001a54e8: 08069545 j 0x001a5514			okay do the rotation matrix now :)
001a54ec: 00000000 nop

If null Z table pointer:
001a54f0: 3c01801c lui r1,0x801c
001a54f4: a422c0a2 sh r2,-0x3f5e(r1)			store sin(θ) at Matrix element r_21
001a54f8: 00041023 subu r2,r0,r4
001a54fc: 3c01801c lui r1,0x801c
001a5500: a430c0a4 sh r16,-0x3f5c(r1)			Store cos(θ) at Matrix element r_22
001a5504: 3c01801c lui r1,0x801c
001a5508: a430c09c sh r16,-0x3f64(r1)			Store cos(θ) at Matrix element r_11
001a550c: 3c01801c lui r1,0x801c
001a5510: a422c09e sh r2,-0x3f62(r1)			store -sin(θ) at Matrix element r_12 -- a standard rotation matrix.
001a5514: 3c10801c lui r16,0x801c
001a5518: 2610c09c addiu r16,r16,0xc09c
001a551c: 0c00742a jal 0x0001d0a8                   Store Rotation matrix elements to GTE
001a5520: 02002021 addu r4,r16,r0			Rotational matrix pointer
001a5524: 0c00744e jal 0x0001d138                   Store_Translation_Vectors_to_GTE 
001a5528: 02002021 addu r4,r16,r0			the same thing. but vector translation is some amount after the matrix pointer.
001a552c: 92a20003 lbu r2,0x0003(r21)			Load ? from SHP data (some VRAM flag check?)
001a5530: 00000000 nop
001a5534: 18400076 blez r2,0x001a5710			branch if <= 0 (if no flags?)
001a5538: 00008821 addu r17,r0,r0			counter = 0
001a553c: 3416002c ori r22,r0,0x002c			r22 = 0x2c
001a5540: 3c1200ff lui r18,0x00ff
001a5544: 3652ffff ori r18,r18,0xffff			r18 = 0x00ffffff
001a5548: 3c13ff00 lui r19,0xff00			r19 = 0xff000000
001a554c: 00111080 sll r2,r17,0x02			counter * 4
001a5550: 00551021 addu r2,r2,r21			counter * 4
001a5554: 8c500008 lw r16,0x0008(r2)			load frame's data address + 0x4?
001a5558: 00000000 nop
001a555c: 8e020008 lw r2,0x0008(r16)			top left XX and YY
001a5560: 3c01801c lui r1,0x801c
001a5564: ac22bf40 sw r2,-0x40c0(r1)			stores top left XX and YY to 0x801bbf40
001a5568: 8e02000c lw r2,0x000c(r16)			load top right XX YY
001a556c: 3c01801c lui r1,0x801c
001a5570: ac22bf48 sw r2,-0x40b8(r1)			store top right XX YY to 0x801bbf48
001a5574: 8e020010 lw r2,0x0010(r16)			Bottom left XX YY
001a5578: 3c08801c lui r8,0x801c
001a557c: 2508bf40 addiu r8,r8,0xbf40			r8 = 0x801bbf40
001a5580: 3c01801c lui r1,0x801c
001a5584: ac22bf50 sw r2,-0x40b0(r1)			store bottom left XX YY 0x801bbf50
001a5588: 01006021 addu r12,r8,r0			r12 = 0x801bbf40
001a558c: 3c08801c lui r8,0x801c
001a5590: 2508bf48 addiu r8,r8,0xbf48			r8 = 0x801bbf48
001a5594: 01006821 addu r13,r8,r0			r13 = 0x801bbf48
001a5598: 3c08801c lui r8,0x801c
001a559c: 2508bf50 addiu r8,r8,0xbf50
001a55a0: 01007021 addu r14,r8,r0			r14 = 0x801bbf50
001a55a4: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)	
001a55a8: c9810004 lwc2 gtedr01_vz0,0x0004(r12)	[x0,y0,z0] = top left corner of graphic
001a55ac: c9a20000 lwc2 gtedr02_vxy1,0x0000(r13)	
001a55b0: c9a30004 lwc2 gtedr03_vz1,0x0004(r13)	[x1,y1,z1] = top right corner of graphic
001a55b4: c9c40000 lwc2 gtedr04_vxy2,0x0000(r14)	
001a55b8: c9c50004 lwc2 gtedr05_vz2,0x0004(r14)	[x2,y2,z2] = bottom left corner of graphic (All when displayed on screen)
001a55bc: 00000000 nop
001a55c0: 00000000 nop
001a55c4: 4a280030 rtpt				perspective transformation? maps the coordinates of the sprite sheet to the field?
001a55c8: 8e020014 lw r2,0x0014(r16)			load bottom left XX YY
001a55cc: 3c01801c lui r1,0x801c
001a55d0: ac22bf58 sw r2,-0x40a8(r1)			store bottom right XX and YY on screen at 0x801bbf58
001a55d4: 0c0694cf jal 0x001a533c			001a533c - 001a5390 update some pointer?
001a55d8: 00002021 addu r4,r0,r0			r4 = 0
001a55dc: 00402021 addu r4,r2,r0			r4 = return pointer
001a55e0: 8ea30000 lw r3,0x0000(r21)			load 80 80 80 (or whatever the other inputs end up being?) and 01
001a55e4: 34020009 ori r2,r0,0x0009
001a55e8: a0820003 sb r2,0x0003(r4)			store 0x9 here
001a55ec: ac830004 sw r3,0x0004(r4)			store word of... this 808080, data
001a55f0: a0960007 sb r22,0x0007(r4)			overwrite the last byte with 0x2c
001a55f4: 96020000 lhu r2,0x0000(r16)			VRAM things
001a55f8: 00000000 nop
001a55fc: 30420200 andi r2,r2,0x0200			check for VRAM flag 0x0200?
001a5600: 10400002 beq r2,r0,0x001a560c		branch if no (don't store 0x2e)
001a5604: 3402002e ori r2,r0,0x002e			r2 = 0x2e
001a5608: a0820007 sb r2,0x0007(r4)			store 0x2e in r4 again
001a560c: 24820008 addiu r2,r4,0x0008			
001a5610: 00406021 addu r12,r2,r0			r12 = pointer + 0x8
001a5614: 24820010 addiu r2,r4,0x0010
001a5618: 00406821 addu r13,r2,r0			r13 = pointer + 0x10
001a561c: 24820018 addiu r2,r4,0x0018
001a5620: 00407021 addu r14,r2,r0			r14 = pointer + 0x18
001a5624: e98c0000 swc2 gtedr12_sxy0,0x0000(r12)	store [x0, y0] to this pointer
001a5628: e9ad0000 swc2 gtedr13_sxy1,0x0000(r13)	[x1, y1]
001a562c: e9ce0000 swc2 gtedr14_sxy2,0x0000(r14)	[x2, y2]
001a5630: 3c08801c lui r8,0x801c
001a5634: 2508bf58 addiu r8,r8,0xbf58			0x801bbf58
001a5638: 01006021 addu r12,r8,r0
001a563c: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)	load bottom right XX and YY
001a5640: c9810004 lwc2 gtedr01_vz0,0x0004(r12)	also z but that's not important. I think just sets to 0 for math's sake.
001a5644: 00000000 nop
001a5648: 00000000 nop
001a564c: 4a180001 rtps				maps the bottom right screen coordinate to the field
001a5650: 96020002 lhu r2,0x0002(r16)			VRAM things
001a5654: 00000000 nop
001a5658: a4820016 sh r2,0x0016(r4)			store in 0x16 here?
001a565c: 96020000 lhu r2,0x0000(r16)			more vram things
001a5660: 00000000 nop
001a5664: 3043000f andi r3,r2,0x000f			obtain only values less than 0x10
001a5668: 30420010 andi r2,r2,0x0010			checks for flag 10?
001a566c: 14400002 bne r2,r0,0x001a5678		branch if no 0x10 flag (VRAM palette ID? maybe? is 0x40 less?)
001a5670: 24627b40 addiu r2,r3,0x7b40			0xf + 0x7b40
001a5674: 24627b00 addiu r2,r3,0x7b00			0xf + 0x7b00
001a5678: a482000e sh r2,0x000e(r4)			store here
001a567c: 92020004 lbu r2,0x0004(r16)			Load graphic X location
001a5680: 00000000 nop
001a5684: a082001c sb r2,0x001c(r4)			store graphic X
001a5688: a082000c sb r2,0x000c(r4)			store graphic X
001a568c: 92030006 lbu r3,0x0006(r16)			Load graphic width
001a5690: 00000000 nop
001a5694: 00431021 addu r2,r2,r3			add graphic X and width
001a5698: a0820024 sb r2,0x0024(r4)			store top right graphic corner
001a569c: a0820014 sb r2,0x0014(r4)			store top right graphic corner
001a56a0: 92020005 lbu r2,0x0005(r16)			load graphic Y
001a56a4: 00000000 nop
001a56a8: a0820015 sb r2,0x0015(r4)			store graphic Y
001a56ac: a082000d sb r2,0x000d(r4)			"
001a56b0: 92030007 lbu r3,0x0007(r16)			Load graphic Height
001a56b4: 00000000 nop
001a56b8: 00431021 addu r2,r2,r3			graphic Y + Graphic height
001a56bc: a0820025 sb r2,0x0025(r4)			store graphic bottom left corner
001a56c0: a082001d sb r2,0x001d(r4)			"
001a56c4: 24820020 addiu r2,r4,0x0020			graphic temp SHP data pointer + 0x20
001a56c8: 00406021 addu r12,r2,r0			
001a56cc: e98e0000 swc2 gtedr14_sxy2,0x0000(r12)	Store bottom right corner in field here
001a56d0: 8c830000 lw r3,0x0000(r4)			load? (includes 0x9 from before.)
001a56d4: 8e820000 lw r2,0x0000(r20)			load value from extensive table
001a56d8: 00731824 and r3,r3,r19			ensure only the 0x9 from above is taken
001a56dc: 00521024 and r2,r2,r18			ensure only the first 3 bytes are selected
001a56e0: 00621825 or r3,r3,r2				combine them
001a56e4: ac830000 sw r3,0x0000(r4)			store new? 
001a56e8: 8e820000 lw r2,0x0000(r20)			
001a56ec: 00921824 and r3,r4,r18			get pure ram location from frame data pointer
001a56f0: 00531024 and r2,r2,r19			grab the final byte
001a56f4: 00431025 or r2,r2,r3				combine them
001a56f8: ae820000 sw r2,0x0000(r20)			store them into that extensive table again
001a56fc: 92a20003 lbu r2,0x0003(r21)			load byte from here
001a5700: 26310001 addiu r17,r17,0x0001
001a5704: 0222102a slt r2,r17,r2			set if byte is 0
001a5708: 1440ff91 bne r2,r0,0x001a5550		branch if it is 0
001a570c: 00111080 sll r2,r17,0x02			r2 = byte * 4

return if 0x03 flag = 0
001a5710: 0c0694cf jal 0x001a533c			001a533c - 001a5390 Update pointer?
001a5714: 34040001 ori r4,r0,0x0001			r4 = 1 
001a5718: 00409021 addu r18,r2,r0			r18 = result
001a571c: 02402021 addu r4,r18,r0			r4 = result
001a5720: 34050001 ori r5,r0,0x0001			r5 = 1
001a5724: 00003021 addu r6,r0,r0			r6 = 0
001a5728: 34070001 ori r7,r0,0x0001			r7 = 1
001a572c: 0c009533 jal 0x000254cc			000254cc - 00025520
001a5730: afa00010 sw r0,0x0010(r29)			stack 0x10 = 0
001a5734: 3c0400ff lui r4,0x00ff
001a5738: 3484ffff ori r4,r4,0xffff
001a573c: 3c05ff00 lui r5,0xff00
001a5740: 8e430000 lw r3,0x0000(r18)
001a5744: 8e820000 lw r2,0x0000(r20)
001a5748: 00651824 and r3,r3,r5
001a574c: 00441024 and r2,r2,r4
001a5750: 00621825 or r3,r3,r2				perform the same combining as above.
001a5754: ae430000 sw r3,0x0000(r18)
001a5758: 8e820000 lw r2,0x0000(r20)
001a575c: 02442024 and r4,r18,r4
001a5760: 00451024 and r2,r2,r5
001a5764: 00441025 or r2,r2,r4				"
001a5768: ae820000 sw r2,0x0000(r20)
001a576c: 8fbf003c lw r31,0x003c(r29)
001a5770: 8fb60038 lw r22,0x0038(r29)
001a5774: 8fb50034 lw r21,0x0034(r29)
001a5778: 8fb40030 lw r20,0x0030(r29)
001a577c: 8fb3002c lw r19,0x002c(r29)
001a5780: 8fb20028 lw r18,0x0028(r29)
001a5784: 8fb10024 lw r17,0x0024(r29)
001a5788: 8fb00020 lw r16,0x0020(r29)
001a578c: 27bd0040 addiu r29,r29,0x0040
001a5790: 03e00008 jr r31
001a5794: 00000000 nop