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
- different resolutions KINDA DID 1x
- 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
- different platforms
- error handling (bad map format, bad replay format, items in data file, ...)
- valgrind, cppcheck, different compilers, optimization levels, ...
- play replay from one platform on another KINDA DID
- profiling
- gigantic map that fails to fit in RAM
- gigantic map that fails to fit in RAM DID 1x
- replay stretching DID 1x
- play all maps a lot DOING
- correct saving of replays etc.
@ -33,7 +33,7 @@ fuck issue trackers :D
- FPS on each platform
- try to use the racing module by itself
- 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
=========== BUGS =================

4
game.h
View file

@ -1282,6 +1282,7 @@ void LCR_gameDraw3DView(void)
LCR_physicsDebugDraw(camTr,camTr + 3,camTr[6],_LCR_physicdDebugDrawPixel);
#endif
#if LCR_SETTING_DISPLAY_HUD
// GUI/HUD:
char str[10];
@ -1302,7 +1303,6 @@ void LCR_gameDraw3DView(void)
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(_FONT_SIZE) -
LCR_GUI_GAP,0,_FONT_SIZE);
#if LCR_SETTING_DISPLAY_INPUTS
str[0] = (LCR_racing.currentInputs & LCR_RACING_INPUT_LEFT) ? 'L' : '.';
str[1] = (LCR_racing.currentInputs & LCR_RACING_INPUT_BACK) ? 'D' : '.';
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_EFFECTIVE_RESOLUTION_Y - 2 *
(LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE);
#endif
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_CONVERT_COLOR(0x4208),_FONT_SIZE);
#undef _FONT_SIZE
#endif
}
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
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");
if (LCR_currentMap.blockCount >= LCR_SETTING_MAP_MAX_BLOCKS)
{
LCR_LOG0("couldn't add block");
return;
return 0;
}
uint32_t coord = LCR_mapBlockGetCoordNumber(block);
@ -336,7 +336,7 @@ void _LCR_mapAddBlock(const uint8_t block[LCR_BLOCK_SIZE])
LCR_currentMap.blockCount--;
}
return;
return 1;
}
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)
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_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,
tmpBlock);
_LCR_mapAddBlock(tmpBlock);
if (!_LCR_mapAddBlock(tmpBlock))
return 0;
}
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,
prevBlock);
_LCR_mapAddBlock(prevBlock);
if (!_LCR_mapAddBlock(prevBlock))
return 0;
break;
}

View file

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