Add scroll modifier

This commit is contained in:
Miloslav Ciz 2025-03-23 16:43:35 +01:00
parent 9ec3c6b406
commit 8450e113fa
5 changed files with 15 additions and 63 deletions

View file

@ -7,7 +7,6 @@
data file, try to somehow hack around it (maybe just convert it to an array in data file, try to somehow hack around it (maybe just convert it to an array in
the end?) Maybe this: make a standalone C file with the string in it that the end?) Maybe this: make a standalone C file with the string in it that
when compiled and run outputs the array. when compiled and run outputs the array.
- add indicator that menu can be scrolled down
- car deglitch idea: deglitch only if the middle joint collided this frame? - car deglitch idea: deglitch only if the middle joint collided this frame?
- some kinda easteregg in menu or smt - some kinda easteregg in menu or smt
- culling is very slow now, it showed that distance bailout can accelerate it - culling is very slow now, it showed that distance bailout can accelerate it
@ -69,6 +68,7 @@
=========== HANDLED ============== =========== HANDLED ==============
- add ifdefs that change car color? - add ifdefs that change car color?
- add indicator that menu can be scrolled down
- sometimes getting a SLIGHTLY slower time counts as beating it (prolly - sometimes getting a SLIGHTLY slower time counts as beating it (prolly
conversion fail) (SEEMS FIXED NOW) conversion fail) (SEEMS FIXED NOW)
- make a small txt game manual - make a small txt game manual

View file

@ -61,51 +61,8 @@ static const char *LCR_texts[] =
// TODO: define string for CLI arguments for frontends? // TODO: define string for CLI arguments for frontends?
static const char *LCR_internalDataFile = static const char *LCR_internalDataFile =
"Mtestmap;"
"52123 1 :*H1k0"
":=s0s0 :fd19" // big concrete
":+w0o"
":+v0n"
":!x0n"
":^s1A0 :fk110" // ramps before wall
":=s0B0 :fd910" // concrete wall
":nu0j1 :uy0j1 :AA0j1 "
":vw0m0"
":vx0m0J"
":vw0l0L"
":vx0l0I"
":-s0q1"
":;p0w0L :f5130" // bugs
":>f0s0 :fd110" // small labyrinth
":oc0p0 :fd110"
":=f0s0 :f11d0"
":=c0p0 :f11d0"
":=C0s1 :fd190" // big dirt
":=M0s2 :fd190" // big grass
":=W0s3 :fd190" // big ice
":(s0r0" // hill
":~t1t2 :~u1t2 :~t1u2" // bumps
":^t0r0 :fq110 " // ramps
":}n0l1J :|n1l1J :|n3l1J- :]n4l1J- :=o0l1 :f151" // loop
":]n0m1J :|n1m1J :|n3m1J- :]n4m1J- :=o0m1 :f151" // loop
":}l0k1L :|l1k1L :|l3k1L- :]l4k1L- :=k0k1 :f151"
":]l0j1L :|l1j1L :|l3j1L- :]l4j1L- :=k0j1 :f151"
":-k5k1 :f5120"
" map end "
// MAP 1: // MAP 1:
"#MLC1;4321 0 " "MLC1;4321 0 "
":*C2mL:!x6G:+L2H:+D38" // start, finish, CPs ":*C2mL:!x6G:+L2H:+D38" // start, finish, CPs
// pillars: // pillars:
":nw0w2L:f151:m151" ":nw0w2L:f151:m151"

6
data
View file

@ -1,6 +0,0 @@
#RLCtiny5;00LCtiny5;5c14d8b6 0000283:0021:0153:0041:0069:00a1:0049:0081:0103:0061:0083:00b1:0079:0031:0033:0121:0053:0041:0033:0071:0099:0061:00b3:00c1:0093:0031:0043:0031:0053:0031:0043:0041:0033:0031:0075:0041:01b9:0021:0099:0041
#BLCtiny5;
#RLC1;00LC1;8bd6e314 0000489:0181:0139:0041:00c9:0051:0049:0051:0039:0031:0039:0041:0039:0031:0049:0031:0049:0031:0189:0061:0045:0021:0039:0021:0059:0041:0039:00f1:0033:0071:00e9:0031:0059:0031:0039:0041:0149:0021:0109:0021:0105:0031:0243:0041:00b3:00f1:00a3:0081:00b3:0031:0415:0031:0099:0041:0073:0041
#BLC1;
#RLC2;00LC2;3c5ba5dd 0000760:0131:0023:0071:00a9:0061:00a9:0051:0075:0041:0213:0031:0099:0041:0039:0031:0079:0071:00f3:0041:00a3:0071:0063:0031:0043:00a1:00b9:0031:0023:0091:0053:0031:00a3:0031:01c3:0041:0089:0031:0133:0021:0059:0021:00a5:0031:0113:0081:0053:0091:0033:0081:0083:0031:00f3:0021:00b3:0031:00d3:0031:0069:00a1:0079:0061:00a9:0041:0083:0071:0083:0031:0053:00b1:0053:00b1:03c3:0051:0025:0041:0043:0012:0066:0042:00b3:00d1:0279:0041:01c3:0021
#BLC2;

19
game.h
View file

@ -894,7 +894,7 @@ void LCR_gameLoadMainMenuItems(void)
LCR_game.menu.itemNames[j][i + 1] = 0; LCR_game.menu.itemNames[j][i + 1] = 0;
} }
LCR_game.menu.itemCount = 4; LCR_game.menu.itemCount = 5;
} }
#define LCR_GAME_DATA_FILE_BUFFER_SIZE 32 #define LCR_GAME_DATA_FILE_BUFFER_SIZE 32
@ -940,7 +940,7 @@ void _LCR_gameDataCharWrite(char c)
void LCR_gameLoadDataFileChunk(unsigned int startIndex, char magicNumber) void LCR_gameLoadDataFileChunk(unsigned int startIndex, char magicNumber)
{ {
char c; char c;
unsigned char state = 0; unsigned char state = 0; // 0: read magic num., >= 1: read name, 255: skip
LCR_gameEraseMenuItemNames(); LCR_gameEraseMenuItemNames();
@ -963,7 +963,7 @@ void LCR_gameLoadDataFileChunk(unsigned int startIndex, char magicNumber)
if (c == 0) if (c == 0)
return; return;
if (state == 0) // second magic char if (state == 0) // magic number
{ {
state = 255; state = 255;
@ -976,15 +976,14 @@ void LCR_gameLoadDataFileChunk(unsigned int startIndex, char magicNumber)
else if (i == 1) else if (i == 1)
state = 1; state = 1;
} }
} }
else if (i == 1 && state != 255) else if (i == 1 && state != 255)
{ {
if (c == LCR_DATA_FILE_SEPARATOR || if (c == LCR_DATA_FILE_SEPARATOR || c == LCR_DATA_FILE_SEPARATOR2 ||
c == LCR_DATA_FILE_SEPARATOR2 || (state >= 1 + LCR_MENU_STRING_SIZE - 1))
state >= 1 + LCR_MENU_STRING_SIZE - 1)
{ {
state = 255; state = 255;
LCR_game.menu.itemCount++; LCR_game.menu.itemCount++;
if (LCR_game.menu.itemCount >= LCR_DATA_ITEM_CHUNK) if (LCR_game.menu.itemCount >= LCR_DATA_ITEM_CHUNK)
@ -1676,8 +1675,10 @@ uint8_t LCR_gameStep(uint32_t time)
LCR_game.state == LCR_GAME_STATE_LOADING) LCR_game.state == LCR_GAME_STATE_LOADING)
LCR_rendererDrawMenu(LCR_texts[LCR_TEXTS_TABS LCR_rendererDrawMenu(LCR_texts[LCR_TEXTS_TABS
+ LCR_game.menu.selectedTab],LCR_game.menu.itemNamePtrs, + LCR_game.menu.selectedTab],LCR_game.menu.itemNamePtrs,
LCR_game.menu.itemCount + 1,LCR_game.menu.selectedItem); LCR_game.menu.itemCount,LCR_game.menu.selectedItem,
(LCR_game.menu.selectedTab > 0) &&
LCR_game.dataFile.firstItemIndex + LCR_DATA_ITEM_CHUNK - 1
< LCR_game.dataFile.itemsTotal);
else else
LCR_gameDraw3DView(); LCR_gameDraw3DView();

View file

@ -1822,7 +1822,7 @@ void LCR_rendererBlitImage(uint8_t index, unsigned int x, unsigned int y,
} }
void LCR_rendererDrawMenu(const char *tabName,const char **items, void LCR_rendererDrawMenu(const char *tabName,const char **items,
unsigned char itemCount,char selectedItem) unsigned char itemCount,char selectedItem, char scroll)
{ {
int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7; int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7;
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9; int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9;
@ -1881,9 +1881,9 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
i = stripHeight + (stripHeight2 - LCR_rendererComputeTextHeight(3)) / 2; i = stripHeight + (stripHeight2 - LCR_rendererComputeTextHeight(3)) / 2;
for (int j = 0; j < itemCount + 1; ++j) for (int j = 0; j < itemCount + 1 + (scroll != 0) ; ++j)
{ {
const char *s = j ? items[j - 1] : tabName; const char *s = j ? (j <= itemCount ? items[j - 1] : "...") : tabName;
const char *s2 = s; const char *s2 = s;
uint16_t textColor = 0x5aeb; uint16_t textColor = 0x5aeb;