-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
437 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
############################################################################## | ||
# | ||
# file : Makefile | ||
# created : Thu Jan 21 11:41:38 CET 2016 | ||
# copyright : (C) 2002 Jure Zbontar | ||
# | ||
############################################################################## | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
############################################################################## | ||
|
||
ROBOT = jz | ||
MODULE = ${ROBOT}.so | ||
MODULEDIR = drivers/${ROBOT} | ||
SOURCES = ${ROBOT}.cpp | ||
|
||
SHIPDIR = drivers/${ROBOT} | ||
SHIP = ${ROBOT}.xml pw-imprezawrc.rgb logo.rgb | ||
SHIPSUBDIRS = | ||
|
||
PKGSUBDIRS = ${SHIPSUBDIRS} | ||
src-robots-jz_PKGFILES = $(shell find * -maxdepth 0 -type f -print) | ||
src-robots-jz_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd)) | ||
|
||
include ${MAKE_DEFAULT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/*************************************************************************** | ||
file : jz.cpp | ||
created : Thu Jan 21 11:41:38 CET 2016 | ||
copyright : (C) 2002 Jure Zbontar | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifdef _WIN32 | ||
#include <windows.h> | ||
#endif | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <math.h> | ||
|
||
#include <tgf.h> | ||
#include <track.h> | ||
#include <car.h> | ||
#include <raceman.h> | ||
#include <robottools.h> | ||
#include <robot.h> | ||
|
||
static tTrack *curTrack; | ||
|
||
static void initTrack(int index, tTrack* track, void *carHandle, void **carParmHandle, tSituation *s); | ||
static void newrace(int index, tCarElt* car, tSituation *s); | ||
static void drive(int index, tCarElt* car, tSituation *s); | ||
static void endrace(int index, tCarElt *car, tSituation *s); | ||
static void shutdown(int index); | ||
static int InitFuncPt(int index, void *pt); | ||
|
||
|
||
/* | ||
* Module entry point | ||
*/ | ||
extern "C" int | ||
jz(tModInfo *modInfo) | ||
{ | ||
memset(modInfo, 0, 10*sizeof(tModInfo)); | ||
|
||
modInfo->name = strdup("jz"); /* name of the module (short) */ | ||
modInfo->desc = strdup(""); /* description of the module (can be long) */ | ||
modInfo->fctInit = InitFuncPt; /* init function */ | ||
modInfo->gfId = ROB_IDENT; /* supported framework version */ | ||
modInfo->index = 1; | ||
|
||
return 0; | ||
} | ||
|
||
/* Module interface initialization. */ | ||
static int | ||
InitFuncPt(int index, void *pt) | ||
{ | ||
tRobotItf *itf = (tRobotItf *)pt; | ||
|
||
itf->rbNewTrack = initTrack; /* Give the robot the track view called */ | ||
/* for every track change or new race */ | ||
itf->rbNewRace = newrace; /* Start a new race */ | ||
itf->rbDrive = drive; /* Drive during race */ | ||
itf->rbPitCmd = NULL; | ||
itf->rbEndRace = endrace; /* End of the current race */ | ||
itf->rbShutdown = shutdown; /* Called before the module is unloaded */ | ||
itf->index = index; /* Index used if multiple interfaces */ | ||
return 0; | ||
} | ||
|
||
/* Called for every track change or new race. */ | ||
static void | ||
initTrack(int index, tTrack* track, void *carHandle, void **carParmHandle, tSituation *s) | ||
{ | ||
curTrack = track; | ||
*carParmHandle = NULL; | ||
} | ||
|
||
/* Start a new race. */ | ||
static void | ||
newrace(int index, tCarElt* car, tSituation *s) | ||
{ | ||
} | ||
|
||
/* Drive during race. */ | ||
static void | ||
drive(int index, tCarElt* car, tSituation *s) | ||
{ | ||
memset((void *)&car->ctrl, 0, sizeof(tCarCtrl)); | ||
car->ctrl.brakeCmd = 1.0; /* all brakes on ... */ | ||
/* | ||
* add the driving code here to modify the | ||
* car->_steerCmd | ||
* car->_accelCmd | ||
* car->_brakeCmd | ||
* car->_gearCmd | ||
* car->_clutchCmd | ||
*/ | ||
} | ||
|
||
/* End of the current race */ | ||
static void | ||
endrace(int index, tCarElt *car, tSituation *s) | ||
{ | ||
} | ||
|
||
/* Called before the module is unloaded */ | ||
static void | ||
shutdown(int index) | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; | ||
; file : jz.def | ||
; created : Thu Jan 21 11:41:38 CET 2016 | ||
; copyright : (C) 2002 Jure Zbontar | ||
; | ||
; | ||
; This program is free software; you can redistribute it and/or modify | ||
; it under the terms of the GNU General Public License as published by | ||
; the Free Software Foundation; either version 2 of the License, or | ||
; (at your option) any later version. | ||
; | ||
|
||
LIBRARY jz | ||
|
||
SECTIONS .data READ WRITE | ||
|
||
EXPORTS | ||
jz | ||
|
Oops, something went wrong.