Fix a few things

This commit is contained in:
Miloslav Ciz 2025-02-01 14:10:22 +01:00
parent 1f0d3587f6
commit 19d3c1cbe5
5 changed files with 37 additions and 37 deletions

View file

@ -51,11 +51,11 @@ static const char *LCR_internalDataFile =
"Mtestmap;" "Mtestmap;"
"52123 1 :*H1k0" "52123 1 :*H1k0"
":=s0s0 :fd190" // big concrete ":=s0s0 :fd19" // big concrete
":+w0o0" ":+w0o"
":+v0n0" ":+v0n"
":!x0n0" ":!x0n"
":^s1A0 :fk110" // ramps before wall ":^s1A0 :fk110" // ramps before wall
":=s0B0 :fd910" // concrete wall ":=s0B0 :fd910" // concrete wall
@ -84,10 +84,10 @@ static const char *LCR_internalDataFile =
":~t1t2 :~u1t2 :~t1u2" // bumps ":~t1t2 :~u1t2 :~t1u2" // bumps
":^t0r0 :fq110 " // ramps ":^t0r0 :fq110 " // ramps
":}n0l0J :|n1l0J :|n3l0J- :]n4l0J- :=o0l0 :f1510" // loop ":}n0lJ :|n1lJ :|n3lJ- :]n4lJ- :=o0l :f151" // loop
":]n0m0J :|n1m0J :|n3m0J- :]n4m0J- :=o0m0 :f1510" // loop ":]n0mJ :|n1mJ :|n3mJ- :]n4mJ- :=o0m :f151" // loop
":}l0k0L :|l1k0L :|l3k0L- :]l4k0L- :=k0k0 :f1510" ":}l0kL :|l1kL :|l3kL- :]l4kL- :=k0k :f151"
":]l0j0L :|l1j0L :|l3j0L- :]l4j0L- :=k0j0 :f1510" ":]l0jL :|l1jL :|l3jL- :]l4jL- :=k0j :f151"
":-k5k0 :f5120" ":-k5k0 :f5120"
" map end " " map end "

5
game.h
View file

@ -825,6 +825,8 @@ void LCR_gameInit(int argc, const char **argv)
} }
} }
LCR_gameLoadMainMenuItems();
if (quickLoad == 1) if (quickLoad == 1)
{ {
LCR_gameLoadMap(LCR_countData('M') - 1); LCR_gameLoadMap(LCR_countData('M') - 1);
@ -838,10 +840,7 @@ void LCR_gameInit(int argc, const char **argv)
LCR_game.menu.selectedTab = quickLoad; LCR_game.menu.selectedTab = quickLoad;
} }
else else
{
LCR_gameLoadMainMenuItems();
LCR_gameSetState(LCR_GAME_STATE_MENU); LCR_gameSetState(LCR_GAME_STATE_MENU);
}
} }
/** /**

26
map.h
View file

@ -30,7 +30,7 @@
- X, Y and Z are block coordinates, each one a single character. The - X, Y and Z are block coordinates, each one a single character. The
following are characters signifying numbers 0 to 63: following are characters signifying numbers 0 to 63:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@ 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@
- M is block material ('0' to '3'). - M is optional block material ('0' to '3', 0 is default).
- T is an optinal transform string (for more detail see the binary format) - T is an optinal transform string (for more detail see the binary format)
consisting from 0 to 3 characters, which may be: consisting from 0 to 3 characters, which may be:
- '|': flip horizontally - '|': flip horizontally
@ -107,12 +107,12 @@
#define LCR_BLOCK_CORNER_CONVEX 'n' ///< curved corner (convex) #define LCR_BLOCK_CORNER_CONVEX 'n' ///< curved corner (convex)
#define LCR_BLOCK_CORNER_CONCAVE 'l' ///< curved corner (concave) #define LCR_BLOCK_CORNER_CONCAVE 'l' ///< curved corner (concave)
#define LCR_BLOCK_FULL_ACCEL '>' #define LCR_BLOCK_FULL_ACCEL '>' ///< full block with accelerator
#define LCR_BLOCK_BOTTOM_ACCEL 'z' #define LCR_BLOCK_BOTTOM_ACCEL 'z' ///< bottom half block with accelerator
#define LCR_BLOCK_RAMP_ACCEL 'y' #define LCR_BLOCK_RAMP_ACCEL 'y' ///< ramp block with accelerator
#define LCR_BLOCK_FULL_FAN 'o' #define LCR_BLOCK_FULL_FAN 'o' ///< full block with fan
#define LCR_BLOCK_RAMP_FAN 'V' #define LCR_BLOCK_RAMP_FAN 'V' ///< ramp block with fan
#define LCR_BLOCK_CHECKPOINT_0 '+' ///< checkpoint, not taken #define LCR_BLOCK_CHECKPOINT_0 '+' ///< checkpoint, not taken
#define LCR_BLOCK_CHECKPOINT_1 '\t' ///< checkpoint, taken #define LCR_BLOCK_CHECKPOINT_1 '\t' ///< checkpoint, taken
@ -120,7 +120,7 @@
#define LCR_BLOCK_FINISH '!' ///< finish #define LCR_BLOCK_FINISH '!' ///< finish
// special blocks: // special blocks:
#define LCR_BLOCK_NONE 'x' ///< no block, e.g to make holes #define LCR_BLOCK_NONE 'x' ///< no block (to make holes etc.)
#define LCR_BLOCK_CUBOID_FILL 'f' /**< makes a cuboid from the #define LCR_BLOCK_CUBOID_FILL 'f' /**< makes a cuboid from the
previously specified block, the previously specified block, the
@ -450,18 +450,14 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
c = getNextCharFunc(); c = getNextCharFunc();
if (c < '0' || c > '3') if (c > '0' && c <= '3')
{ {
LCR_LOG0("bad material");
return 0;
}
mat = c - '0'; mat = c - '0';
c = getNextCharFunc();
}
while (1) while (1)
{ {
c = getNextCharFunc();
if (c == '|') if (c == '|')
trans |= LCR_BLOCK_TRANSFORM_FLIP_H; trans |= LCR_BLOCK_TRANSFORM_FLIP_H;
else if (c == '-') else if (c == '-')
@ -474,6 +470,8 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
trans |= LCR_BLOCK_TRANSFORM_ROT_270; trans |= LCR_BLOCK_TRANSFORM_ROT_270;
else else
break; break;
c = getNextCharFunc();
} }
while (c && c != LCR_BLOCK_START_CHAR) while (c && c != LCR_BLOCK_START_CHAR)

View file

@ -1470,7 +1470,7 @@ uint32_t LCR_racingStep(unsigned int input)
if (LCR_racing.carNotOKCount > 10) // TODO: constant if (LCR_racing.carNotOKCount > 10) // TODO: constant
{ {
LCR_LOG1("car not OK (short), fixing"); LCR_LOG2("car not OK (short), fixing");
for (int i = 0; i < LCR_CAR_JOINTS; ++i) for (int i = 0; i < LCR_CAR_JOINTS; ++i)
{ {

View file

@ -252,6 +252,9 @@ void LCR_rendererDrawText(const char *text, int x, int y, uint16_t color,
} }
} }
uint16_t _LCR_pixelColor = 0; /**< Holds pixel color for _LCR_pixelFunc3D. This
is needed is texture subsampling is on. */
/** /**
Used as a fragment shader by small3dlib. This function will be called for Used as a fragment shader by small3dlib. This function will be called for
every rasterized 3D pixel, we use it write actual pixels to the screen with every rasterized 3D pixel, we use it write actual pixels to the screen with
@ -436,8 +439,6 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
return; return;
} }
uint16_t color;
#if LCR_SETTING_TEXTURE_SUBSAMPLE != 0 #if LCR_SETTING_TEXTURE_SUBSAMPLE != 0
if (LCR_renderer.texSubsampleCount == 0) if (LCR_renderer.texSubsampleCount == 0)
{ {
@ -448,7 +449,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
barycentric[1] = pixel->barycentric[1] / 8; barycentric[1] = pixel->barycentric[1] / 8;
barycentric[2] = pixel->barycentric[2] / 8; barycentric[2] = pixel->barycentric[2] / 8;
color = LCR_sampleImage( _LCR_pixelColor = LCR_sampleImage(
(barycentric[0] * LCR_renderer.triUVs[0] + (barycentric[0] * LCR_renderer.triUVs[0] +
barycentric[1] * LCR_renderer.triUVs[2] + barycentric[1] * LCR_renderer.triUVs[2] +
barycentric[2] * LCR_renderer.triUVs[4]) barycentric[2] * LCR_renderer.triUVs[4])
@ -465,7 +466,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
LCR_renderer.texSubsampleCount--; LCR_renderer.texSubsampleCount--;
#endif #endif
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,color); LCR_drawPixelXYUnsafe(pixel->x,pixel->y,_LCR_pixelColor);
#endif // LCR_SETTING_POTATO_GRAPHICS #endif // LCR_SETTING_POTATO_GRAPHICS
} }
@ -1803,9 +1804,10 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
#if LCR_SETTING_POTATO_GRAPHICS #if LCR_SETTING_POTATO_GRAPHICS
); );
#else #else
^ (effect & 0x1827)); ^ (effect &
0x20c3));
effect += 3; effect += 5 + i % 4;
#endif #endif
++i; ++i;
@ -1884,7 +1886,8 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
stripHeight / LCR_IMAGE_SIZE,0xffff); stripHeight / LCR_IMAGE_SIZE,0xffff);
#endif #endif
LCR_rendererDrawText(LCR_texts[LCR_TEXTS_VERSION],5,5,0xe71c,2); LCR_rendererDrawText(LCR_texts[LCR_TEXTS_VERSION],
LCR_EFFECTIVE_RESOLUTION_X / 64,LCR_EFFECTIVE_RESOLUTION_Y / 64,0xe71c,2);
LCR_renderer.frame++; LCR_renderer.frame++;
} }