Abort on big map

This commit is contained in:
Miloslav Ciz 2025-06-12 20:49:10 +02:00
parent 74013219e5
commit c317f84582
4 changed files with 20 additions and 15 deletions

View file

@ -18,14 +18,14 @@ fuck issue trackers :D
- very long replay DID 1x - very long replay DID 1x
- different resolutions KINDA DID 1x - different resolutions KINDA DID 1x
- different settings (332, POTATO, ...) - different settings (332, POTATO, ...)
- crazy shit with physics - crazy shit with physics KINDA DID
- replay with input not occuring for more that LCR_SETTING_GHOST_STEP - replay with input not occuring for more that LCR_SETTING_GHOST_STEP
- different platforms - different platforms
- error handling (bad map format, bad replay format, items in data file, ...) - error handling (bad map format, bad replay format, items in data file, ...)
- valgrind, cppcheck, different compilers, optimization levels, ... - valgrind, cppcheck, different compilers, optimization levels, ...
- play replay from one platform on another KINDA DID - play replay from one platform on another KINDA DID
- profiling - profiling
- gigantic map that fails to fit in RAM - gigantic map that fails to fit in RAM DID 1x
- replay stretching DID 1x - replay stretching DID 1x
- play all maps a lot DOING - play all maps a lot DOING
- correct saving of replays etc. - correct saving of replays etc.
@ -33,7 +33,7 @@ fuck issue trackers :D
- FPS on each platform - FPS on each platform
- try to use the racing module by itself - try to use the racing module by itself
- spellcheck comments - spellcheck comments
- test a map without any CPs where the car starts at finish - test a map without any CPs where the car starts at finish WORKS BUT NOT REP
- just read through the code and eyeball it - just read through the code and eyeball it
=========== BUGS ================= =========== BUGS =================

4
game.h
View file

@ -1282,6 +1282,7 @@ void LCR_gameDraw3DView(void)
LCR_physicsDebugDraw(camTr,camTr + 3,camTr[6],_LCR_physicdDebugDrawPixel); LCR_physicsDebugDraw(camTr,camTr + 3,camTr[6],_LCR_physicdDebugDrawPixel);
#endif #endif
#if LCR_SETTING_DISPLAY_HUD
// GUI/HUD: // GUI/HUD:
char str[10]; char str[10];
@ -1302,7 +1303,6 @@ void LCR_gameDraw3DView(void)
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(_FONT_SIZE) - LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(_FONT_SIZE) -
LCR_GUI_GAP,0,_FONT_SIZE); LCR_GUI_GAP,0,_FONT_SIZE);
#if LCR_SETTING_DISPLAY_INPUTS
str[0] = (LCR_racing.currentInputs & LCR_RACING_INPUT_LEFT) ? 'L' : '.'; str[0] = (LCR_racing.currentInputs & LCR_RACING_INPUT_LEFT) ? 'L' : '.';
str[1] = (LCR_racing.currentInputs & LCR_RACING_INPUT_BACK) ? 'D' : '.'; str[1] = (LCR_racing.currentInputs & LCR_RACING_INPUT_BACK) ? 'D' : '.';
str[2] = (LCR_racing.currentInputs & LCR_RACING_INPUT_FORW) ? 'U' : '.'; str[2] = (LCR_racing.currentInputs & LCR_RACING_INPUT_FORW) ? 'U' : '.';
@ -1313,7 +1313,6 @@ void LCR_gameDraw3DView(void)
LCR_rendererComputeTextWidth(str,_FONT_SIZE) - LCR_GUI_GAP, LCR_rendererComputeTextWidth(str,_FONT_SIZE) - LCR_GUI_GAP,
LCR_EFFECTIVE_RESOLUTION_Y - 2 * LCR_EFFECTIVE_RESOLUTION_Y - 2 *
(LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE); (LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE);
#endif
LCR_gameTimeToStr(LCR_game.runTime * LCR_RACING_TICK_MS,str); LCR_gameTimeToStr(LCR_game.runTime * LCR_RACING_TICK_MS,str);
@ -1333,6 +1332,7 @@ void LCR_gameDraw3DView(void)
LCR_rendererComputeTextHeight(_FONT_SIZE) - LCR_GUI_GAP, LCR_rendererComputeTextHeight(_FONT_SIZE) - LCR_GUI_GAP,
LCR_CONVERT_COLOR(0x4208),_FONT_SIZE); LCR_CONVERT_COLOR(0x4208),_FONT_SIZE);
#undef _FONT_SIZE #undef _FONT_SIZE
#endif
} }
void LCR_gameSaveReplay(void) void LCR_gameSaveReplay(void)

19
map.h
View file

@ -301,16 +301,16 @@ uint8_t *LCR_getMapBlockAtCoordNumber(uint32_t coord)
/** /**
Adds given block to current map, including possibly deleting a block by Adds given block to current map, including possibly deleting a block by
adding LCR_BLOCK_NONE. The function handles sorting the block to the right adding LCR_BLOCK_NONE. The function handles sorting the block to the right
position. position. Returns 1 if successful, else 0.
*/ */
void _LCR_mapAddBlock(const uint8_t block[LCR_BLOCK_SIZE]) uint8_t _LCR_mapAddBlock(const uint8_t block[LCR_BLOCK_SIZE])
{ {
LCR_LOG2("adding map block"); LCR_LOG2("adding map block");
if (LCR_currentMap.blockCount >= LCR_SETTING_MAP_MAX_BLOCKS) if (LCR_currentMap.blockCount >= LCR_SETTING_MAP_MAX_BLOCKS)
{ {
LCR_LOG0("couldn't add block"); LCR_LOG0("couldn't add block");
return; return 0;
} }
uint32_t coord = LCR_mapBlockGetCoordNumber(block); uint32_t coord = LCR_mapBlockGetCoordNumber(block);
@ -336,7 +336,7 @@ void _LCR_mapAddBlock(const uint8_t block[LCR_BLOCK_SIZE])
LCR_currentMap.blockCount--; LCR_currentMap.blockCount--;
} }
return; return 1;
} }
if (insertAt == LCR_currentMap.blockCount || if (insertAt == LCR_currentMap.blockCount ||
@ -358,6 +358,8 @@ void _LCR_mapAddBlock(const uint8_t block[LCR_BLOCK_SIZE])
for (uint8_t j = 0; j < LCR_BLOCK_SIZE; ++j) for (uint8_t j = 0; j < LCR_BLOCK_SIZE; ++j)
LCR_currentMap.blocks[insertAt + j] = block[j]; LCR_currentMap.blocks[insertAt + j] = block[j];
return 1;
} }
/** /**
@ -627,7 +629,8 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
{ {
LCR_makeMapBlock(type,x2,y2,z2,mat,t2,tmpBlock); LCR_makeMapBlock(type,x2,y2,z2,mat,t2,tmpBlock);
_LCR_mapAddBlock(tmpBlock); if (!_LCR_mapAddBlock(tmpBlock))
return 0;
} }
} }
} }
@ -660,7 +663,8 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform, LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
tmpBlock); tmpBlock);
_LCR_mapAddBlock(tmpBlock); if (!_LCR_mapAddBlock(tmpBlock))
return 0;
} }
break; break;
@ -709,7 +713,8 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
LCR_makeMapBlock(block,coords[0],coords[1],coords[2],mat,trans, LCR_makeMapBlock(block,coords[0],coords[1],coords[2],mat,trans,
prevBlock); prevBlock);
_LCR_mapAddBlock(prevBlock); if (!_LCR_mapAddBlock(prevBlock))
return 0;
break; break;
} }

View file

@ -96,9 +96,9 @@
#define LCR_SETTING_LOD_COLOR 0x4229 #define LCR_SETTING_LOD_COLOR 0x4229
#endif #endif
#ifndef LCR_SETTING_DISPLAY_INPUTS #ifndef LCR_SETTING_DISPLAY_HUD
/** Whether to display current inputs on the screen. */ /** Whether to display game HUD. */
#define LCR_SETTING_DISPLAY_INPUTS 1 #define LCR_SETTING_DISPLAY_HUD 1
#endif #endif
#ifndef LCR_SETTING_CAR_ANIMATION_SUBDIVIDE #ifndef LCR_SETTING_CAR_ANIMATION_SUBDIVIDE