1 #pragma once 2 #include <string> 3 #include <assert.h> 4 #include "cartire.h" 5 6 const static char csTRKsurf[8/*NumTypes*/][10] = 7 { "[none]", "Asphalt", "Grass", "Gravel", "Concrete", "Sand", "Cobbles", "[all]" }; 8 9 10 class TRACKSURFACE 11 { 12 public: 13 enum TYPE 14 { NONE=0, ASPHALT, GRASS, GRAVEL, CONCRETE, SAND, COBBLES, NumTypes }; 15 16 float friction, frictionX, frictionY; // x,y - multipliers 17 float bumpWaveLength, bumpAmplitude, bumpWaveLength2, bumpAmplitude2; 18 float rollingDrag, rollingResist; 19 20 TYPE type; 21 std::string name, tireName; // .tire file source (without ".tire") 22 CARTIRE* tire; /// tire params set 23 24 static CARTIRE* pTireDefault; 25 TRACKSURFACE()26 TRACKSURFACE() : 27 friction(1.0f), 28 frictionX(1.0f), frictionY(1.0f), 29 bumpWaveLength(10.f), bumpAmplitude(0.f), 30 bumpWaveLength2(14.f), bumpAmplitude2(0.f), 31 rollingDrag(1.f), rollingResist(1.f), 32 type(GRASS), 33 tireName("DEFAULT"), 34 tire(CARTIRE::None()) 35 { } 36 setType(unsigned int i)37 void setType(unsigned int i) 38 { 39 type = i < NumTypes ? (TYPE)i : NumTypes; 40 } 41 42 bool operator==(const TRACKSURFACE& t) const 43 { 44 return (type == t.type) 45 && (bumpWaveLength == t.bumpWaveLength) && (bumpAmplitude == t.bumpAmplitude) 46 && (friction == t.friction) 47 && (rollingDrag == t.rollingDrag) && (tire == t.tire) 48 && (rollingResist == t.rollingResist) 49 && (frictionX == t.frictionX) && (frictionY == t.frictionY) 50 && (bumpWaveLength2 == t.bumpWaveLength2) && (bumpAmplitude2 == t.bumpAmplitude2); 51 } 52 None()53 static TRACKSURFACE * None() 54 { 55 static TRACKSURFACE s; 56 return &s; 57 } 58 }; 59