Add block cache

This commit is contained in:
Miloslav Ciz 2024-11-21 00:16:00 +01:00
parent ac5bddd9f4
commit f248981676
3 changed files with 86 additions and 9 deletions

View file

@ -9,10 +9,15 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
#define LCR_GAME_UNIT 1024 ///< length of map square in LCR_GameUnits
#define LCR_RACING_INPUT_FORW 0x01
#define LCR_RACING_INPUT_RIGHT 0x02
#define LCR_RACING_INPUT_BACK 0x04
#define LCR_RACING_INPUT_LEFT 0x08
#define LCR_RACING_INPUT_FORW 0x01
#define LCR_RACING_INPUT_RIGHT 0x02
#define LCR_RACING_INPUT_BACK 0x04
#define LCR_RACING_INPUT_LEFT 0x08
#define LCR_RACING_EVENT_CP_TAKEN 0x0001
#define LCR_RACING_EVENT_FINISHED 0x0002
#define LCR_RACING_EVENT_CRASH_SMALL 0x0004
#define LCR_RACING_EVENT_CRASH_BIG 0x0008
#define LCR_PHYSICS_UNIT 2048 ///< length of map square for physics engine
@ -571,11 +576,14 @@ int _LCR_racingCarShapeOK(void)
/**
Updates the racing physics world, call every LCR_RACING_TICK_MS milliseconds.
Returns a set of events (logically ORed) that occured during this step.
*/
void LCR_racingStep(unsigned int input)
uint32_t LCR_racingStep(unsigned int input)
{
printf("---------\n");
LCR_LOG2("racing step start");
uint32_t result = 0;
TPE_Vec3 carForw, carRight, carUp;
uint8_t groundMat = LCR_BLOCK_MATERIAL_CONCRETE; // material under wheels
int groundBlockIndex = -1;
@ -870,6 +878,8 @@ void LCR_racingStep(unsigned int input)
LCR_racing.tick++;
LCR_LOG2("racing step end");
return result;
}
void LCR_physicsDebugDraw(LCR_GameUnit camPos[3], LCR_GameUnit camRot[2],