Add time multiplier

This commit is contained in:
Miloslav Ciz 2025-01-15 23:24:07 +01:00
parent 8040d6755f
commit ff75390a2a
5 changed files with 19 additions and 22 deletions

View file

@ -1,7 +1,6 @@
=========== GENERAL ==============
- replay validation
- add time slow down setting
- add argc/argv to gameInit? could be used to quickly start maps, verify
replays etc.
- maybe each map could have a target time embedded: when beaten, the map would
@ -26,6 +25,7 @@
=========== HANDLED ==============
- allow stopping car rotation in air like in Trackmania
- add time slow down setting
- the horizon on background seems too low? maybe add setting to shift it a bit?
- replay format
- prevent time overflow! stop incrementing level frame once it's at maximum

4
game.h
View file

@ -286,8 +286,8 @@ void LCR_gameSetState(uint8_t state)
LCR_GameUnit LCR_carSpeedKMH(void)
{
return // we use 28/8 as an approximation of 3.6 to convers MPS to KMH
(28 * LCR_SETTING_METERS_PER_BLOCK * LCR_racingGetCarSpeedUnsigned() *
LCR_RACING_FPS) / (8 * LCR_GAME_UNIT);
(28 * LCR_SETTING_CMS_PER_BLOCK * LCR_racingGetCarSpeedUnsigned() *
LCR_RACING_FPS) / (800 * LCR_GAME_UNIT);
}
void LCR_gameResetRun(uint8_t replay)

View file

@ -8,6 +8,8 @@
#include <stdint.h>
#include "settings.h"
// TODO: maybe move module specific constants to the modules themselves?
// constants (not supposed to be changed, doing so may break stuff):
#define LCR_EFFECTIVE_RESOLUTION_X \
@ -31,7 +33,8 @@
/** Physics FPS, i.e. the number of physics ticks per second. */
#define LCR_RACING_FPS 30
#define LCR_RACING_TICK_MS (1000 / LCR_RACING_FPS)
#define LCR_RACING_TICK_MS \
(100000 / (LCR_RACING_FPS * LCR_SETTING_TIME_MULTIPLIER))
#define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0)

View file

@ -1313,7 +1313,7 @@ void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
anchorPoint[1] =
(LCR_EFFECTIVE_RESOLUTION_Y) / 2 - // 3: we place the center a bit more up
(LCR_SETTING_HORIZON_SHIFT * LCR_EFFECTIVE_RESOLUTION_Y) / 16 -
(LCR_SETTING_HORIZON_SHIFT * LCR_EFFECTIVE_RESOLUTION_Y) / 100 -
(LCR_EFFECTIVE_RESOLUTION_Y * offsetV) / S3L_F
- LCR_IMAGE_SIZE * LCR_SETTING_SKY_SIZE;

View file

@ -88,17 +88,6 @@
#define LCR_SETTING_LOD_COLOR 0x4229
#endif
#ifndef LCR_SETTING_FLOOR_PARTICLE_RESOLUTION
/** How many level floor particles there will be along one principal axis, 0
turns floor particles off. */
#define LCR_SETTING_FLOOR_PARTICLE_RESOLUTION 6
#endif
#ifndef LCR_SETTING_FLOOR_PARTICLE_SIZE
/** Defines floor particle size in fractions of screen size. */
#define LCR_SETTING_FLOOR_PARTICLE_SIZE 32
#endif
#ifndef LCR_SETTING_CAR_ANIMATION_SUBDIVIDE
/** How many frames will be used to complete whole animation of the car model.
0 turns off car animation completely (may be faster and smaller), 1 turns on
@ -160,10 +149,10 @@
#define LCR_SETTING_LOG_LEVEL 1
#endif
#ifndef LCR_SETTING_METERS_PER_BLOCK
/** How many meters one game block is considered to measure (horizontally).
This is for calculating speed etc. */
#define LCR_SETTING_METERS_PER_BLOCK 4
#ifndef LCR_SETTING_CMS_PER_BLOCK
/** How many centimeters one game block is considered to measure
(horizontally). This is for calculating speed etc. */
#define LCR_SETTING_CMS_PER_BLOCK 400
#endif
#ifndef LCR_SETTING_DEBUG_PHYSICS_DRAW
@ -205,8 +194,13 @@
#endif
#ifndef LCR_SETTING_HORIZON_SHIFT
/** Vertical offset of the background horizon, 1/16th of screen height. */
#define LCR_SETTING_HORIZON_SHIFT 5
/** Vertical offset of the background horizon in percents of screen height. */
#define LCR_SETTING_HORIZON_SHIFT 30
#endif
#ifndef LCR_SETTING_TIME_MULTIPLIER
/** Multiplies speed of time by this percentage, doesn't affect physics. */
#define LCR_SETTING_TIME_MULTIPLIER 100
#endif
#endif // guard