@@ -158,9 +158,9 @@ static cc_bool cullingEnabled;
158158void Gfx_RestoreState (void ) {
159159 InitDefaultResources ();
160160
161- // 2x2 dummy white texture
161+ // dummy texture (grey works better in menus than white)
162162 struct Bitmap bmp ;
163- BitmapCol pixels [4 ] = { BitmapColor_RGB (255 , 0 , 0 ), BITMAPCOLOR_WHITE , BITMAPCOLOR_WHITE , BITMAPCOLOR_WHITE };
163+ BitmapCol pixels [4 ] = { BitmapColor_RGB (130 , 130 , 130 ), BitmapColor_RGB ( 130 , 130 , 130 ), BitmapColor_RGB ( 130 , 130 , 130 ), BitmapColor_RGB ( 130 , 130 , 130 ) };
164164 Bitmap_Init (bmp , 2 , 2 , pixels );
165165 white_square = Gfx_CreateTexture (& bmp , 0 , false);
166166}
@@ -171,7 +171,7 @@ void Gfx_FreeState(void) {
171171}
172172
173173void Gfx_Create (void ) {
174- Gfx .MaxTexWidth = 128 ;
174+ Gfx .MaxTexWidth = 256 ;
175175 Gfx .MaxTexHeight = 256 ;
176176 Gfx .Created = true;
177177 Gfx .Limitations = GFX_LIMIT_MAX_VERTEX_SIZE ;
@@ -338,7 +338,7 @@ typedef struct GPUTexture {
338338 cc_uint16 width , height ;
339339 cc_uint8 u_shift , v_shift ;
340340 cc_uint8 xOffset , yOffset ;
341- cc_uint16 tpage , line ;
341+ cc_uint16 tpage , clut , line ;
342342} GPUTexture ;
343343static GPUTexture textures [TEXTURES_MAX_COUNT ];
344344static GPUTexture * curTex ;
@@ -370,6 +370,7 @@ static void* AllocTextureAt(int i, struct Bitmap* bmp, int rowWidth) {
370370 int pageX = (page % TPAGES_PER_HALF );
371371 int pageY = (page / TPAGES_PER_HALF );
372372 tex -> tpage = (2 << 7 ) | (pageY << 4 ) | pageX ;
373+ tex -> clut = 0 ;
373374
374375 VRAM_AllocBlock (line , bmp -> width , bmp -> height );
375376 if (bmp -> height > bmp -> width ) {
@@ -539,8 +540,8 @@ static void PreprocessTexturedVertices(void) {
539540 dst -> xx = x >> 8 ;
540541 dst -> yy = y >> 8 ;
541542
542- u = src -> U * 0.99f ;
543- v = src -> V == 1.0f ? 0.99f : src -> V ;
543+ u = src -> U * 0.999f ;
544+ v = src -> V == 1.0f ? 0.999f : src -> V ;
544545
545546 dst -> u = UVFixed (u );
546547 dst -> v = UVFixed (v );
@@ -733,14 +734,13 @@ static void DrawColouredQuads2D(int verticesCount, int startVertex) {
733734 struct PS1VertexColoured * v = (struct PS1VertexColoured * )gfx_vertices + startVertex ;
734735 struct PSX_POLY_F4 * poly = next_packet ;
735736 cc_uint8 * max = next_packet_end - sizeof (* poly );
736- return ;
737737
738738 for (int i = 0 ; i < verticesCount ; i += 4 , v += 4 )
739739 {
740740 if ((cc_uint8 * )poly > max ) break ;
741741
742742 setlen (poly , POLY_LEN_F4 );
743- poly -> rgbc = v -> rgbc ;
743+ poly -> rgbc = v -> rgbc | POLY_CMD_SEMITRNS ;
744744
745745 poly -> x0 = v [1 ].xx ; poly -> y0 = v [1 ].yy ;
746746 poly -> x1 = v [0 ].xx ; poly -> y1 = v [0 ].yy ;
@@ -762,6 +762,7 @@ static void DrawTexturedQuads2D(int verticesCount, int startVertex) {
762762 struct PS1VertexTextured * v = (struct PS1VertexTextured * )gfx_vertices + startVertex ;
763763 int uOffset = curTex -> xOffset , vOffset = curTex -> yOffset ;
764764 int uShift = curTex -> u_shift , vShift = curTex -> v_shift ;
765+ int tpage = curTex -> tpage , clut = curTex -> clut ;
765766
766767 struct PSX_POLY_FT4 * poly = next_packet ;
767768 cc_uint8 * max = next_packet_end - sizeof (* poly );
@@ -772,8 +773,8 @@ static void DrawTexturedQuads2D(int verticesCount, int startVertex) {
772773
773774 setlen (poly , POLY_LEN_FT4 );
774775 poly -> rgbc = v -> rgbc ;
775- poly -> tpage = curTex -> tpage ;
776- poly -> clut = 0 ;
776+ poly -> tpage = tpage ;
777+ poly -> clut = clut ;
777778
778779 poly -> x0 = v [1 ].xx ; poly -> y0 = v [1 ].yy ;
779780 poly -> x1 = v [0 ].xx ; poly -> y1 = v [0 ].yy ;
@@ -848,7 +849,7 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
848849 int uShift = curTex -> u_shift ;
849850 int vShift = curTex -> v_shift ;
850851
851- int page = curTex -> tpage ;
852+ int tpage = curTex -> tpage , clut = curTex -> clut ;
852853 uint32_t * ot = cur_buffer -> ot ;
853854
854855 struct PSX_POLY_FT4 * poly = next_packet ;
@@ -895,8 +896,8 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
895896 poly -> u3 = (v3 -> u >> uShift ) + uOffset ;
896897 poly -> v3 = (v3 -> v >> vShift ) + vOffset ;
897898
898- poly -> tpage = page ;
899- poly -> clut = 0 ;
899+ poly -> tpage = tpage ;
900+ poly -> clut = clut ;
900901 addPrim (& ot [p >> 2 ], poly );
901902 poly ++ ;
902903 }
0 commit comments