Fix some details

This commit is contained in:
Miloslav Ciz 2025-03-24 16:24:14 +01:00
parent 8450e113fa
commit 139bb2f905
4 changed files with 31 additions and 4 deletions

View file

@ -61,6 +61,8 @@
=========== BUGS =================
- sometimes the games prints huge long ass number of newlines, WHY (happens
when driving on accelerator)
- 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

View file

@ -5,12 +5,15 @@
#define DATA_FILE_NAME "data"
#include "game.h"
#define LCR_LOADING_COMMAND SDL_PumpEvents(); SDL_RenderPresent(renderer);
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
SDL_Surface *screenSurface;
#include "game.h"
uint16_t screen[LCR_SETTING_RESOLUTION_X * LCR_SETTING_RESOLUTION_Y];
FILE *musicFile = 0;
@ -106,7 +109,7 @@ uint8_t LCR_keyPressed(uint8_t key)
void LCR_sleep(uint16_t timeMs)
{
usleep(timeMs * 1000);
SDL_Delay(timeMs);
}
void LCR_drawPixel(unsigned long index, uint16_t color)
@ -221,9 +224,15 @@ int main(int argc, char *argv[])
while (running)
{
SDL_PumpEvents();
SDL_Event event;
running = 1;
while (SDL_PollEvent(&event))
if (event.type == SDL_QUIT)
running = 0;
keyboardState = SDL_GetKeyboardState(NULL);
running = !keyboardState[SDL_SCANCODE_Q];
running &= LCR_gameStep(SDL_GetTicks());

9
game.h
View file

@ -167,6 +167,15 @@ uint8_t LCR_gameMusicOn(void);
*/
uint8_t LCR_gameGetNextAudioSample(void);
/**
This macro may be redefined by frontend to a command that will be periodically
performed during map loading. This exists to prevent making the program seem
unresponsive or being killed by a watchdog.
*/
#ifndef LCR_LOADING_COMMAND
#define LCR_LOADING_COMMAND ;
#endif
//------------------------------------------------------------------------------
#define LCR_LOG0(s) ;

View file

@ -903,6 +903,13 @@ uint8_t _LCR_buildMapModel(void)
vx, vy, vz, // vertex coords
vi = 0; // vertex index (0, 1 or 2)
#ifdef LCR_LOADING_COMMAND
if (j % 64 == 0)
{
LCR_LOADING_COMMAND
}
#endif
LCR_mapBlockGetCoords(block,&bx,&by,&bz);
LCR_mapGetBlockShape(blockType,LCR_mapBlockGetTransform(block),