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

@ -15,7 +15,7 @@ fuck issue trackers :D
- make some kinda repo for world record runs? how will they submit it? - make some kinda repo for world record runs? how will they submit it?
- final tests: - final tests:
- very long replay - very long replay
- different resolutions - different resolutions KINDA DID 1x
- different settings (332, POTATO, ...) - different settings (332, POTATO, ...)
- crazy shit with physics - crazy shit with physics
- replay with input not occuring for more that LCR_SETTING_GHOST_STEP - replay with input not occuring for more that LCR_SETTING_GHOST_STEP
@ -39,6 +39,8 @@ fuck issue trackers :D
=========== HANDLED ============== =========== HANDLED ==============
- should drifting make a sound? NO NEED - should drifting make a sound? NO NEED
- particles in free camera mode are very big if far away from the car (maybe
just turn them off in this mode?)
- make helper header for PC frontends that use stdio for data file, parse - make helper header for PC frontends that use stdio for data file, parse
arguments etc. arguments etc.
- make car turned on its back behave nicer? but how? PROLLY NOT - make car turned on its back behave nicer? but how? PROLLY NOT

13
game.h
View file

@ -496,8 +496,13 @@ void LCR_gameResetRun(uint8_t replay, uint8_t ghost)
LCR_rendererUnmarkCPs(); LCR_rendererUnmarkCPs();
LCR_racingGetCarTransform(carTransform,carTransform + 3,0); LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
LCR_rendererSetCarTransform(carTransform,carTransform + 3); LCR_rendererSetCarTransform(carTransform,carTransform + 3);
LCR_rendererCameraReset();
LCR_rendererLoadMapChunks(); if (LCR_game.cameraMode != LCR_CAMERA_MODE_FREE)
{
LCR_rendererCameraReset();
LCR_rendererLoadMapChunks();
}
LCR_game.ghost.active = ghost; LCR_game.ghost.active = ghost;
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING); LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
LCR_game.runTime = 0; LCR_game.runTime = 0;
@ -1318,8 +1323,8 @@ void LCR_gameDraw3DView(void)
LCR_rendererDrawText(str,LCR_GUI_GAP,LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererDrawText(str,LCR_GUI_GAP,LCR_EFFECTIVE_RESOLUTION_Y -
2 * (LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE); 2 * (LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE);
else else
LCR_rendererDrawText(str,((LCR_EFFECTIVE_RESOLUTION_X - LCR_rendererDrawText(str,(LCR_EFFECTIVE_RESOLUTION_X -
LCR_rendererComputeTextWidth(str,4)) / 2), LCR_rendererComputeTextWidth(str,2 * _FONT_SIZE)) / 2,
LCR_EFFECTIVE_RESOLUTION_Y / 2, LCR_EFFECTIVE_RESOLUTION_Y / 2,
LCR_game.runTime <= LCR_currentMap.targetTime ? LCR_game.runTime <= LCR_currentMap.targetTime ?
LCR_CONVERT_COLOR(0x0700) : LCR_CONVERT_COLOR(0x4208),2 * _FONT_SIZE); LCR_CONVERT_COLOR(0x0700) : LCR_CONVERT_COLOR(0x4208),2 * _FONT_SIZE);

View file

@ -34,7 +34,7 @@
#define S3L_Z_BUFFER 1 #define S3L_Z_BUFFER 1
#define LCR_FONT_PIXEL_SIZE (1 + LCR_EFFECTIVE_RESOLUTION_X / 512) #define LCR_FONT_PIXEL_SIZE (1 + LCR_EFFECTIVE_RESOLUTION_X / 512)
#define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0) #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 #if LCR_SETTING_POTATO_GRAPHICS
#undef S3L_PERSPECTIVE_CORRECTION #undef S3L_PERSPECTIVE_CORRECTION
@ -68,7 +68,7 @@
#define LCR_RENDERER_CAR_SCALE (LCR_RENDERER_UNIT / 4) #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 /** 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 */ 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) unsigned char itemCount,char selectedItem, char scroll)
{ {
#if !LCR_ANT_RESOLUTION #if !LCR_ANT_RESOLUTION
int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7; int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 11;
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9; int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 12;
// int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7;
// int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9;
#else #else
int stripHeight = 6; int stripHeight = 6;
int stripHeight2 = 0; 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) for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
{ {
LCR_gameDrawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit && LCR_gameDrawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit &&
(x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 + limit) (x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 +
? LCR_CONVERT_COLOR(0x73ae) : LCR_CONVERT_COLOR(0x31a6)) + limit) ? LCR_CONVERT_COLOR(0x73ae) : LCR_CONVERT_COLOR(0x31a6)) +
((x + y) % 8)); ((x + y) % 8));
i++; i++;
} }
@ -2022,7 +2024,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
++i; ++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) 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 + for (int y = i - 3 * LCR_FONT_PIXEL_SIZE; y < i +
LCR_rendererComputeTextHeight(_FONT_SIZE) + 3 * LCR_FONT_PIXEL_SIZE; LCR_rendererComputeTextHeight(_FONT_SIZE) + 3 * LCR_FONT_PIXEL_SIZE;
++y) ++y)
for (int x = LCR_EFFECTIVE_RESOLUTION_X / 4; #if LCR_EFFECTIVE_RESOLUTION_X > 500
x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4; ++x) 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_gameDrawPixelXYSafe(x,y,0x5c1b + 4 * ((x & 0x10) == (y & 0x10)));
LCR_rendererDrawText(s,(LCR_EFFECTIVE_RESOLUTION_X - LCR_rendererDrawText(s,(LCR_EFFECTIVE_RESOLUTION_X -
@ -2163,9 +2168,15 @@ void LCR_rendererDraw3D(void)
{ {
carGhostVisibility |= 1; carGhostVisibility |= 1;
m->config.visible = (S3L_distanceManhattan(m->transform.translation, unsigned char camDist = S3L_distanceManhattan(m->transform.translation,
LCR_renderer.scene.camera.transform.translation) / LCR_RENDERER_UNIT) LCR_renderer.scene.camera.transform.translation) / LCR_RENDERER_UNIT;
<= LCR_SETTING_CAR_RENDER_DISTANCE;
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; m = LCR_renderer.ghostModel;