TORCS  1.3.9
The Open Racing Car Simulator
raceman.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  file : raceman.h
4  created : Sun Jan 30 22:59:17 CET 2000
5  copyright : (C) 2000,2002-2017 by Eric Espie, Bernhard Wymann
6  email : torcs@free.fr
7  version : $Id$
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
27 #ifndef _RACEMANV1_H_
28 #define _RACEMANV1_H_
29 
30 #include <tgf.h>
31 #include <car.h>
32 #include <track.h>
33 #include <graphic.h>
34 #include <simu.h>
35 
36 #define RCM_IDENT 0
37 
38 struct RmInfo;
39 
40 typedef int (*tfRmRunState) (struct RmInfo *);
41 
42 #define RM_SYNC 0x00000001
43 #define RM_ASYNC 0x00000002
44 
45 #define RM_END_RACE 0x00000010
46 #define RM_CONTINUE_RACE 0x00000020
47 
48 #define RM_NEXT_STEP 0x00000100
49 #define RM_NEXT_RACE 0x00000200
50 #define RM_NEXT_EVENT 0x00000400
51 
52 #define RM_ACTIVGAMESCR 0x01000000
53 #define RM_QUIT 0x40000000
54 
55 
56 #define RCM_MAX_DT_SIMU 0.002
57 #define RCM_MAX_DT_ROBOTS 0.02
58 
60 typedef struct {
61  int ncars;
62  int totLaps;
63  int state;
64 #define RM_RACE_RUNNING 0X00000001
65 #define RM_RACE_FINISHING 0X00000002
66 #define RM_RACE_ENDED 0X00000004
67 #define RM_RACE_STARTING 0X00000008
68 #define RM_RACE_PRESTART 0X00000010
69 #define RM_RACE_PAUSED 0X40000000
70  int type;
71 #define RM_TYPE_PRACTICE 0 /* Please keep the order */
72 #define RM_TYPE_QUALIF 1
73 #define RM_TYPE_RACE 2
75  unsigned long fps;
76 } tRaceAdmInfo;
77 
78 #define _ncars raceInfo.ncars
79 #define _totLaps raceInfo.totLaps
80 #define _raceState raceInfo.state
81 #define _raceType raceInfo.type
82 #define _maxDammage raceInfo.maxDammage
83 
85 typedef struct Situation {
87  double deltaTime;
88  double currentTime;
89  int nbPlayers;
91 } tSituation;
92 
94 typedef struct
95 {
99 } tRaceModIft;
100 
101 #define RE_STATE_CONFIG 0
102 #define RE_STATE_EVENT_INIT 1
103 #define RE_STATE_PRE_RACE 3
104 #define RE_STATE_RACE_START 5
105 #define RE_STATE_RACE 6
106 #define RE_STATE_RACE_STOP 7
107 #define RE_STATE_RACE_END 8
108 #define RE_STATE_POST_RACE 9
109 #define RE_STATE_EVENT_SHUTDOWN 11
110 #define RE_STATE_SHUTDOWN 12
111 #define RE_STATE_ERROR 13
112 #define RE_STATE_EXIT 14
113 
115 typedef struct
116 {
119  int lapFlag;
120  char *raceMsg;
121  double totalPitTime;
122  double startPitTime;
126 } tReCarInfo;
127 
131 typedef struct
132 {
133  int state;
134  void *param;
136  void *gameScreen;
137  void *menuScreen;
138  char *filename;
139  const char *name;
140  const char *raceName;
142  double curTime;
143  double lastTime;
144  double timeMult;
145  int running;
146 #define RM_DISP_MODE_NORMAL 0
147 #define RM_DISP_MODE_CAPTURE 1
148 #define RM_DISP_MODE_NONE 2
149 #define RM_DISP_MODE_CONSOLE 4
153 
154 #define _reState raceEngineInfo.state
155 #define _reParam raceEngineInfo.param
156 #define _reRacemanItf raceEngineInfo.itf.racemanItf
157 #define _reTrackItf raceEngineInfo.itf.trackItf
158 #define _reGraphicItf raceEngineInfo.itf.graphicItf
159 #define _reSimItf raceEngineInfo.itf.simItf
160 #define _reGameScreen raceEngineInfo.gameScreen
161 #define _reMenuScreen raceEngineInfo.menuScreen
162 #define _reFilename raceEngineInfo.filename
163 #define _reName raceEngineInfo.name
164 #define _reRaceName raceEngineInfo.raceName
165 #define _reCarInfo raceEngineInfo.carInfo
166 #define _reCurTime raceEngineInfo.curTime
167 #define _reTimeMult raceEngineInfo.timeMult
168 #define _reRunning raceEngineInfo.running
169 #define _reLastTime raceEngineInfo.lastTime
170 #define _displayMode raceEngineInfo.displayMode
171 #define _refreshDisplay raceEngineInfo.refreshDisplay
172 
173 #define RM_PNST_DRIVETHROUGH 0x00000001
174 #define RM_PNST_STOPANDGO 0x00000002
175 #define RM_PNST_STOPANDGO_OK 0x00000004
176 #define RM_PNST_SPD 0x00010000
177 #define RM_PNST_STNGO 0x00020000
178 
179 typedef struct RmRaceRules
180 {
181  enum RmRuleFlags {
185  };
186 
187  int enabled;
195 } tRmRaceRules;
196 
197 typedef struct RmCarRules
198 {
200 } tRmCarRules;
201 
202 typedef struct RmMovieCapture
203 {
204  int enabled;
205  int state;
206  double deltaSimu;
207  double deltaFrame;
208  double lastFrame;
209  const char *outputBase;
213 
214 
218 typedef struct RmInfo
219 {
223  void *params;
224  void *results;
230 } tRmInfo;
231 
232 /*
233  * Parameters name definitions for Race Managers
234  */
235 #define RM_SECT_HEADER "Header"
236 #define RM_SECT_DRIVERS "Drivers"
237 #define RM_SECT_STARTINGGRID "Starting Grid"
238 #define RM_SECT_RACES "Races"
239 #define RM_SECT_TRACKS "Tracks"
240 #define RM_SECT_CONF "Configuration"
241 #define RM_SECT_OPTIONS "Options"
242 #define RM_SECT_POINTS "Points"
243 
244 #define RM_SECT_DRIVERS_RACING "Drivers Start List"
245 
246 #define RM_ATTR_CUR_CONF "current configuration"
247 #define RM_ATTR_START_ORDER "starting order"
248 #define RM_ATTR_ALLOW_RESTART "restart"
249 #define RM_ATTR_SPLASH_MENU "splash menu"
250 #define RM_ATTR_DISP_START_GRID "display starting grid"
251 
252 #define RM_ATTR_MAXNUM "maximum number"
253 #define RM_ATTR_MAX_DRV "maximum drivers"
254 #define RM_ATTR_SKILL_LEVEL_DEFAULT "skill level default"
255 
256 #define RM_ATTR_PRIO "priority"
257 #define RM_ATTR_NAME "name"
258 #define RM_ATTR_DRVNAME "driver name"
259 #define RM_ATTR_CATEGORY "category"
260 #define RM_ATTR_DESCR "description"
261 #define RM_ATTR_BGIMG "menu image"
262 #define RM_ATTR_RUNIMG "run image"
263 #define RM_ATTR_STARTIMG "start image"
264 
265 #define RM_ATTR_MODULE "module"
266 #define RM_ATTR_IDX "idx"
267 #define RM_ATTR_FOCUSED "focused module"
268 #define RM_ATTR_FOCUSEDIDX "focused idx"
269 #define RM_ATTR_DISPMODE "display mode"
270 #define RM_ATTR_DISPRES "display results"
271 
272 #define RM_ATTR_TYPE "type"
273 #define RM_ATTR_RACE "race"
274 #define RM_ATTR_ROWS "rows"
275 #define RM_ATTR_TOSTART "distance to start"
276 #define RM_ATTR_COLDIST "distance between columns"
277 #define RM_ATTR_COLOFFSET "offset within a column"
278 #define RM_ATTR_INITSPEED "initial speed"
279 #define RM_ATTR_INITHEIGHT "initial height"
280 #define RM_ATTR_MAX_DMG "maximum dammage"
281 #define RM_ATTR_DISTANCE "distance"
282 #define RM_ATTR_LAPS "laps"
283 #define RM_ATTR_POLE "pole position side"
284 #define RM_ATTR_CARSPERPIT "cars per pit"
285 
286 #define RM_ATTR_INVALIDATE_BEST_LAP_WALL_TOUCH "invalidate best lap on wall touch"
287 #define RM_ATTR_INVALIDATE_BEST_LAP_CORNER_CUT "invalidate best lap on corner cutting"
288 #define RM_ATTR_CORNER_CUT_TIME_PENALTY "corner cutting time penalty"
289 #define RM_ATTR_DAMAGE_FACTOR "damage factor"
290 #define RM_ATTR_FUEL_FACTOR "fuel consumption factor"
291 #define RM_ATTR_TIRE_FACTOR "tire factor"
292 #define RM_ATTR_PIT_SPEED_LIMIT "pit speed limit"
293 #define RM_ATTR_REFUEL_FUEL_FLOW "refuel fuel flow"
294 #define RM_ATTR_DAMAGE_REPAIR_FACTOR "damage repair factor"
295 #define RM_ATTR_PITSTOP_BASE_TIME "pitstop base time"
296 #define RM_ATTR_ALL_TIRES_CHANGE_TIME "all tires change time"
297 
298 #define RM_ATTR_POINTS "points"
299 
300 #define RM_VAL_TRACKSEL "track select"
301 #define RM_VAL_DRVSEL "drivers select"
302 #define RM_VAL_RACECONF "race config"
303 #define RM_VAL_CONFRACELEN "race length"
304 #define RM_VAL_CONFDISPMODE "display mode"
305 
306 #define RM_VAL_DRV_LIST_ORDER "drivers list"
307 #define RM_VAL_LAST_RACE_ORDER "last race"
308 #define RM_VAL_LAST_RACE_RORDER "last race reversed"
309 
310 #define RM_VAL_RACE "race"
311 #define RM_VAL_QUALIF "qualifications"
312 #define RM_VAL_PRACTICE "practice"
313 
314 #define RM_VAL_YES "yes"
315 #define RM_VAL_NO "no"
316 
317 #define RM_VAL_VISIBLE "normal"
318 #define RM_VAL_INVISIBLE "results only"
319 
320 
321 #define RM_SECT_MOVIE_CAPTURE "Movie Capture"
322 
323 #define RM_ATT_CAPTURE_ENABLE "enable capture"
324 #define RM_ATT_CAPTURE_FPS "fps"
325 #define RM_ATT_CAPTURE_OUT_DIR "output directory"
326 
327 /* RESULTS */
328 
329 #define RE_SECT_HEADER "Header"
330 #define RE_ATTR_DATE "date"
331 
332 #define RE_SECT_CURRENT "Current"
333 #define RE_ATTR_CUR_RACE "current race"
334 #define RE_ATTR_CUR_TRACK "current track"
335 #define RE_ATTR_CUR_DRIVER "current driver"
336 
337 #define RE_ATTR_DLL_NAME "dll name"
338 #define RE_ATTR_INDEX "index"
339 
340 #define RE_SECT_STANDINGS "Standings"
341 #define RE_SECT_RESULTS "Results"
342 #define RE_SECT_RANK "Rank"
343 
344 #define RE_ATTR_NAME "name"
345 #define RE_ATTR_CAR "car"
346 #define RE_ATTR_MODULE "module"
347 #define RE_ATTR_IDX "idx"
348 #define RE_ATTR_LAPS "laps"
349 #define RE_ATTR_BEST_LAP_TIME "best lap time"
350 #define RE_ATTR_TIME "time"
351 #define RE_ATTR_TOP_SPEED "top speed"
352 #define RE_ATTR_BOT_SPEED "bottom speed"
353 #define RE_ATTR_DAMMAGES "dammages"
354 #define RE_ATTR_NB_PIT_STOPS "pits stops"
355 #define RE_ATTR_POINTS "points"
356 #define RE_ATTR_PENALTYTIME "penaltytime"
357 
358 #endif /* _RACEMANV1_H_ */
359 
360 
361 
int maxDammage
Definition: raceman.h:74
unsigned long fps
Definition: raceman.h:75
tdble topSpd
Definition: raceman.h:123
Race Manager General Info.
Definition: raceman.h:218
tRmCarRules * rules
by car rules
Definition: raceman.h:226
int lapFlag
Definition: raceman.h:119
double currentTime
current time in sec since the beginning of the simulation
Definition: raceman.h:88
tdble refuelFuelFlow
Definition: raceman.h:190
double timeMult
Definition: raceman.h:144
cars situation used to inform the GUI and the drivers
Definition: raceman.h:85
int ruleState
Definition: raceman.h:199
double lastTime
Definition: raceman.h:143
tCarElt ** cars
list of cars
Definition: raceman.h:90
void * param
Definition: raceman.h:134
double lastFrame
Definition: raceman.h:208
Location on the track in local coordinates.
Definition: track.h:418
tTrkLocPos prevTrkPos
Definition: raceman.h:117
void * results
Race results.
Definition: raceman.h:224
Car structure (tCarElt).
Definition: car.h:455
General info on current race.
Definition: raceman.h:60
double deltaSimu
Definition: raceman.h:206
double deltaFrame
Definition: raceman.h:207
tSimItf simItf
Definition: raceman.h:98
Track structure.
Definition: track.h:502
tTrackItf trackItf
Definition: raceman.h:96
struct RmRaceRules tRmRaceRules
Interface Structure for Track Loader.
Definition: track.h:603
void * menuScreen
Definition: raceman.h:137
tSituation * s
Situation during race.
Definition: raceman.h:221
tdble fuel
Definition: raceman.h:125
int currentCapture
Definition: raceman.h:210
Race Engine.
Definition: raceman.h:94
char * filename
Definition: raceman.h:138
tReCarInfo * carInfo
Definition: raceman.h:141
tCarElt * carList
List of all the cars racing.
Definition: raceman.h:220
double startPitTime
Definition: raceman.h:122
char * raceMsg
Definition: raceman.h:120
tModList ** modList
drivers loaded
Definition: raceman.h:225
tdble sTime
Definition: raceman.h:118
const char * raceName
Definition: raceman.h:140
float tdble
Floating point type used in TORCS.
Definition: tgf.h:48
double totalPitTime
Definition: raceman.h:121
int currentFrame
Definition: raceman.h:211
Simulation Module Interface Definition.
tdble pitstopBaseTime
Definition: raceman.h:192
int ncars
number of cars
Definition: raceman.h:61
The Gaming Framework API.
tTrack * track
Current track.
Definition: raceman.h:222
tRmRaceRules raceRules
Definition: raceman.h:229
int refreshDisplay
Definition: raceman.h:151
Graphic Module Interface Definition.
const char * name
Definition: raceman.h:139
int totLaps
total laps
Definition: raceman.h:62
tRmMovieCapture movieCapture
Definition: raceman.h:228
tdble allTiresChangeTime
Definition: raceman.h:194
This is the car structure.
int state
Definition: raceman.h:63
int enabled
Definition: raceman.h:187
struct Situation tSituation
cars situation used to inform the GUI and the drivers
tdble fuelFactor
Definition: raceman.h:188
tGraphicItf graphicItf
Definition: raceman.h:97
int nbPlayers
number of human player in local (splitted screen)
Definition: raceman.h:89
tdble tireFactor
Definition: raceman.h:193
struct RmInfo tRmInfo
Race Manager General Info.
Race Engine Information.
Definition: raceman.h:131
int type
Race type.
Definition: raceman.h:70
tRaceAdmInfo raceInfo
Definition: raceman.h:86
tRaceEngineInfo raceEngineInfo
Definition: raceman.h:227
Interface Structure for Simulation.
Definition: simu.h:84
struct RmMovieCapture tRmMovieCapture
void * gameScreen
Definition: raceman.h:136
tRaceModIft itf
Definition: raceman.h:135
int(* tfRmRunState)(struct RmInfo *)
Definition: raceman.h:40
Race Engine Car Information about the race.
Definition: raceman.h:115
tdble damageRepairFactor
Definition: raceman.h:191
tdble damageFactor
Definition: raceman.h:189
list of module interfaces
Definition: tgf.h:203
Track Structure and Track Loader Module Definition.
Interface Structure for Graphic Renering Module.
Definition: graphic.h:174
double deltaTime
Definition: raceman.h:87
void * params
Raceman parameters.
Definition: raceman.h:223
struct RmCarRules tRmCarRules
double curTime
Definition: raceman.h:142
const char * outputBase
Definition: raceman.h:209
tdble botSpd
Definition: raceman.h:124