Fix a few bugs

This commit is contained in:
Miloslav Ciz 2025-06-23 20:38:56 +02:00
parent ab70d727b8
commit bc55e84d5b
6 changed files with 48 additions and 32 deletions

View file

@ -12,6 +12,8 @@ The following is a draft of readme that will eventually be published, it may con
For more detail see also the [game manual](media/manual.txt).
TODO: link to licar-content
## What Is This
This is a libre (free as in freedom) 3D racing game very much inspired by the proprietary game Trackmania (but different enough to be legally safe). It is written in a selfless way (it won't try to exploit you in any way, not even indirectly) following a philosophy of high minimalism, excluding any poison and bullshit of so called "modern technology" and self interest. It was made completely from scratch by a single man who is too different (for better or worse) from all other humans.

View file

@ -2,6 +2,7 @@ fuck issue trackers :D
=========== GENERAL ==============
- use other libs than glibc (musl, ...)
- final tests:
- run the test frontend through all the shit (valgrind, different compilers
etc.) KINDA DID
@ -30,8 +31,7 @@ fuck issue trackers :D
=========== BUGS =================
- TCC: physics on some maps (tiny2, tiny3, ...) behaves wrong, some replays
don't work
- another TCC bug: tiny map 4 replay fails
- camera follow speed depends on FPS, it's slower with low FPS, but this is no
big deal, it's only noticable with extremely high/low FPS -- fix or not?
- replay loading BUG! somehow map2 replay was saves with hash 05ef0ab1 instead
@ -103,6 +103,8 @@ fuck issue trackers :D
theory they should (enough block space to load): try to set the exact same
settings on PC and see if the maps load or what. IT'S BCS BUILDING THE MAP
TEMPORARILY REQUIRES MORE BLOCKS
- TCC: physics on some maps (tiny2, tiny3, ...) behaves wrong, some replays
don't work
- camera bugs in TCC build, also the auto test fails on checking rendered
pixels -- this may be TCC not supporting C99 fully? but dig up what's going
on

9
game.h
View file

@ -1274,9 +1274,10 @@ void LCR_gameDraw3DView(void)
1
#endif
? LCR_GAME_UNIT -
((LCR_game.nextRacingTickTime - LCR_game.time) * LCR_GAME_UNIT)
(((int) (LCR_game.nextRacingTickTime - LCR_game.time)) * LCR_GAME_UNIT)
/ LCR_RACING_TICK_MS_RT // 32: magic constant
: _LCR_min(LCR_GAME_UNIT,32 * (LCR_game.time - LCR_game.stateStartTime));
: _LCR_min(LCR_GAME_UNIT,32 * ((int) (LCR_game.time -
LCR_game.stateStartTime)));
LCR_racingGetCarTransform(carTransform,carTransform + 3,
physicsInterpolationParam);
@ -1672,11 +1673,15 @@ void LCR_gameHandleInput(void)
{
LCR_LOG1("couldn't load replay");
LCR_gamePopupMessage(LCR_texts[LCR_TEXTS_FAIL]);
LCR_currentMap.blockCount = 0;
LCR_gameSetState(LCR_GAME_STATE_MENU);
}
else if (mapIndex == -1)
{
LCR_LOG1("couldn't load replay map");
LCR_gamePopupMessage(LCR_texts[LCR_TEXTS_FAIL]);
LCR_currentMap.blockCount = 0;
LCR_gameSetState(LCR_GAME_STATE_MENU);
}
else
LCR_gameSetState(LCR_GAME_STATE_LOADING);

View file

@ -22,8 +22,7 @@ if [ $# -gt 0 ]; then
COMPILER="$2"
if [ $COMPILER = "tcc" ]; then # you'll probably want to modify this
C_FLAGS="${C_FLAGS} -L/usr/lib/x86_64-linux-gnu/pulseaudio/
-I/usr/lib/x86_64-linux-gnu/tcc/include -DSDL_DISABLE_IMMINTRIN_H"
C_FLAGS="${C_FLAGS} -L/usr/lib/x86_64-linux-gnu/pulseaudio/ -DSDL_DISABLE_IMMINTRIN_H"
fi
fi
fi

View file

@ -103,12 +103,11 @@ Here are some tips for playing:
speed.
- For a more serious grinding it may be good to reduce the initial countdown
(in settings.h), it will save a lot of time over many runs.
- Don't try to drive a perfect run from the start -- to drive a good time you
- Don't try to drive a perfect time right away -- to drive a good time you
first have to drive a bad one. It's best to quickly drive a somewhat decent
run and then race against it as a ghost, beating it and repeating then
repeating this process over and over. This allows for gradual but steady
improvement by spotting exact places where one can gain more speed against
the ghost.
run and then race against its ghost, beating it and then repeating the process
over and over. This allows for a gradual but steady, steap-by-step improvement
by discovering exact places where one can improve against the ghost.
~~~~~ DATA FILE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -123,19 +122,20 @@ with any plain text editor. If you just want to casually play the game, you may
safely ignore the file. You will need to edit the file if you want to add new
maps and replays, or if you want to share your replays and maps with others.
The file consists of data items -- an item represents a map, replay, and
possibly other types of data. The items are separated by the '#' (hash)
character. Each item is stored in plaintext format, there are no binary data.
Each item starts with a magic number, which is a single character ('M' for a
map, 'R' for a replay), then its name follows immediately, terminated by the
';' (semicolon) character, and then the item's data follow. Format of this data
depends on what data it is, so map data of course have a different format than
replay data. For example a map named "mymap" will start with "Mmymap;".
The file consists of data items -- an item represents a map, replay and possibly
other types of data. The items are separated by the '#' (hash) character. Each
item is stored in plaintext ASCII format, there are no binary data. Each item
starts with a magic number, which is a single character ('M' for a map, 'R' for
a replay), then its name follows immediately, terminated by the ';' (semicolon)
character, and then the item's data follow. Format of this data depends on what
kind of data it is, so map data of course have a different format than replay
data. For example a map named "mymap" will start with "Mmymap;". Unknown data
items are ignored, so comments can be added in the file.
~~~~~ CONFIGURATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The game offers a very high level of configuration and customization, and those
with at least basic programming skill will be able to implement any changes
with at least basic programming skills will be able to implement any changes
imaginable. Very basic settings (such as turning the music off or switching
between windowed and fullscreen mode) are accessible either in the game menu,
or as a commandline flag (run the game with -h flag to see the options). All
@ -154,7 +154,7 @@ space). Replays can also be used to spawn a ghost car to race against. There
are special tabs in the menu to view a replay or race against a replay ghost.
Replays are saved in the data file (see the section about data file for
details).
details). The exact format of replay data is described in the source code.
Whenever a map's target time is beaten, replay is automatically saved. It's also
possible to save a replay manually by opening the menu and selecting
@ -165,7 +165,7 @@ replay you just delete it in the data file.
~~~~~ GHOSTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The game supports ghost cars to race against (note that this may be unsupported
on some weaker platforms). A ghost car is created from a replay and will race in
on some weaker platforms). A ghost car is spawned from a replay and will race in
real time against the player, without being able to collide with him. This is
very useful when attacking someone else's (or one's own) achieved time, to see
where exactly time losses against the opponent occur.
@ -173,17 +173,18 @@ where exactly time losses against the opponent occur.
~~~~~ MAKING CUSTOM MAPS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Maps are stored in the data file. For its simplicity the original game doesn't
come with a user-friendly map editor (perhaps some will be made over time), the
maps are hand-written directly in the text format that's stored in the data
file, however there is a helper file for Blender that facilitates this process.
come with a "user-friendly" GUI map editor (perhaps some will be made over
time), the maps are hand-written directly in the text format that's stored in
the data file, however there is a helper file for Blender that facilitates the
process of designing a map.
In the game a map is represented as a 64x64x64 grid, with each cell one unit in
width, one unit in depth and HALF a unit in height. In the cell blocks can be
placed. There are several types of blocks such as ramps, walls, corners etc. The
map will be made of these blocks.
In the game a map is represented as a 64x64x64 grid of cells, each of which is
one unit in width, one unit in depth and HALF a unit in height. Each cell can
hold a map block. There are several types of blocks such as ramps, walls,
corners etc. The whole map is composed of these blocks.
Each placed block can additionally be transformed: rotated by multiples of 90
degrees along vertical axis and/or flipped horizontally/vertically. Additionally
degrees about vertical axis and/or flipped horizontally/vertically. Additionally
each block also has a material (concrete, grass, ...). Special kinds of blocks
are accelerators and fans. The finish, checkpoints and car start position can
also be seen as a special kind of block. And still, there are yet "more special"
@ -193,7 +194,9 @@ times in a row) -- these only appear in the map's text format; they are not
necessary, but greatly help making maps faster and also keep their code smaller.
The text format of the map is described in the map.h file, refer to it for
details you won't find here. In summary:
details you won't find here. To start with map making it may be useful to check
out some of the existing small maps, for example the LCtiny ones. In summary the
map format is following:
First, if the map is preceded by another data string in the data file, remember
to start it with the `#` character (to separate it from the previous string).

View file

@ -3280,8 +3280,13 @@ TPE_Vec3 TPE_envCone(TPE_Vec3 point, TPE_Vec3 center, TPE_Vec3 direction,
TPE_Vec3 helper = TPE_vec3Project(point,direction);
TPE_Unit y = TPE_LENGTH(helper);
// Licar change: the following fixes a TCC bug
TPE_Unit tccFix = y;
helper = TPE_vec3Minus(point,helper);
y = tccFix; // for some reason the above line nukes y in TCC, so restore it
TPE_Unit x = TPE_LENGTH(helper);
if (x < 20)