diff --git a/game.h b/game.h index e52ff80..1696b0b 100644 --- a/game.h +++ b/game.h @@ -201,6 +201,30 @@ static inline void LCR_drawPixelXYSafe(unsigned int x, unsigned int y, #include "assets.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 { uint8_t state; diff --git a/general.h b/general.h index e1173e1..da25b71 100644 --- a/general.h +++ b/general.h @@ -18,16 +18,6 @@ #define LCR_EFFECTIVE_RESOLUTION_Y \ (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 /** Physics FPS, i.e. the number of physics ticks per second. */ @@ -36,21 +26,6 @@ #define LCR_RACING_TICK_MS \ (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) { return i < 10 ? '0' + i : ('a' - 10 + i); diff --git a/map.h b/map.h index 7e558e0..148fde1 100644 --- a/map.h +++ b/map.h @@ -60,6 +60,9 @@ terminating zero. */ #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_ROT_90 0x20 #define LCR_BLOCK_TRANSFORM_ROT_180 0x40 diff --git a/renderer.h b/renderer.h index 2a1f0d0..eb7574c 100644 --- a/renderer.h +++ b/renderer.h @@ -21,6 +21,8 @@ #define S3L_PERSPECTIVE_CORRECTION 2 #define S3L_NEAR_CROSS_STRATEGY 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 #define S3L_PERSPECTIVE_CORRECTION 0 @@ -1129,6 +1131,9 @@ void LCR_rendererGetCameraTransform(LCR_GameUnit position[3], / S3L_F; } +/** + Moves and rotates camera by given offset in game units. +*/ void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3], LCR_GameUnit yawPitchOffset[2]) { @@ -1137,19 +1142,19 @@ void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3], S3L_Vec4 f, r, u; 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 += - ((f.x * forwRightUpOffset[0] + r.x * forwRightUpOffset[1] + - u.x * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; + (f.x * forwRightUpOffset[0] + r.x * forwRightUpOffset[1] + + u.x * forwRightUpOffset[2]) / LCR_GAME_UNIT; LCR_renderer.scene.camera.transform.translation.y += - ((f.y * forwRightUpOffset[0] + r.y * forwRightUpOffset[1] + - u.y * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; + (f.y * forwRightUpOffset[0] + r.y * forwRightUpOffset[1] + + u.y * forwRightUpOffset[2]) / LCR_GAME_UNIT; LCR_renderer.scene.camera.transform.translation.z += - ((f.z * forwRightUpOffset[0] + r.z * forwRightUpOffset[1] + - u.z * forwRightUpOffset[2]) * S3L_F) / LCR_GAME_UNIT; + (f.z * forwRightUpOffset[0] + r.z * forwRightUpOffset[1] + + u.z * forwRightUpOffset[2]) / LCR_GAME_UNIT; LCR_renderer.scene.camera.transform.rotation.y += (yawPitchOffset[0] * S3L_F) / LCR_GAME_UNIT; diff --git a/settings.h b/settings.h index 4634619..56c6d57 100644 --- a/settings.h +++ b/settings.h @@ -15,10 +15,8 @@ #endif #ifndef LCR_SETTING_FPS - /** - Rendering frames per second. Note this only applies to graphics, NOT - physics. - */ + /** Rendering frames per second. Note this only applies to graphics, NOT + physics. */ #define LCR_SETTING_FPS 30 #endif @@ -27,11 +25,13 @@ #endif #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 #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 #ifndef LCR_SETTING_SKY_ROLL_MULTIPLIER_V