Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/sounds/engines/gear_shift4b2.wav
Binary file not shown.
14 changes: 8 additions & 6 deletions data/sounds/sounds.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ hover_r3
//--------------------------------------------------------------------------------------------------
gear_shift1
{
start engines/gear_shift1.wav
start engines/gear_shift4b2.wav
}
gear_shift2
{
start engines/gear_shift4a.wav
start engines/gear_shift4b2.wav
}
gear_shift3
{
start engines/gear_shift4b.wav
start engines/gear_shift4b2.wav
}


Expand All @@ -354,12 +354,14 @@ asphalt
}
gravel
{
sound 0.5 surface/gravel_05.wav
sound 1.0 surface/gravel_10.wav
sound 0.25 surface/gravel_05.old.wav
sound 0.4 surface/gravel_05.wav
sound 0.7 surface/gravel_05.wav
sound 1.0 surface/gravel_20.wav
}
grass
{
sound 0.5 surface/grass_05.wav
sound 0.25 surface/grass_05.wav
sound 1.0 surface/grass_10.wav
}

Expand Down
Binary file modified data/sounds/surface/grass_05.wav
Binary file not shown.
Binary file modified data/sounds/surface/grass_10.wav
Binary file not shown.
Binary file modified data/sounds/surface/grass_20.wav
Binary file not shown.
Binary file added data/sounds/surface/gravel_05.old.wav
Binary file not shown.
Binary file modified data/sounds/surface/gravel_05.wav
Binary file not shown.
Binary file modified data/sounds/surface/gravel_10.wav
Binary file not shown.
Binary file modified data/sounds/surface/gravel_20.wav
Binary file not shown.
4 changes: 3 additions & 1 deletion src/game/CarPosInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ void ReplayFrame2::FromCar(const CAR* pCar, half prevHitTime)
float slide = -1.f;
wh.squeal = pCar->GetTireSquealAmount(wp, &slide); wh.slide = slide;
wh.whVel = cd.GetWheelVelocity(wp).Magnitude();
// contact
wh.contact = (cd.GetWheelContact(wp).GetDepth() - 2 * pCar->GetTireRadius(wp)) > 0.0;
// susp
wh.suspVel = cd.GetSuspension(wp).GetVelocity();
wh.suspDisp = cd.GetSuspension(wp).GetDisplacementPercent();
Expand All @@ -178,7 +180,7 @@ void ReplayFrame2::FromCar(const CAR* pCar, half prevHitTime)
throttle = cd.GetThrottle() *255.f; clutch = pCar->GetClutch() *255.f;
steer = pCar->GetLastSteer() *127.f; fboost = cd.doBoost *255.f;
damage = cd.fDamage /100.f*255.f; //percent set outside

is_shifting = (char)(cd.rem_shift_time > 0.0001);
// eng snd
speed = pCar->GetSpeed(); dynVel = cd.GetVelocity().Magnitude();
set(b_braking, cd.IsBraking());
Expand Down
29 changes: 21 additions & 8 deletions src/game/FollowCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,19 @@ void FollowCamera::update(Real time, const PosInfo& posIn, PosInfo* posOut, COLL
} break;

case CAM_ExtAng: /* 4 Extended Angle - car in center, angle smooth */
{ Quaternion orient = orientGoal * qOrRot;
Quaternion ory; ory.FromAngleAxis(orient.getYaw(), Vector3::UNIT_Y);
{
Quaternion orient = (orientGoal * qOrRot * (Quaternion(Degree(180), Vector3::UNIT_Z)) * (Quaternion(Degree(-5), Vector3::UNIT_X)));


if (first) { mPosNodeOld = posGoal; }
Real vel = (posGoal - mPosNodeOld).length() / std::max(0.002f, std::min(0.1f, time));
mPosNodeOld = posGoal;
mVel = vel;

// float fac = std::max(0.2, (1.0 - (float)mVel / 30.0));

if (first) { qq = ory; }
else qq = orient.Slerp(ca.mSpeed * time, qq, ory, true);
if (first) { qq = orient; }
else qq = orient.Slerp(ca.mSpeed * time, qq, orient, true);

// smooth dist from vel
#if 0
Expand All @@ -190,11 +198,16 @@ void FollowCamera::update(Real time, const PosInfo& posIn, PosInfo* posOut, COLL
}
#endif

Quaternion qy = Quaternion(ca.mYaw, Vector3(0,1,0));
goalPos += qq * (xyz + ca.mOffset);
Vector3 v(0.0, 0.0, 2.0);
Vector3 v2(xyz);

// goalPos -= qq * (v);
Vector3 gp = goalPos + qq * v2;

camPosFinal = goalPos;
camRotFinal = qq * qy * Quaternion(Degree(-ca.mPitch - mATilt), Vector3(1,0,0));
Vector3 p = camPosFinal + (gp - camPosFinal) * 0.23;
// Quaternion q = camRotFinal + (qq - camRotFinal) * 0.2;
camPosFinal = p;
camRotFinal = qq;// * qy * qx;
manualOrient = true;
} break;
default: break;
Expand Down
12 changes: 9 additions & 3 deletions src/game/Replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ bool Replay2::LoadFile(string file, bool onlyHdr)
// header ------
ReplayHeader2& h = header;
rd(h.ver); rd(h.time);

bool is_new = (h.ver == 31);

rs(h.track) rd(h.track_user);
String ss = ">- Load replay2 ";
ss += h.track+" ";
Expand Down Expand Up @@ -157,7 +160,7 @@ bool Replay2::LoadFile(string file, bool onlyHdr)
if (f.get(b_hov)) rd(f.hov_roll);
bool flu = f.get(b_fluid);
if (flu) rd(f.whMudSpin);

if (is_new) rd(f.is_shifting);
// wheels
int ww = header.numWh[p];
for (w=0; w < ww; ++w)
Expand All @@ -173,6 +176,7 @@ bool Replay2::LoadFile(string file, bool onlyHdr)
// fluids
if (flu) rd(wh.whH);
rd(wh.whAngVel); rd(wh.whSteerAng);
if (is_new) rd(wh.contact);
f.wheels.push_back(wh);
}

Expand Down Expand Up @@ -234,7 +238,8 @@ bool Replay2::SaveFile(string file)
const ReplayHeader2& h = header;
header.SetHead();
of.write((char*)&h.head, 5);
wr(h.ver); wr(h.time);
short v = h.ver + 1;
wr(v); wr(h.time);
ws(h.track) wr(h.track_user);

wr(h.numPlayers);
Expand Down Expand Up @@ -272,7 +277,7 @@ bool Replay2::SaveFile(string file)
if (f.get(b_hov)) wr(f.hov_roll);
bool flu = f.get(b_fluid);
if (flu) wr(f.whMudSpin);

wr(f.is_shifting);
// wheels
int ww = f.wheels.size();
for (w=0; w < ww; ++w)
Expand All @@ -288,6 +293,7 @@ bool Replay2::SaveFile(string file)
// fluids
if (flu) wr(wh.whH);
wr(wh.whAngVel); wr(wh.whSteerAng);
wr(wh.contact);
}

// hit data
Expand Down
2 changes: 2 additions & 0 deletions src/game/Replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct RWheel
uchar whH; // /var - submerge
half whAngVel;
half whSteerAng; // 38B
bool contact;
};

struct RScrap
Expand Down Expand Up @@ -107,6 +108,7 @@ struct ReplayFrame2

// hud
char gear;
char is_shifting;
half rpm,vel;
uchar damage, clutch;
uchar percent; // track % val
Expand Down
12 changes: 7 additions & 5 deletions src/sound/SoundMgr_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ Sound* SoundMgr::createInstance(String name)
return NULL;
}

// LogO("a");
SoundTemplate* templ = templates[name];

// LogO("a");
Sound* inst = new Sound(templ, sound_mgr);

// LogO("a");
String ss = name.substr(0,4);
// LogO("a");
inst->set2D(ss=="hud/"); // set 2d

// LogO("a");
// start looped
if (!inst->start_sound)
{ inst->setGain(0.f);
Expand Down Expand Up @@ -101,8 +103,8 @@ void SoundMgr::parseScript(FileStreamDataStream* stream)
{
// no current SoundScript
// so first valid data should be a SoundScript name
//LogO("@ SoundScriptManager: creating template "+line);
//LogO("@ "+line);
LogO("@ SoundScriptManager: creating template "+line);
LogO("@ "+line);
sst = createTemplate(line, stream->getName());
if (!sst)
{
Expand Down
18 changes: 13 additions & 5 deletions src/sound/SoundMgr_Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,25 @@ void Sound::setGain(float value)
{
//if (fabs(lastgain - value) < 0.001f)
// return;

float g = value * gain;

if (start_sound)
// LogO("Q");
if (start_sound) {
// LogO("A");
start_sound->setGain(g);
}

for (int i=0; i < templ->free_sound; ++i)
if (sounds[i])
for (int i=0; i < templ->free_sound; ++i) {

if (sounds[i]) {
sounds[i]->setGain(g * pitch_gain[i]);
}
}

if (stop_sound)
if (stop_sound) {
// LogO("B");
stop_sound->setGain(g);
}

lastgain = g;
}
Expand Down
2 changes: 2 additions & 0 deletions src/vdrift/car.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ class CAR
CarModel* pCarM =0;
SETTINGS* pSet =0; // for sound vol


CAR();
~CAR();

float c_vel = 0.0, c_pitch = 0.0, tgd = 0.0;
int numWheels = 0;
void SetNumWheels(int n);

Expand Down
Loading