Add sound

This commit is contained in:
Miloslav Ciz 2025-01-29 16:27:47 +01:00
parent be11c582b1
commit 67e0814afb
8 changed files with 124 additions and 94 deletions

View file

@ -1,7 +1,8 @@
#ifndef _LCR_RACING_H
#define _LCR_RACING_H
/*
/** @file racing.h
Licar: racing module
This implements the racing physics and logic as well as replays and other
@ -40,6 +41,7 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
#define LCR_RACING_EVENT_FINISHED 0x0002
#define LCR_RACING_EVENT_CRASH_SMALL 0x0004
#define LCR_RACING_EVENT_CRASH_BIG 0x0008
#define LCR_RACING_EVENT_ACCELERATOR 0x0010
#define LCR_PHYSICS_UNIT 4096 ///< len. of square for phys. engine
@ -1211,7 +1213,10 @@ uint32_t LCR_racingStep(unsigned int input)
_LCR_applyMaterialFactor(LCR_CAR_FORWARD_FRICTION,groundMat);
if (onAccel)
{
input |= LCR_RACING_INPUT_FORW; // accelerator enforces this
result |= LCR_RACING_EVENT_ACCELERATOR;
}
if(!(input & (LCR_RACING_INPUT_FORW | LCR_RACING_INPUT_BACK)))
LCR_racing.carBody.friction *= LCR_CAR_STAND_FRICTION_MULTIPLIER;
@ -1330,13 +1335,13 @@ uint32_t LCR_racingStep(unsigned int input)
if ((!LCR_racing.carDrifting) &&
driftFriction > LCR_CAR_DRIFT_THRESHOLD_1)
{
LCR_LOG1("drift start");
LCR_LOG2("drift start");
LCR_racing.carDrifting = 1;
}
else if (LCR_racing.carDrifting &&
driftFriction < LCR_CAR_DRIFT_THRESHOLD_0)
{
LCR_LOG1("drift end");
LCR_LOG2("drift end");
LCR_racing.carDrifting = 0;
}