diff --git a/assets.h b/assets.h index 0870721..cd8358a 100644 --- a/assets.h +++ b/assets.h @@ -71,7 +71,7 @@ static const char *LCR_internalDataFile = ":;p0w0L :f5130" // bugs - ":>f0s0 :fd110" // small labyrinth + ":of0s0 :fd110" // small labyrinth ":oc0p0 :fd110" ":=f0s0 :f11d0" ":=c0p0 :f11d0" diff --git a/audio.h b/audio.h index 845a86d..e2c447f 100644 --- a/audio.h +++ b/audio.h @@ -11,13 +11,15 @@ file, left to be optionally loaded and played by the frontend). */ -#define LCR_SOUND_NONE 0 -#define LCR_SOUND_CLICK 1 +#define LCR_SOUND_NONE 0 +#define LCR_SOUND_CLICK 1 #define LCR_SOUND_CRASH_SMALL 2 -#define LCR_SOUND_CRASH_BIG 3 +#define LCR_SOUND_CRASH_BIG 3 #define LCR_SOUND_ACCELERATOR 4 +#define LCR_SOUND_FAN 5 -#define LCR_AUDIO_CRASH_LEN 2048 +#define LCR_AUDIO_CRASH_SOUND_LEN 2048 +#define LCR_AUDIO_FAN_SOUND_LEN 4096 struct { @@ -100,10 +102,10 @@ uint8_t LCR_audioGetNextSample(void) case LCR_SOUND_CRASH_BIG: { int limit = (LCR_audio.soundPlayed == LCR_SOUND_CRASH_BIG ? 256 : 96) - - (LCR_audio.soundPlayedFrame * 256) / LCR_AUDIO_CRASH_LEN; + (LCR_audio.soundPlayedFrame * 256) / LCR_AUDIO_CRASH_SOUND_LEN; if (LCR_audio.frame % 2 || // lower frequency - LCR_audio.soundPlayedFrame < LCR_AUDIO_CRASH_LEN / 4) + LCR_audio.soundPlayedFrame < LCR_AUDIO_CRASH_SOUND_LEN / 4) LCR_audio.crashSample = _LCR_audioNoise(); if (LCR_audio.crashSample > limit) @@ -127,6 +129,28 @@ uint8_t LCR_audioGetNextSample(void) break; + case LCR_SOUND_FAN: + { + int limit = LCR_AUDIO_FAN_SOUND_LEN - LCR_audio.soundPlayedFrame; + + if (limit > LCR_AUDIO_FAN_SOUND_LEN / 2) + limit = LCR_AUDIO_FAN_SOUND_LEN - limit; + + limit = (limit * 256) / (LCR_AUDIO_FAN_SOUND_LEN / 2); + + result = _LCR_audioNoise(); + + if (result > limit) + result = limit; + + result = 128 - limit / 2 + result; + + if (LCR_audio.soundPlayedFrame >= LCR_AUDIO_FAN_SOUND_LEN) + LCR_audio.soundPlayed = LCR_SOUND_NONE; + + break; + } + case LCR_SOUND_CLICK: { int v = ((LCR_audio.soundPlayedFrame >> 6) * diff --git a/game.h b/game.h index 1914740..c248c1f 100644 --- a/game.h +++ b/game.h @@ -1387,7 +1387,9 @@ LCR_replayOutputStr(_LCR_gameDataCharWrite); LCR_LOG2("crash (big)"); } else if (events & LCR_RACING_EVENT_ACCELERATOR) - LCR_audioPlaySoundIfFree(LCR_SOUND_ACCELERATOR); + LCR_audioPlaySoundIfFree(LCR_SOUND_ACCELERATOR); + else if (events & LCR_RACING_EVENT_FAN) + LCR_audioPlaySoundIfFree(LCR_SOUND_FAN); int engineIntensity = LCR_carSpeedKMH() * 2; diff --git a/racing.h b/racing.h index 1cb8949..a68dbb2 100644 --- a/racing.h +++ b/racing.h @@ -42,6 +42,7 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit #define LCR_RACING_EVENT_CRASH_SMALL 0x0004 #define LCR_RACING_EVENT_CRASH_BIG 0x0008 #define LCR_RACING_EVENT_ACCELERATOR 0x0010 +#define LCR_RACING_EVENT_FAN 0x0020 #define LCR_PHYSICS_UNIT 4096 ///< len. of square for phys. engine @@ -1202,7 +1203,10 @@ uint32_t LCR_racingStep(unsigned int input) onAccel = LCR_mapBlockIsAccelerator(b); if (LCR_mapBlockIsFan(b)) + { LCR_racing.fanForce = LCR_GRAVITY * LCR_FAN_FORCE; + result |= LCR_RACING_EVENT_FAN; + } groundMat = LCR_mapBlockGetMaterial( LCR_currentMap.blocks + groundBlockIndex * LCR_BLOCK_SIZE);