Address some settings

This commit is contained in:
Miloslav Ciz 2025-01-16 15:00:13 +01:00
parent ff75390a2a
commit 71aa8156e9
5 changed files with 45 additions and 38 deletions

24
game.h
View file

@ -201,6 +201,30 @@ static inline void LCR_drawPixelXYSafe(unsigned int x, unsigned int y,
#include "assets.h" #include "assets.h"
#include "renderer.h" #include "renderer.h"
#define LCR_MENU_MAX_ITEMS 9 // don't change
#define LCR_RESOURCE_ITEM_CHUNK (LCR_MENU_MAX_ITEMS - 1)
#define LCR_MENU_TABS 4
#define LCR_MENU_STRING_SIZE 16
#define LCR_RESOURCE_FILE_SEPARATOR '#'
#define LCR_RESOURCE_FILE_SEPARATOR2 ';'
#define LCR_FREE_CAMERA_STEP \
((LCR_SETTING_FREE_CAMERA_SPEED * LCR_GAME_UNIT / 8) \
/ LCR_SETTING_FPS)
#if LCR_FREE_CAMERA_STEP == 0
#define LCR_FREE_CAMERA_STEP 1
#endif
#define LCR_FREE_CAMERA_TURN_STEP \
((LCR_SETTING_FREE_CAMERA_TURN_SPEED * LCR_GAME_UNIT) \
/ (360 * LCR_SETTING_FPS))
#if LCR_FREE_CAMERA_TURN_STEP == 0
#define LCR_FREE_CAMERA_TURN_STEP 1
#endif
struct struct
{ {
uint8_t state; uint8_t state;

View file

@ -18,16 +18,6 @@
#define LCR_EFFECTIVE_RESOLUTION_Y \ #define LCR_EFFECTIVE_RESOLUTION_Y \
(LCR_SETTING_RESOLUTION_Y / LCR_SETTING_RESOLUTION_SUBDIVIDE) (LCR_SETTING_RESOLUTION_Y / LCR_SETTING_RESOLUTION_SUBDIVIDE)
#define LCR_FREE_CAMERA_STEP \
(LCR_SETTING_FREE_CAMERA_SPEED / LCR_SETTING_FPS)
#if LCR_FREE_CAMERA_STEP == 0
#define LCR_FREE_CAMERA_STEP 1
#endif
#define LCR_FREE_CAMERA_TURN_STEP \
(LCR_SETTING_FREE_CAMERA_TURN_SPEED / LCR_SETTING_FPS)
#define LCR_MAP_SIZE_BLOCKS 64 #define LCR_MAP_SIZE_BLOCKS 64
/** Physics FPS, i.e. the number of physics ticks per second. */ /** Physics FPS, i.e. the number of physics ticks per second. */
@ -36,21 +26,6 @@
#define LCR_RACING_TICK_MS \ #define LCR_RACING_TICK_MS \
(100000 / (LCR_RACING_FPS * LCR_SETTING_TIME_MULTIPLIER)) (100000 / (LCR_RACING_FPS * LCR_SETTING_TIME_MULTIPLIER))
#define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0)
/** Maximum number of triangles of a block shape. */
#define LCR_MAP_BLOCK_SHAPE_MAX_BYTES 80
#define LCR_FONT_PIXEL_SIZE (1 + LCR_EFFECTIVE_RESOLUTION_X / 512)
#define LCR_RESOURCE_FILE_SEPARATOR '#'
#define LCR_RESOURCE_FILE_SEPARATOR2 ';'
#define LCR_MENU_MAX_ITEMS 9 // don't change
#define LCR_RESOURCE_ITEM_CHUNK (LCR_MENU_MAX_ITEMS - 1)
#define LCR_MENU_TABS 4
#define LCR_MENU_STRING_SIZE 16
char _LCR_hexDigit(int i) char _LCR_hexDigit(int i)
{ {
return i < 10 ? '0' + i : ('a' - 10 + i); return i < 10 ? '0' + i : ('a' - 10 + i);

3
map.h
View file

@ -60,6 +60,9 @@
terminating zero. */ terminating zero. */
#define LCR_BLOCK_START_CHAR ':' #define LCR_BLOCK_START_CHAR ':'
/** Maximum number of triangles of a block shape. */
#define LCR_MAP_BLOCK_SHAPE_MAX_BYTES 80
#define LCR_BLOCK_TRANSFORM_FLIP_H 0x10 #define LCR_BLOCK_TRANSFORM_FLIP_H 0x10
#define LCR_BLOCK_TRANSFORM_ROT_90 0x20 #define LCR_BLOCK_TRANSFORM_ROT_90 0x20
#define LCR_BLOCK_TRANSFORM_ROT_180 0x40 #define LCR_BLOCK_TRANSFORM_ROT_180 0x40

View file

@ -21,6 +21,8 @@
#define S3L_PERSPECTIVE_CORRECTION 2 #define S3L_PERSPECTIVE_CORRECTION 2
#define S3L_NEAR_CROSS_STRATEGY 1 #define S3L_NEAR_CROSS_STRATEGY 1
#define S3L_Z_BUFFER 1 #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)
#if LCR_SETTING_POTATO_GRAPHICS #if LCR_SETTING_POTATO_GRAPHICS
#define S3L_PERSPECTIVE_CORRECTION 0 #define S3L_PERSPECTIVE_CORRECTION 0
@ -1129,6 +1131,9 @@ void LCR_rendererGetCameraTransform(LCR_GameUnit position[3],
/ S3L_F; / S3L_F;
} }
/**
Moves and rotates camera by given offset in game units.
*/
void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3], void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3],
LCR_GameUnit yawPitchOffset[2]) LCR_GameUnit yawPitchOffset[2])
{ {
@ -1137,19 +1142,19 @@ void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3],
S3L_Vec4 f, r, u; S3L_Vec4 f, r, u;
S3L_rotationToDirections(LCR_renderer.scene.camera.transform.rotation, S3L_rotationToDirections(LCR_renderer.scene.camera.transform.rotation,
S3L_F,&f,&r,&u); LCR_RENDERER_UNIT,&f,&r,&u);
LCR_renderer.scene.camera.transform.translation.x += LCR_renderer.scene.camera.transform.translation.x +=
((f.x * forwRightUpOffset[0] + r.x * forwRightUpOffset[1] + (f.x * forwRightUpOffset[0] + r.x * forwRightUpOffset[1] +
u.x * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; u.x * forwRightUpOffset[2]) / LCR_GAME_UNIT;
LCR_renderer.scene.camera.transform.translation.y += LCR_renderer.scene.camera.transform.translation.y +=
((f.y * forwRightUpOffset[0] + r.y * forwRightUpOffset[1] + (f.y * forwRightUpOffset[0] + r.y * forwRightUpOffset[1] +
u.y * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; u.y * forwRightUpOffset[2]) / LCR_GAME_UNIT;
LCR_renderer.scene.camera.transform.translation.z += LCR_renderer.scene.camera.transform.translation.z +=
((f.z * forwRightUpOffset[0] + r.z * forwRightUpOffset[1] + (f.z * forwRightUpOffset[0] + r.z * forwRightUpOffset[1] +
u.z * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; u.z * forwRightUpOffset[2]) / LCR_GAME_UNIT;
LCR_renderer.scene.camera.transform.rotation.y += LCR_renderer.scene.camera.transform.rotation.y +=
(yawPitchOffset[0] * S3L_F) / LCR_GAME_UNIT; (yawPitchOffset[0] * S3L_F) / LCR_GAME_UNIT;

View file

@ -15,10 +15,8 @@
#endif #endif
#ifndef LCR_SETTING_FPS #ifndef LCR_SETTING_FPS
/** /** Rendering frames per second. Note this only applies to graphics, NOT
Rendering frames per second. Note this only applies to graphics, NOT physics. */
physics.
*/
#define LCR_SETTING_FPS 30 #define LCR_SETTING_FPS 30
#endif #endif
@ -27,11 +25,13 @@
#endif #endif
#ifndef LCR_SETTING_FREE_CAMERA_SPEED #ifndef LCR_SETTING_FREE_CAMERA_SPEED
#define LCR_SETTING_FREE_CAMERA_SPEED 30 /** Move speed of free camera, in 1/8ths of block length. */
#define LCR_SETTING_FREE_CAMERA_SPEED 50
#endif #endif
#ifndef LCR_SETTING_FREE_CAMERA_TURN_SPEED #ifndef LCR_SETTING_FREE_CAMERA_TURN_SPEED
#define LCR_SETTING_FREE_CAMERA_TURN_SPEED 1024 /** Turn speed of free camera, in degrees per second. */
#define LCR_SETTING_FREE_CAMERA_TURN_SPEED 180
#endif #endif
#ifndef LCR_SETTING_SKY_ROLL_MULTIPLIER_V #ifndef LCR_SETTING_SKY_ROLL_MULTIPLIER_V