27#include <racescreens.h>
29#include <musicplayer/musicplayer.h>
30#include <portability.h>
79 ReInfo->_reSimItf.shutdown();
81 ReInfo->_reGraphicItf.shutdowncars();
86 ReInfo->_reGraphicItf.shutdowntrack();
130 void *params =
ReInfo->params;
134 GfError(
"RaceEngine: no drivers selected\n");
142 GfError(
"RaceEngine: track initialization failed\n");
151 (
ReInfo->_reGraphicItf.inittrack != 0)
192 if (number < 0.0f) number = 0.0f;
193 ReInfo->raceRules.fuelFactor = number;
197 if (number < 0.0f) number = 0.0f;
198 ReInfo->raceRules.damageFactor = number;
202 if (number < 0.0f) number = 0.0f;
203 ReInfo->raceRules.tireFactor = number;
207 if (number < 1.0f) number = 1.0f;
208 ReInfo->raceRules.refuelFuelFlow = number;
212 if (number < 0.0f) number = 0.0f;
213 ReInfo->raceRules.damageRepairFactor = number;
217 if (number < 0.0f) number = 0.0f;
218 ReInfo->raceRules.pitstopBaseTime = number;
222 if (number < 0.0f) number = 0.0f;
223 ReInfo->raceRules.allTiresChangeTime = number;
226 number =
ReInfo->track->pits.speedLimit;
228 ReInfo->track->pits.speedLimit = number;
235 void *params =
ReInfo->params;
236 void *results =
ReInfo->results;
237 const int BUFSIZE = 1024;
249 ReInfo->s->_totLaps = ((int)(dist /
ReInfo->track->length)) + 1;
262 ReInfo->s->_raceState = 0;
281 const int BUFSIZE = 1024;
284 void *params =
ReInfo->params;
285 void *results =
ReInfo->results;
290 snprintf(buf, BUFSIZE,
"%smodules/simu/%s.%s",
GetLibDir (),
dllname, DLLEXT);
303 for (i = 0; i < s->_ncars; i++) {
323 for (i = 0; i < s->_ncars; i++) {
324 snprintf(buf, BUFSIZE,
"Initializing Driver %s...", s->
cars[i]->_name);
329 carInfo =
ReInfo->_reCarInfo;
332 for (i = 0; i < s->_ncars; i++) {
337 for (i = 0; i < s->_ncars; i++) {
351 snprintf(buf, BUFSIZE,
"%s on %s", s->
cars[0]->_name,
ReInfo->track->name);
358 ReInfo->_reTimeMult = 1.0;
359 ReInfo->_reLastTime = -1.0;
362 ReInfo->s->currentTime = -2.0;
374 ReInfo->_reGraphicItf.initcars(s);
413 const char *raceName =
ReInfo->_reRaceName;
414 void *params =
ReInfo->params;
415 void *results =
ReInfo->results;
416 const int BUFSIZE = 1024;
417 char path[BUFSIZE], path2[BUFSIZE];
447 nCars =
MIN(nCars, maxCars);
452 for (i = 1; i < nCars + 1; i++) {
463 nCars =
MIN(nCars, maxCars);
468 for (i = 1; i < nCars + 1; i++) {
479 nCars =
MIN(nCars, maxCars);
480 for (i = 1; i < nCars + 1; i++) {
575 void *params =
ReInfo->params;
576 ReInfo->_reGraphicItf.muteformenu();
586 (
ReInfo->s->raceInfo.ncars == 1) &&
590 static const char* label[5] = {
"Restart Race",
"Setup Car, Restart",
"Abandon Race",
"Resume Race",
"Quit Game" };
591 static const char* tip[5] = {
"Restart the current race",
"Setup car and restart the current race",
"Abort the current race",
"Return to the race",
"Quit TORCS" };
616 void *params =
ReInfo->params;
617 void *results =
ReInfo->results;
639 void *results =
ReInfo->results;
640 void *params =
ReInfo->params;
645 GfOut(
"Race Nb %d\n", curRaceIdx);
660 void *params =
ReInfo->params;
663 void *results =
ReInfo->results;
667 (
ReInfo->_reGraphicItf.shutdowntrack != 0)
669 ReInfo->_reGraphicItf.shutdowntrack();
675 if (curRaceIdx == 1) {
676 if (curTrkIdx < nbTrk) {
679 }
else if (curTrkIdx >= nbTrk) {
687 if (curTrkIdx != 1) {
struct CarElt tCarElt
Car structure (tCarElt).
float tdble
Floating point type used in TORCS.
void * GfuiHookCreateAction(const tGfuiAction &onActivate)
Create a callback hook.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
int GfModLoad(unsigned int gfid, char *dllname, tModList **modlist)
Load the specified DLLs.
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
int GfParmListClean(void *handle, const char *path)
Remove all the subsections in a section in the parameter set handle.
int GfParmGetEltNb(void *handle, const char *path)
Count the number of subsections in a section in the parameter set handle.
struct RobotItf tRobotItf
Interface Structure for Robots.
void GfScrGetSize(int *scrw, int *scrh, int *vieww, int *viewh)
Get the screen and viewport sizes.
void RmDisplayStartRace(tRmInfo *info, void *startScr, void *abortScr)
void * ReScreenInit(void)
void * ReResScreenInit(void)
void ReResScreenSetTitle(char *title)
const char * ReGetPrevRaceName(void)
const char * ReGetCurrentRaceName(void)
int ReInitTrack(void)
Initialize the current race-manager track.
int ReInitCars(void)
Initialize the cars for a race.
void ReRaceCleanDrivers(void)
static void * RestartRaceHookHandle
static void RestartRaceHookActivate(void)
static void * AbandonRaceHookHandle
static void BackToRaceHookActivate(void)
static void * QuitHookHandle
int ReRaceEventInit(void)
Initialize the current race event before pre-race setup.
static void StartRaceHookActivate(void)
int ReEventShutdown(void)
static void * RestartRaceHookInit(void)
static void * StartRaceHookInit(void)
static void * AbortRaceHookInit(void)
static void * BackToRaceHookInit(void)
static void * AbortRaceHookHandle
static void * QuitHookInit(void)
static void AbortRaceHookActivate(void)
static void * BackToRaceHookHandle
void ReInitRules(tRmInfo *ReInfo)
static void * AbandonRaceHookInit(void)
static void abortRace(bool returnToMenu)
static void QuitHookActivate(void)
static void abortRaceForQuit(void)
static void AbandonRaceHookActivate(void)
static int reRaceRealStart(void)
static void * StopScrHandle
static void * StartRaceHookHandle
#define RM_ATTR_START_ORDER
#define RM_ATTR_SPLASH_MENU
#define RM_ATTR_FUEL_FACTOR
#define RE_STATE_SHUTDOWN
#define RE_STATE_PRE_RACE
struct RmInfo tRmInfo
Race Manager General Info.
#define RM_ATTR_INVALIDATE_BEST_LAP_WALL_TOUCH
#define RM_VAL_LAST_RACE_ORDER
#define RM_ATTR_DAMAGE_FACTOR
#define RM_ATTR_DAMAGE_REPAIR_FACTOR
#define RM_ATTR_CORNER_CUT_TIME_PENALTY
#define RE_ATTR_CUR_TRACK
#define RM_ATTR_INVALIDATE_BEST_LAP_CORNER_CUT
#define RM_VAL_LAST_RACE_RORDER
#define RM_VAL_DRV_LIST_ORDER
#define RM_ATTR_ALLOW_RESTART
#define RM_ATTR_PIT_SPEED_LIMIT
#define RM_SECT_DRIVERS_RACING
#define RE_ATTR_CUR_DRIVER
#define RM_ATTR_REFUEL_FUEL_FLOW
#define RM_DISP_MODE_CONSOLE
#define RM_ATTR_TIRE_FACTOR
#define RM_ATTR_ALL_TIRES_CHANGE_TIME
#define RM_DISP_MODE_NONE
#define RM_ATTR_PITSTOP_BASE_TIME
struct Situation tSituation
cars situation used to inform the GUI and the drivers
#define RM_DISP_MODE_NORMAL
void ReUpdateQualifCurRes(tCarElt *car)
void ReEventInitResults(void)
void ReUpdateStandings(void)
void ReDisplayStandings(void)
int ReDisplayResults(void)
struct RobotItf * robot
private
@ CORNER_CUTTING_TIME_INVALIDATE
@ CORNER_CUTTING_TIME_PENALTY
@ WALL_HIT_TIME_INVALIDATE
tCarElt ** cars
list of cars
Info returned by driver during the race.
tdble brakeCmd
Brake command [0.0, 1.0].
Race Engine Car Information about the race.