diff --git a/TODO.txt b/TODO.txt index a0eec08..29f88cf 100644 --- a/TODO.txt +++ b/TODO.txt @@ -14,8 +14,6 @@ out for bugs due to false positives) - improve the car unstucking? maybe we can just keep the position of the car and ONE wheel (other joint positions can be computed) -- 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: @@ -44,7 +42,6 @@ - something with multiple finishes - U-ramp to build speed and jump up to catch a CP (done) - jump through air ring with CP -- try to speed up the slow culling - test: - long replay - replay stretching works @@ -61,6 +58,8 @@ =========== BUGS ================= +- sometimes during long loading the screen goes black, seems to have appeared + after adding LCR_LOADING_COMMAND - immediately after starting the map countdown seems to be lower - the pinch collision test seems to sometimes stop the car e.g. after falling from bigger height or when running into ramp at high speed (or not?) - FIX @@ -80,6 +79,8 @@ those nasty piercing bugs - replays are bugged, seem to not steer - make the U-ramp map taller due to new physics +- 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 <-- PROLLY NOT - on 1st map the camera is obscured by the wall at the start, fix it somehow (not the best first impression) <-- shifted start pos. - replay format should probably record game version diff --git a/data b/data index 48d0bc4..add95d8 100644 --- a/data +++ b/data @@ -1,4 +1,2 @@ -#RLCtiny1;00LCtiny1;7e39e006 0000336:0011:0143:0051:0079:0081:0073:0051:00e3:0021:00b9:0031:0139:00a1:00a9:0051:00e3:0041:0093:0031:00d3:0051:0013:0031:0053:0017:0016:0017:0016:0012:0163:0101:0023:0021:0083:0031:0215:0031:01d3:0041:0099:0031:00b9 -#BLCtiny1; -#RLCtiny5;00LCtiny5;5c14d8b6 0000298:0011:00f3:0071:0049:00b1:0013:0081:0019:0101:0013:00f1:00b9:0051:0063:0041:0069:0041:0033:00c1:0043:0111:0099:0081:0023:0091:00e3:0091:0063:0071:00b3:0051:00f5:0041:00e9:0051:0023:0071:0059:0051:0073 -#BLCtiny5; +"#MAAA;4321 0 " +":*&31 :^&11" diff --git a/frontend_sdl.c b/frontend_sdl.c index d62b631..480fef1 100644 --- a/frontend_sdl.c +++ b/frontend_sdl.c @@ -5,7 +5,7 @@ #define DATA_FILE_NAME "data" -#define LCR_LOADING_COMMAND SDL_PumpEvents(); SDL_RenderPresent(renderer); +#define LCR_LOADING_COMMAND SDL_PumpEvents(); SDL_Window *window; SDL_Renderer *renderer; diff --git a/renderer.h b/renderer.h index 8ffc521..1bf905d 100644 --- a/renderer.h +++ b/renderer.h @@ -838,24 +838,30 @@ void _LCR_makeMapChunks(void) LCR_renderer.chunkStarts[chunkNo] = start; - chunkCorner[0] = (chunkNo & 0x03) * LCR_RENDERER_CHUNK_SIZE_HORIZONTAL; - chunkCorner[1] = ((chunkNo >> 2) & 0x03) * (LCR_RENDERER_CHUNK_SIZE_HORIZONTAL / 2); - chunkCorner[2] = ((chunkNo >> 4) & 0x03) * LCR_RENDERER_CHUNK_SIZE_HORIZONTAL; + chunkCorner[0] = + (chunkNo & 0x03) * LCR_RENDERER_CHUNK_SIZE_HORIZONTAL; + chunkCorner[1] = + ((chunkNo >> 2) & 0x03) * (LCR_RENDERER_CHUNK_SIZE_HORIZONTAL / 2); + chunkCorner[2] = + ((chunkNo >> 4) & 0x03) * LCR_RENDERER_CHUNK_SIZE_HORIZONTAL; chunkCorner[0] -= LCR_MAP_SIZE_BLOCKS * LCR_RENDERER_UNIT / 2; chunkCorner[1] -= LCR_MAP_SIZE_BLOCKS * LCR_RENDERER_UNIT / 4; chunkCorner[2] -= LCR_MAP_SIZE_BLOCKS * LCR_RENDERER_UNIT / 2; - + for (int i = start; i < LCR_renderer.mapModel.triangleCount; ++i) { const S3L_Unit *v = LCR_renderer.mapVerts + 3 * tri[0]; if (v[0] >= chunkCorner[0] && - v[0] < chunkCorner[0] + LCR_RENDERER_CHUNK_SIZE_HORIZONTAL && + v[0] < chunkCorner[0] + LCR_RENDERER_CHUNK_SIZE_HORIZONTAL + + ((chunkNo & 0x03) == 0x03) && // includes last edge v[1] >= chunkCorner[1] && - v[1] < chunkCorner[1] + (LCR_RENDERER_CHUNK_SIZE_HORIZONTAL / 2) && + v[1] < chunkCorner[1] + (LCR_RENDERER_CHUNK_SIZE_HORIZONTAL / 2) + + (((chunkNo >> 2) & 0x03) == 0x03) && v[2] >= chunkCorner[2] && - v[2] < chunkCorner[2] + LCR_RENDERER_CHUNK_SIZE_HORIZONTAL) + v[2] < chunkCorner[2] + LCR_RENDERER_CHUNK_SIZE_HORIZONTAL + + (((chunkNo >> 4) & 0x03) == 0x03)) { _LCR_rendererSwapMapTris(i,start); start++; @@ -898,7 +904,7 @@ uint8_t _LCR_buildMapModel(void) const uint8_t *block = LCR_currentMap.blocks + j * LCR_BLOCK_SIZE; uint8_t blockType = block[0], - edgeBits, // bottom, top, left, right, front, bottom + edgeBits, // touching bounds? bottom, top, left, right, front, back bx, by, bz, // block coords vx, vy, vz, // vertex coords vi = 0; // vertex index (0, 1 or 2) @@ -918,16 +924,15 @@ uint8_t _LCR_buildMapModel(void) for (int i = 0; i < blockShapeByteCount; ++i) { if (vi == 0) - edgeBits = (by == 0) | - ((by == LCR_MAP_SIZE_BLOCKS - 1) << 1) | - ((bx == 0) << 2) | - ((bx == LCR_MAP_SIZE_BLOCKS - 1) << 3) | - ((bz == 0) << 4) | - ((bz == LCR_MAP_SIZE_BLOCKS - 1) << 5); + edgeBits = + (by == 0) | ((by == LCR_MAP_SIZE_BLOCKS - 1) << 1) | + ((bx == 0) << 2) | ((bx == LCR_MAP_SIZE_BLOCKS - 1) << 3) | + ((bz == 0) << 4) | ((bz == LCR_MAP_SIZE_BLOCKS - 1) << 5); LCR_decodeMapBlockCoords(blockShapeBytes[i],&vx,&vy,&vz); - edgeBits &= (vy == 0) | ((vy == LCR_BLOCK_SHAPE_COORD_MAX) << 1) | + edgeBits &= + (vy == 0) | ((vy == LCR_BLOCK_SHAPE_COORD_MAX) << 1) | ((vx == 0) << 2) | ((vx == LCR_BLOCK_SHAPE_COORD_MAX) << 3) | ((vz == 0) << 4) | ((vz == LCR_BLOCK_SHAPE_COORD_MAX) << 5); @@ -941,9 +946,9 @@ uint8_t _LCR_buildMapModel(void) if (vi < 2) vi++; - else + else // 3 indices => create and add triangle { - // don't add triangles completely at the floor or ceiling of the map + // don't add triangles completely at the boundary of the map if (!edgeBits) { uint8_t triData; @@ -1246,7 +1251,7 @@ void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3], LCR_renderer.scene.camera.transform.rotation.x += (yawPitchOffset[1] * S3L_F) / LCR_GAME_UNIT; - + #define CHK(o,c,l) \ if (LCR_renderer.scene.camera.transform.translation.c o l) \ LCR_renderer.scene.camera.transform.translation.c = l;