summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/MusicManager.cpp6
-rw-r--r--src/audio/oal/stream.cpp12
-rw-r--r--src/audio/oal/stream.h6
-rw-r--r--src/audio/sampman_oal.cpp5
-rw-r--r--src/core/Pad.cpp29
-rw-r--r--src/core/config.h2
-rw-r--r--src/vehicles/Automobile.cpp39
-rw-r--r--src/vehicles/Vehicle.cpp35
-rw-r--r--src/vehicles/Vehicle.h3
9 files changed, 76 insertions, 61 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 5c1414ad..fde92590 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -161,10 +161,10 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
- m_aTracks[i].m_nPosition = pos * AudioManager.GetRandomNumber(i % 5) % m_aTracks[i].m_nLength;
+ m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
else
m_aTracks[i].m_nPosition = 0;
-
+
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
}
@@ -1311,4 +1311,4 @@ cMusicManager::ChangeRadioChannel()
// these two are empty
void cMusicManager::Enable() {}
-void cMusicManager::Disable() {} \ No newline at end of file
+void cMusicManager::Disable() {}
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 23a0a0c9..2f392264 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -162,13 +162,13 @@ public:
void Seek(uint32 milliseconds)
{
if ( !IsOpened() ) return;
- mpg123_seek(m_pMH, ms2samples(milliseconds)*GetSampleSize(), SEEK_SET);
+ mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
}
uint32 Tell()
{
if ( !IsOpened() ) return 0;
- return samples2ms(mpg123_tell(m_pMH)/GetSampleSize());
+ return samples2ms(mpg123_tell(m_pMH));
}
uint32 Decode(void *buffer)
@@ -254,13 +254,13 @@ public:
void Seek(uint32 milliseconds)
{
if ( !IsOpened() ) return;
- op_pcm_seek(m_FileH, ms2samples(milliseconds) * GetSampleSize());
+ op_pcm_seek(m_FileH, ms2samples(milliseconds) / GetChannels());
}
uint32 Tell()
{
if ( !IsOpened() ) return 0;
- return samples2ms(op_pcm_tell(m_FileH)/GetSampleSize());
+ return samples2ms(op_pcm_tell(m_FileH) * GetChannels());
}
uint32 Decode(void *buffer)
@@ -515,8 +515,8 @@ uint32 CStream::GetPosMS()
alGetSourcei(m_alSource, AL_BYTE_OFFSET, &offset);
return m_pSoundFile->Tell()
- - m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1))
- + m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize());
+ - m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1)) / m_pSoundFile->GetChannels()
+ + m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
}
uint32 CStream::GetLengthMS()
diff --git a/src/audio/oal/stream.h b/src/audio/oal/stream.h
index 456c080a..2476abcc 100644
--- a/src/audio/oal/stream.h
+++ b/src/audio/oal/stream.h
@@ -24,12 +24,12 @@ public:
uint32 ms2samples(uint32 ms)
{
- return float(ms) / 1000.0f * float(GetChannels()) * float(GetSampleRate());
+ return float(ms) / 1000.0f * float(GetSampleRate());
}
uint32 samples2ms(uint32 sm)
{
- return float(sm) * 1000.0f / float(GetChannels()) / float(GetSampleRate());
+ return float(sm) * 1000.0f / float(GetSampleRate());
}
uint32 GetBufferSamples()
@@ -108,4 +108,4 @@ public:
void ProviderTerm();
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 94e653b1..d0b88245 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -27,6 +27,7 @@
#include "MusicManager.h"
#include "Frontend.h"
#include "Timer.h"
+#include "crossplatform.h"
#ifdef AUDIO_OPUS
#include <opusfile.h>
#endif
@@ -1462,11 +1463,11 @@ cSampleManager::InitialiseSampleBanks(void)
{
int32 nBank = SFX_BANK_0;
- fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
+ fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL )
return false;
#ifndef AUDIO_OPUS
- fpSampleDataHandle = fopen(SampleBankDataFilename, "rb");
+ fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
if ( fpSampleDataHandle == NULL )
{
fclose(fpSampleDescHandle);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 36e14e55..910a8c52 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -412,7 +412,11 @@ void OnlyRenderWheelsCheat()
void ChittyChittyBangBangCheat()
{
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ CHud::SetHelpMessage(TheText.Get(!CVehicle::bAllDodosCheat ? "CHEAT1" : "CHEATOF"), true);
+#else
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
+#endif
CVehicle::bAllDodosCheat = !CVehicle::bAllDodosCheat;
CStats::CheatedCount += 1000;
CPad::bHasPlayerCheated = true;
@@ -542,22 +546,6 @@ void AllCarsHeliCheat(void)
}
#endif
-#ifdef ALT_DODO_CHEAT
-void AltDodoCheat(void)
-{
- wchar* string;
- if (CVehicle::bAltDodoCheat) {
- string = TheText.Get("CHEATOF");
- CVehicle::bAltDodoCheat = false;
- }
- else {
- string = TheText.Get("CHEAT1");
- CVehicle::bAltDodoCheat = true;
- }
- CHud::SetHelpMessage(string, true);
-}
-#endif
-
#ifdef WALLCLIMB_CHEAT
void WallClimbingCheat(void)
{
@@ -1444,12 +1432,6 @@ void CPad::AddToPCCheatString(char c)
AllCarsHeliCheat();
#endif
-#ifdef ALT_DODO_CHEAT
- // "IWANTTOMASTERDODO"
- if (!_CHEATCMP("ODODRETSAMOTTNAWI"))
- AltDodoCheat();
-#endif
-
#ifdef WALLCLIMB_CHEAT
// "SPIDERCAR"
if (!_CHEATCMP("RACREDIPS"))
@@ -3166,6 +3148,9 @@ void CPad::ResetCheats(void)
CVehicle::bCheat4 = false;
CVehicle::bCheat5 = false;
CVehicle::bCheat8 = false;
+#ifdef RESTORE_ALLCARSHELI_CHEAT
+ bAllCarCheat = false;
+#endif
gbBlackCars = false;
gbPinkCars = false;
CCarCtrl::bMadDriversCheat = false;
diff --git a/src/core/config.h b/src/core/config.h
index 327230d0..475a63f8 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -251,7 +251,7 @@ enum Config {
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
#define KANGAROO_CHEAT
#define RESTORE_ALLCARSHELI_CHEAT
-#define ALT_DODO_CHEAT
+#define BETTER_ALLCARSAREDODO_CHEAT
#define WALLCLIMB_CHEAT
#define REGISTER_START_BUTTON
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 05596e75..01a4f094 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -1375,6 +1375,10 @@ CAutomobile::ProcessControl(void)
// Flying
bool playRotorSound = false;
+ bool isPlane = GetModelIndex() == MI_DODO || bAllDodosCheat;
+#ifdef FIX_BUGS
+ isPlane = isPlane && !IsRealHeli();
+#endif
if(GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PHYSICS){
if(IsRealHeli()){
bEngineOn = false;
@@ -1383,16 +1387,7 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[1] < 0.154f && m_aWheelSpeed[1] > 0.0044f)
playRotorSound = true;
}
- }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
-#ifdef FIX_BUGS
- !IsRealHeli() &&
-#endif
- m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
-#ifdef ALT_DODO_CHEAT
- if (bAltDodoCheat)
- FlyingControl(FLIGHT_MODEL_PLANE);
- else
-#endif
+ }else if(isPlane && m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
if(GetModelIndex() == MI_DODO)
FlyingControl(FLIGHT_MODEL_DODO);
else
@@ -2594,6 +2589,10 @@ CAutomobile::PreRender(void)
CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), 1);
}
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(-HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
@@ -2631,6 +2630,10 @@ CAutomobile::PreRender(void)
CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), 1);
}
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
@@ -2660,6 +2663,10 @@ CAutomobile::PreRender(void)
m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB == SURFACE_WATER){
// hovering on water
mat.RotateY(-HALFPI);
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(-HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
@@ -2690,6 +2697,10 @@ CAutomobile::PreRender(void)
m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB == SURFACE_WATER){
// hovering on water
mat.RotateY(HALFPI);
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
@@ -2820,6 +2831,10 @@ CAutomobile::PreRender(void)
CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), 1);
}
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(-HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
@@ -2857,6 +2872,10 @@ CAutomobile::PreRender(void)
CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), 1);
}
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ } else if (bAllDodosCheat && m_nDriveWheelsOnGround == 0 && m_nDriveWheelsOnGroundPrev == 0) {
+ mat.RotateY(HALFPI);
+#endif
}else{
// tilt wheel depending oh how much it presses on ground
float groundOffset = pos.z + m_fHeightAboveRoad - 0.5f*mi->m_wheelScale;
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 2e790e81..e3d73771 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -41,9 +41,6 @@ bool CVehicle::bCheat3;
bool CVehicle::bCheat4;
bool CVehicle::bCheat5;
bool CVehicle::bCheat8;
-#ifdef ALT_DODO_CHEAT
-bool CVehicle::bAltDodoCheat;
-#endif
bool CVehicle::bHoverCheat;
bool CVehicle::bAllTaxisHaveNitro;
bool CVehicle::m_bDisableMouseSteering = true;
@@ -351,14 +348,26 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fSteerUD *= -fSteerMult;
// thrust
+ float fThrust = pFlyingHandling->fThrust;
+ float fThrustFallOff = pFlyingHandling->fThrustFallOff;
+ float fThrustFallOffBack = pFlyingHandling->fThrustFallOff * 8.0f;
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ if (bAllDodosCheat && !IsRealPlane()) {
+ fThrust = pHandling->Transmission.fEngineAcceleration
+ * (pHandling->Transmission.nDriveType == '4' ? 4.0f : 2.0f);
+ fThrust = 5.0f * Max(fThrust, pFlyingHandling->fThrust); //tweak: (cars engines too weak to thrust car on air)
+ fThrustFallOff = Min(0.7f / pHandling->Transmission.fMaxVelocity, fThrustFallOff); //tweak: (use 0.7 instead of 1.0 to make cars 30% faster)
+ fThrustFallOffBack = -1.0f / pHandling->Transmission.fMaxReverseVelocity;
+ }
+#endif
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
- float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
+ float fPedalState = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
float fThrustAccel;
- if(fForwSpeed > 0.0f || fThrust > 0.0f)
- fThrustAccel = (fThrust - pFlyingHandling->fThrustFallOff * fForwSpeed) * pFlyingHandling->fThrust;
+ if(fForwSpeed > 0.0f || fPedalState > 0.0f)
+ fThrustAccel = (fPedalState - fThrustFallOff * fForwSpeed) * fThrust;
else
- fThrustAccel = Min(fThrust - 8.0f * pFlyingHandling->fThrustFallOff * fForwSpeed, 0.0f) * pFlyingHandling->fThrust;
+ fThrustAccel = Min(fPedalState - fThrustFallOffBack * fForwSpeed, 0.0f) * fThrust;
if(flightModel == FLIGHT_MODEL_PLANE_UNUSED)
fThrustAccel *= 0.3f;
else if(flightModel == FLIGHT_MODEL_PLANE)
@@ -396,14 +405,18 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float fPitchAccel = pFlyingHandling->fPitchStab * fTail * Abs(fTail) + pFlyingHandling->fPitch * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail);
- float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
- float fLiftAccel = (pFlyingHandling->fAttackLift * fLift + pFlyingHandling->fFormLift) * fForwSpeed * fForwSpeed;
+ float fLift = DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); //accel*angle
+ float fLiftAccel = (pFlyingHandling->fFormLift - pFlyingHandling->fAttackLift * fLift) * SQR(fForwSpeed);
float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep();
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) {
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
else if (flightModel == FLIGHT_MODEL_SEAPLANE && GetPosition().z > 80.0f)
fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
+#ifdef BETTER_ALLCARSAREDODO_CHEAT
+ else if(bAllDodosCheat && GetPosition().z > 170.0f)
+ fLiftImpulse = CTimer::GetTimeStep() * 0.9f * GRAVITY * m_fMass;
+#endif
}
ApplyMoveForce(fLiftImpulse * GetUp());
@@ -433,7 +446,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_HELI:
{
#ifdef RESTORE_ALLCARSHELI_CHEAT
- tFlyingHandlingData* flyingHandling = bAllCarCheat && GetStatus() == STATUS_PLAYER && !IsRealHeli() ? mod_HandlingManager.GetFlyingPointer(HANDLING_MAVERICK) : pFlyingHandling;
+ tFlyingHandlingData* flyingHandling = bAllCarCheat && !IsRealHeli() ? mod_HandlingManager.GetFlyingPointer(HANDLING_MAVERICK) : pFlyingHandling;
#else
tFlyingHandlingData* flyingHandling = pFlyingHandling;
#endif
@@ -2135,7 +2148,7 @@ CVehicle::HeliDustGenerate(CEntity *heli, float radius, float ground, int rnd)
r = clamp(red, 0.0f, 255.0f);
g = clamp(green, 0.0f, 255.0f);
b = clamp(blue, 0.0f, 255.0f);
- RwRGBA col1 = { r, g, b, CGeneral::GetRandomNumberInRange(8, 32) };
+ RwRGBA col1 = { r, g, b, (RwUInt8)CGeneral::GetRandomNumberInRange(8, 32) };
RwRGBA col2 = { 255, 255, 255, 32 };
if(n&1)
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 34106327..6bd6f7c6 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -400,9 +400,6 @@ public:
static bool bCheat4;
static bool bCheat5;
static bool bCheat8;
-#ifdef ALT_DODO_CHEAT
- static bool bAltDodoCheat;
-#endif
static bool bHoverCheat;
static bool bAllTaxisHaveNitro;
static bool m_bDisableMouseSteering;