mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Gfx commands to Copy Lights into Env/Prim color (#927)
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				Build coop / build-linux (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-steamos (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-windows-opengl (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-windows-directx (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-macos-arm (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-macos-intel (push) Waiting to run
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	Build coop / build-linux (push) Waiting to run
				
			Build coop / build-steamos (push) Waiting to run
				
			Build coop / build-windows-opengl (push) Waiting to run
				
			Build coop / build-windows-directx (push) Waiting to run
				
			Build coop / build-macos-arm (push) Waiting to run
				
			Build coop / build-macos-intel (push) Waiting to run
				
			This commit is contained in:
		
							parent
							
								
									e0c76a9ecc
								
							
						
					
					
						commit
						5f1a2d0b42
					
				
					 8 changed files with 61 additions and 1 deletions
				
			
		|  | @ -110,7 +110,10 @@ include_constants = { | |||
|         "^G_TEXRECTFLIP$", | ||||
|         "^G_TEXRECT$", | ||||
|     ], | ||||
|     "include/PR/gbi_extension.h": [ "G_VTX_EXT" ], | ||||
|     "include/PR/gbi_extension.h": [ | ||||
|         "^G_VTX_EXT$", | ||||
|         "^G_PPARTTOCOLOR$" | ||||
|     ], | ||||
| } | ||||
| 
 | ||||
| # Constants that exist in the source code but should not appear | ||||
|  |  | |||
|  | @ -2944,6 +2944,9 @@ G_TEXRECT = 0xe4 | |||
| --- @type integer | ||||
| G_VTX_EXT = 0x11 | ||||
| 
 | ||||
| --- @type integer | ||||
| G_PPARTTOCOLOR = 0xd3 | ||||
| 
 | ||||
| BACKGROUND_OCEAN_SKY       =  0 --- @type SkyBackgroundParams | ||||
| BACKGROUND_FLAMING_SKY     =  1 --- @type SkyBackgroundParams | ||||
| BACKGROUND_UNDERWATER_CITY =  2 --- @type SkyBackgroundParams | ||||
|  |  | |||
|  | @ -406,6 +406,12 @@ s64 DynOS_Gfx_ParseGfxConstants(const String& _Arg, bool* found) { | |||
|     gfx_constant(G_LIGHTING_ENGINE_EXT); | ||||
|     gfx_constant(G_PACKED_NORMALS_EXT); | ||||
| 
 | ||||
|     gfx_constant(G_COL_PRIM); | ||||
|     gfx_constant(G_COL_ENV); | ||||
| 
 | ||||
|     gfx_constant(G_CP_LIGHT); | ||||
|     gfx_constant(G_CP_AMBIENT); | ||||
| 
 | ||||
|     // Common values
 | ||||
|     gfx_constant(CALC_DXT(4,G_IM_SIZ_4b_BYTES)); | ||||
|     gfx_constant(CALC_DXT(8,G_IM_SIZ_4b_BYTES)); | ||||
|  |  | |||
|  | @ -1298,6 +1298,7 @@ | |||
| 
 | ||||
| ## [gbi_extension.h](#gbi_extension.h) | ||||
| - G_VTX_EXT | ||||
| - G_PPARTTOCOLOR | ||||
| 
 | ||||
| [:arrow_up_small:](#) | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,3 +93,28 @@ | |||
| 
 | ||||
| #define gDPSetTextureClippingDjui(pkt, x1, y1, x2, y2)         gSetClippingDjui(pkt, G_TEXCLIP_DJUI, x1, y1, x2, y2) | ||||
| #define gDPSetTextureOverrideDjui(pkt, texture, w, h, bitSize) gSetOverrideDjui(pkt, G_TEXOVERRIDE_DJUI, texture, w, h, bitSize) | ||||
| 
 | ||||
| ////////////////////
 | ||||
| // G_PPARTTOCOLOR //
 | ||||
| ////////////////////
 | ||||
| 
 | ||||
| #define G_PPARTTOCOLOR 0xd3 | ||||
| 
 | ||||
| #define G_COL_PRIM   0x0 | ||||
| #define G_COL_ENV    0x1 | ||||
| 
 | ||||
| #define G_CP_LIGHT   0x0 | ||||
| #define G_CP_AMBIENT 0x1 | ||||
| 
 | ||||
| #define gSPCopyPlayerPartToColor(pkt, color, part, offset)             \ | ||||
| {                                                                \ | ||||
|     Gfx *_g = (Gfx *)(pkt);                                      \ | ||||
|     _g->words.w0 = (_SHIFTL(G_PPARTTOCOLOR, 24, 8)) | (_SHIFTL(color, 16, 8)); \ | ||||
|     _g->words.w1 = ((2 * ((part) + 1)) + 1 + offset);            \ | ||||
| } | ||||
| 
 | ||||
| #define gsSPCopyPlayerPartToColor(color, part, offset)                     \ | ||||
| {{                                                                   \ | ||||
|     (_SHIFTL(G_PPARTTOCOLOR, 24, 8)) | (_SHIFTL(color, 16, 8)),        \ | ||||
|     ((2 * ((part) + 1)) + 1 + offset)                                \ | ||||
| }} | ||||
|  |  | |||
|  | @ -55,6 +55,7 @@ define_gfx_symbol(gsSPFogFactor, 2, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_IN | |||
| define_gfx_symbol(gsMoveWd, 3, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT); | ||||
| define_gfx_symbol(gsSPLoadGeometryMode, 1, false, GFX_PARAM_TYPE_INT); | ||||
| define_gfx_symbol(gsSPVertexNonGlobal, 3, true, GFX_PARAM_TYPE_VTX, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT); | ||||
| define_gfx_symbol(gsSPCopyPlayerPartToColor, 3, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT); | ||||
| 
 | ||||
| define_gfx_symbol_manual(gsSPTexture, 5, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT); | ||||
| define_gfx_symbol_manual(gsSPSetGeometryMode, 1, false, GFX_PARAM_TYPE_INT); | ||||
|  |  | |||
|  | @ -2114,6 +2114,23 @@ static void OPTIMIZE_O3 djui_gfx_dp_execute_djui(uint32_t opcode) { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| static void gfx_sp_copy_playerpart_to_color(uint8_t color, uint32_t idx) { | ||||
|     SUPPORT_CHECK(color == G_COL_PRIM || color == G_COL_ENV); | ||||
| 
 | ||||
|     if (idx >= 1 && idx <= MAX_LIGHTS) { | ||||
|         Light_t *l = (rsp.current_lights + (idx - 1)); | ||||
|         struct RGBA *targetColor = NULL; | ||||
|         switch (color) { | ||||
|             case G_COL_PRIM: targetColor = &rdp.prim_color; break; | ||||
|             case G_COL_ENV:  targetColor = &rdp.env_color;  break; | ||||
|         } | ||||
| 
 | ||||
|         targetColor->r = l->col[0]; | ||||
|         targetColor->g = l->col[1]; | ||||
|         targetColor->b = l->col[2]; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static void OPTIMIZE_O3 djui_gfx_dp_set_clipping(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) { | ||||
|     sDjuiClipX1 = x1; | ||||
|     sDjuiClipY1 = y1; | ||||
|  | @ -2177,5 +2194,8 @@ void OPTIMIZE_O3 ext_gfx_run_dl(Gfx* cmd) { | |||
|         case G_EXECUTE_DJUI: | ||||
|             djui_gfx_dp_execute_djui(cmd->words.w1); | ||||
|             break; | ||||
|         case G_PPARTTOCOLOR: | ||||
|             gfx_sp_copy_playerpart_to_color(C0(16, 8), cmd->words.w1); | ||||
|             break; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1523,6 +1523,7 @@ char gSmluaConstants[] = "" | |||
| "G_TEXRECTFLIP=0xe5\n" | ||||
| "G_TEXRECT=0xe4\n" | ||||
| "G_VTX_EXT=0x11\n" | ||||
| "G_PPARTTOCOLOR=0xd3\n" | ||||
| "BACKGROUND_OCEAN_SKY=0\n" | ||||
| "BACKGROUND_FLAMING_SKY=1\n" | ||||
| "BACKGROUND_UNDERWATER_CITY=2\n" | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 ManIsCat2
						ManIsCat2