Continue checkpoint rendering

This commit is contained in:
Miloslav Ciz 2024-10-07 22:07:58 +02:00
parent 2c5162b635
commit ac5bddd9f4
5 changed files with 33 additions and 33 deletions

View file

@ -35,7 +35,7 @@
=========== BUGS =================
- drawing dithered transparent objects fills z-buffer in the transparent parts
and then the geometry behind it isn't drawn
and then the geometry behind it isn't drawn <- PARTIALLY FIXED NOW
=========== HANDLED ==============

View file

@ -61,6 +61,7 @@ LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_PLAT,4,5,6,LCR_BLOCK_MATERIAL_CONCRETE,LCR_B
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_PLAT,3,5,6,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_FLIP_V | LCR_BLOCK_TRANSFORM_ROT_180),
LCR_MAP_BLOCK(LCR_BLOCK_CHECKPOINT_0,3,2,4,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FINISH,3,2,2,LCR_BLOCK_MATERIAL_CONCRETE,0),
/*
LCR_MAP_BLOCK(LCR_BLOCK_FULL,2,1,9,LCR_BLOCK_MATERIAL_CONCRETE,0),

13
map.h
View file

@ -516,20 +516,19 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
switch (blockType)
{
case LCR_BLOCK_CHECKPOINT_0:
case LCR_BLOCK_CHECKPOINT_1:
case LCR_BLOCK_CHECKPOINT_0:
case LCR_BLOCK_CHECKPOINT_1:
case LCR_BLOCK_FINISH:
ADD(3,0,3) ADD(0,2,6) ADD(6,2,6)
ADD(3,0,3) ADD(0,2,0) ADD(0,2,6)
ADD(3,0,3) ADD(6,2,0) ADD(0,2,0)
ADD(3,0,3) ADD(6,2,6) ADD(6,2,0)
ADD(3,0,3) ADD(0,2,0) ADD(0,2,6)
ADD(3,0,3) ADD(0,2,6) ADD(6,2,6)
ADD(3,4,3) ADD(0,2,6) ADD(0,2,0)
ADD(3,4,3) ADD(0,2,0) ADD(6,2,0)
ADD(3,4,3) ADD(6,2,0) ADD(6,2,6)
ADD(3,4,3) ADD(0,2,6) ADD(0,2,0)
ADD(3,4,3) ADD(6,2,6) ADD(0,2,6)
break;
case LCR_BLOCK_FULL:
case LCR_BLOCK_BOTTOM:
case LCR_BLOCK_LEFT:

View file

@ -35,17 +35,10 @@
kinda hotfixes it -- later try to discover source of this bug. TODO */
#define _LCR_MAP_MODEL_SCALE 1034
#define LCR_RENDERER_MAT_CP0 0x0f
#define LCR_RENDERER_MAT_CP0 0x0f ///< material for untaken checkpoint
#define LCR_RENDERER_MAT_CP1 0x0e
#define LCR_RENDERER_MAT_FIN 0x0d
struct
{
S3L_Scene scene;
@ -170,16 +163,18 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
switch (mat)
{
#define CL (type ? 0x8210 : 0x0000)
case LCR_RENDERER_MAT_CP0:
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT0_COLOR;
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT_0_COLOR | CL;
break;
case LCR_RENDERER_MAT_CP1:
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT1_COLOR;
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT_1_COLOR | CL;
break;
case LCR_RENDERER_MAT_FIN:
LCR_renderer.flatAndTransparent = LCR_SETTING_FINISH_COLOR;
LCR_renderer.flatAndTransparent = LCR_SETTING_FINISH_COLOR | CL;
#undef CL
break;
default:
@ -234,7 +229,6 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
}
break;
}
}
}
@ -242,6 +236,12 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
{
if (pixel->x % 2 == pixel->y % 2)
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
else
S3L_zBufferWrite(pixel->x,pixel->y,S3L_MAX_DEPTH);
/* ^ Clear z-buffer if we don't draw the pixel. Without this further
geometry drawn later on won't be seen through transparent objects which
looks bad. With this "fix" glitches may still appear (wrong draw order)
but it generally looks better this way. */
return;
}
@ -712,9 +712,9 @@ uint8_t _LCR_buildMapModel(void)
uint8_t triData;
if (blockType == LCR_BLOCK_CHECKPOINT_0)
triData = LCR_RENDERER_MAT_CP0;
triData = LCR_RENDERER_MAT_CP0 | ((i % 2) << 4);
else if (blockType == LCR_BLOCK_FINISH)
triData = LCR_RENDERER_MAT_FIN;
triData = LCR_RENDERER_MAT_FIN | ((i % 2) << 4);
else
{
uint8_t blockMat = LCR_mapBlockGetMaterial(block);

View file

@ -126,19 +126,19 @@
#define LCR_SETTING_GHOST_COLOR 0xff00
#endif
#ifndef LCR_SETTING_CHECKPOINT0_COLOR
#ifndef LCR_SETTING_CHECKPOINT_0_COLOR
/** Color of untaken checkpoint (in RGB565). */
#define LCR_SETTING_CHECKPOINT0_COLOR 0x0f00
#define LCR_SETTING_CHECKPOINT_0_COLOR 0x37e0
#endif
#ifndef LCR_SETTING_CHECKPOINT1_COLOR
#ifndef LCR_SETTING_CHECKPOINT_1_COLOR
/** Color of taken checkpoint (in RGB565). */
#define LCR_SETTING_CHECKPOINT1_COLOR 0xf000
#define LCR_SETTING_CHECKPOINT_1_COLOR 0xdefb
#endif
#ifndef LCR_SETTING_FINISH_COLOR
/** Color of finish block (in RGB565). */
#define LCR_SETTING_FINISH_COLOR 0x00f0
#define LCR_SETTING_FINISH_COLOR 0xf900
#endif
#ifndef LCR_SETTING_SMOOTH_ANIMATIONS