This commit is contained in:
Miloslav Ciz 2025-02-04 23:25:53 +01:00
parent f1b80bf328
commit ac7ed62029
6 changed files with 123 additions and 104 deletions

View file

@ -1,6 +1,22 @@
=========== GENERAL ==============
- countdown and finish text sometimes seem to jump horizontally somehow
- some kind of special map block that would say where 3D triangles don't have
to be drawn? could optimize rendering and map loading a lot
- maps to make:
- there should be these maps:
- compiled in:
- standard maps, let's say 10?
- additionally a few (5?) extremely simple maps, compile time option to
only include these, for very weak devices with limited block/triangle
count
- bonus maps in the external file
- map types:
- traveling salesman kind of maze
- some kinda buggy bumpy downhill
- something with multiple roads
- RPG kinda map? could be in bonus maps
- some speed map
- some (at least partially) interior map
- try to speed up the slow culling
- make a small txt game menual
- test:
@ -27,6 +43,7 @@
=========== HANDLED ==============
- allow stopping car rotation in air like in Trackmania
- countdown and finish text sometimes seem to jump horizontally somehow
- add argc/argv to gameInit? could be used to quickly start maps, verify
replays etc. Options:
-sN: sound (0/1)

View file

@ -92,6 +92,102 @@ static const char *LCR_internalDataFile =
" map end "
"#Rrep1;testmap;482f70f9 00000188:00c1:0089:0111:00b9:0091:0109:0028:0050:00c1:0093:0030:00d1:0069:0041:0020:0071:0013:0012:0023:0022:0050:0032:0020:0022:0060:0024:00bc:0044"
// MAP 1:
"#MLicar1;4321 0 "
":*B3mL:!x6G:+L2H:+D38" // start, finish, CPs
// big structure:
":=z09:f83D"
":=H0k:fa1s"
":=H0D:fa29"
":-A29:f61C"
":'A2pI:f611"
":'B2j:f511"
":=C0j:f347"
":=H0q2:f42c"
":xB2k:f625" // start hole
":uB2o:uF2oJ :uB2kL :uF2kI" // curved corners in start
":]G2kL:]G2oL" // decorative ramps near start
":-w29:f41e"
":xH0r:f35b" // hole
":=G0C:f561" // small wall
":^G5CJ:^K5CL" // the wall corners
":=H0o1:f412" // grass near start
":=H1L1:fa11" // grass
":;R0q:f16l" // big wall west
":;E0ML:fc61" // big wall north
":)Q1rJ:f11c" // curved ramps along big wall
":)Q2DJ:f118" // curved ramps along big wall
":uQ2L|:f141:\\R0LI|:f161:\\Q0ML:f161" // corner between big walls
":=v09:fc2g"
":^z3s:^z3tI" // two small ramps near finish
":;R0l:f125" // small wall near start
":;L0jJ:f521" // small wall near start
":uQ1kI:\\R0k:f121:\\Q0jL|:f121" // corner between small walls
":=G0f1:f545:AK0f1:f141" // big grass block near start
":=A2a2:f12f:^A3a2" // wall
":=w0o:f331"
":=v072:f14i" // wall
":=G072:f14d" // wall
":'G1lL:f113:<H1lL:f113" // start ramps
":/M1z:f311" // ramps near start
":<G2DL:f118" // climb ramps
":=v4i:f613:nv4i|:nA4i" // roof near the end
":'w2n:f411:^x3o:f211" // final ramp
// last turn ramp:
":=v062:fc33"
":=v052:fc71"
":=v362:fc11"
":^v462I:^G462I"
":'w28I:fa11"
":^w37I:fa11"
":^w46I:fa11"
// bridge:
":'C2qI:f311"
":^C3pI:f311"
":<C4oI:f311"
":-C4l:f313"
":<C4k:f311"
":^C3j:f311"
":'C2i:f311"
":)C3o-:f311"
":)C3k-I:f311"
// finish ramp:
":-w5u:f31d"
":'w5G:f311"
// pillars:
":nv0v2|:f151:nw0v2:f151:nv0w2J|:f151:nw0w2L:f151"
":ny0v2|:f151:nz3v2:f121:ny0w2J|:f151:nz3w2L:f121"
":nv0G2|:f151:nw0G2:f151:nv0H2J|:f151:nw0H2L:f151"
":ny0G2|:f151:nz3G2:f121:ny0H2J|:f151:nz3H2L:f121"
/* tiny maps, max:
- 300 character string
- 512 blocks
- 1024 vertices
- 1500 triangles */
// TINY MAP 1:
"#MLCtiny1;4321 0 :*G1b:+n9H:!I1H"
// start
":=D0b:f71i"
":^D1bJ:f11i:^J1bL:f11i"
":^D0bJ-:f11i:^J0bL-:f11i"
":^E1s:f511"
":>E0k:f513"
// slope:
":^p3v:fk11"
":^o4w:fk11:^o3w-I:fk11"
":^n5x:fk11:^n4x-I:fk11"
":^m6y:fk11:^m5y-I:fk11"
":^l7z :fk11 :^l6z-I :fk11"
":^k8A :fk11 :^k7A-I :fk11"
":=k8B:f419:=o8F:f415:^k9K2I:f611:^k8K2I-:f611" // top
":=y0F1:fb15:^y0F1:fb11:^y0J1I:fb11" // end
;
#define LCR_IMAGE_SIZE 64 ///< one-dimension resolution of bitmap image

96
data
View file

@ -2,99 +2,3 @@
#Bnomap
#Rrep2;testmap;482f70f9 00000843:0173:0081:0029:0111:0039:0071:00a3:0061:0169:0051:00b3:0041:0073:0081:0033:0041:0033:0231:0030:0098:0029:0011:0163:00f1:0053:0081:0033:0051:0023:0031:00f0:0032:0023:0131:00b9:0081:0023:00a1:0119:00e1:00c9:0071:0039:00a1:00d3:0021:01f9:0091:0079:0091:0039:0051:0049:0021:0083:0031:0083:0031:0083:0061:0089:0121:00a0:0058:002c:0048:0061:0013:0150:0052:00c0:00a1:0053:0041:0043:0031:0020:0092:0063:0181:0010:00a2:0013:0071:00e0:0028:00e9:0078:00a9:0043:0032:0123:0042:0080:0038:004c:01a8:0050:0032:0033:0101
#Btestmap;
#Mmap2;4321 0
:*B3mL
:!x6G
:+L2H
:+D38
:=z09 :f83D
:'B2j :f511
:'B2pI :f511
:=H0k :fa1s
:=H0D :fa29
:-A29 :f61C
:=C0j :f347
:=H0q2 :f42c
:xB2k :f625
:-w29 :f41e
:xH0r :f35b
:=G0C :f561
:^G5CJ :^K5CL
:=H0o1 :f412
:;R0q :f16l
:;E0ML :fc61
:=v09 :fc2g
:;R0l :f125
:;L0jJ :f521
:=G0f1 :f545
:uQ2L| :f141
:\R0LI| :f161
:\Q0ML :f161
:\R0k :f121
:\Q0jL| :f121
:uQ1kI
:=v062 :fc33
:=v052 :fc71
:=v362 :fc11
:^v462I :^G462I
:-w5u :f31d
:'w5G :f311
:=A2a2 :f12f
:=w0o :f331
:^A3a2
:=v072 :f14i
:=G072 :f14d
:'G1lL :f113
:<H1lL :f113
:/M1z :f311
:<G2DL :f118
:'C2qI :f311
:^C3pI :f311
:<C4oI :f311
:-C4l :f313
:<C4k :f311
:^C3j :f311
:'C2i :f311
:)C3o- :f311
:)C3k-I :f311
:=v4i :f613 :nv4i| :nA4i
:'w28I :fa11
:^w37I :fa11
:^w46I :fa11
:'w2n :f411
:^x3o :f211
:)Q1rJ :f11c
:)Q2DJ :f118
:uB2o :uF2oJ :uB2kL :uF2kI
:]G2kL :]G2oL
:nv0v2| :f151 :nw0v2 :f151 :nv0w2J| :f151 :nw0w2L :f151
:ny0v2| :f151 :nz3v2 :f121 :ny0w2J| :f151 :nz3w2L :f121
:nv0G2| :f151 :nw0G2 :f151 :nv0H2J| :f151 :nw0H2L :f151
:ny0G2| :f151 :nz3G2 :f121 :ny0H2J| :f151 :nz3H2L :f121

View file

@ -3,5 +3,5 @@
clear
clear
gcc -std=c99 -g -Wall -Wextra -pedantic -O1 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o game frontend_sdl.c `sdl2-config --libs --static-libs` && ./game $@
gcc -std=c99 -g -Wall -Wextra -pedantic -O1 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o game frontend_sdl.c `sdl2-config --libs --cflags` && ./game $@

View file

@ -178,11 +178,12 @@ int LCR_rendererComputeTextWidth(const char *text, int size)
while (*text)
{
text++;
r += 2 * size;
if (text[1])
r += 3 * size / 4;
text++;
}
return r + LCR_FONT_PIXEL_SIZE - 1;
@ -869,7 +870,7 @@ uint8_t _LCR_buildMapModel(void)
for (int j = 0; j < LCR_currentMap.blockCount; ++j)
{
if (((j + 1) % LCR_SETTING_TRIANGLE_CULLING_PERIOD == 0) ||
if (((j + 1) % LCR_SETTING_CULLING_PERIOD == 0) ||
(LCR_renderer.mapModel.triangleCount == LCR_SETTING_MAX_MAP_TRIANGLES))
_LCR_cullHiddenMapTris();

View file

@ -63,10 +63,11 @@
#define LCR_SETTING_MAP_MAX_BLOCKS 4096
#endif
#ifndef LCR_SETTING_TRIANGLE_CULLING_PERIOD
/** This says how often (after how many triangles added) the map model
triangles will be culled. This value may affect how quickly maps load. */
#define LCR_SETTING_TRIANGLE_CULLING_PERIOD 256
#ifndef LCR_SETTING_CULLING_PERIOD
/** This says how often (after how many blocks added) during the map loading
the map model triangles and vertices will be culled. This value may affect
how quickly maps load. */
#define LCR_SETTING_CULLING_PERIOD 256
#endif
#ifndef LCR_SETTING_TEXTURE_SUBSAMPLE