Handle different resolutions

This commit is contained in:
Miloslav Ciz 2025-06-01 20:47:19 +02:00
parent 716a3dda38
commit 0f0e4f4889
3 changed files with 35 additions and 17 deletions

View file

@ -34,7 +34,7 @@
#define S3L_Z_BUFFER 1
#define LCR_FONT_PIXEL_SIZE (1 + LCR_EFFECTIVE_RESOLUTION_X / 512)
#define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0)
#define LCR_ANT_RESOLUTION (LCR_EFFECTIVE_RESOLUTION_Y <= 96)
#define LCR_ANT_RESOLUTION (LCR_EFFECTIVE_RESOLUTION_Y <= 110)
#if LCR_SETTING_POTATO_GRAPHICS
#undef S3L_PERSPECTIVE_CORRECTION
@ -68,7 +68,7 @@
#define LCR_RENDERER_CAR_SCALE (LCR_RENDERER_UNIT / 4)
#define LCR_RENDERER_FONT_SEGMENT_SIZE (2 + LCR_EFFECTIVE_RESOLUTION_X / 512)
#define LCR_RENDERER_FONT_SEGMENT_SIZE (2 + LCR_EFFECTIVE_RESOLUTION_Y / 320)
/** For some reason the map model is a bit misaligned with physics world, this
kinda hotfixes it -- later try to discover source of this bug. TODO */
@ -1959,8 +1959,10 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
unsigned char itemCount,char selectedItem, char scroll)
{
#if !LCR_ANT_RESOLUTION
int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7;
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9;
int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 11;
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 12;
// int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7;
// int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9;
#else
int stripHeight = 6;
int stripHeight2 = 0;
@ -2002,8 +2004,8 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
{
LCR_gameDrawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit &&
(x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 + limit)
? LCR_CONVERT_COLOR(0x73ae) : LCR_CONVERT_COLOR(0x31a6)) +
(x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 +
limit) ? LCR_CONVERT_COLOR(0x73ae) : LCR_CONVERT_COLOR(0x31a6)) +
((x + y) % 8));
i++;
}
@ -2022,7 +2024,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
++i;
}
i = stripHeight + (stripHeight2 - LCR_rendererComputeTextHeight(3)) / 2;
i = stripHeight + (stripHeight2 - LCR_rendererComputeTextHeight(3)) / 2 + 2;
for (int j = 0; j < itemCount + 1 + (scroll != 0); ++j)
{
@ -2045,8 +2047,11 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
for (int y = i - 3 * LCR_FONT_PIXEL_SIZE; y < i +
LCR_rendererComputeTextHeight(_FONT_SIZE) + 3 * LCR_FONT_PIXEL_SIZE;
++y)
for (int x = LCR_EFFECTIVE_RESOLUTION_X / 4;
x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4; ++x)
#if LCR_EFFECTIVE_RESOLUTION_X > 500
for (int x = 20; x < LCR_EFFECTIVE_RESOLUTION_X - 20; ++x)
#else
for (int x = 2; x < LCR_EFFECTIVE_RESOLUTION_X - 2; ++x)
#endif
LCR_gameDrawPixelXYSafe(x,y,0x5c1b + 4 * ((x & 0x10) == (y & 0x10)));
LCR_rendererDrawText(s,(LCR_EFFECTIVE_RESOLUTION_X -
@ -2163,9 +2168,15 @@ void LCR_rendererDraw3D(void)
{
carGhostVisibility |= 1;
m->config.visible = (S3L_distanceManhattan(m->transform.translation,
LCR_renderer.scene.camera.transform.translation) / LCR_RENDERER_UNIT)
<= LCR_SETTING_CAR_RENDER_DISTANCE;
unsigned char camDist = S3L_distanceManhattan(m->transform.translation,
LCR_renderer.scene.camera.transform.translation) / LCR_RENDERER_UNIT;
m->config.visible = camDist <= LCR_SETTING_CAR_RENDER_DISTANCE;
#if LCR_SETTING_PARTICLES
if (camDist > 5)
LCR_renderer.particleColor = 0x0000;
#endif
}
m = LCR_renderer.ghostModel;