forked from speed-dreams/speed-dreams-code
Pit building update
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@512 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 640128d08d61a027233cb70b9507e6ae6c77db00 Former-commit-id: b657377b0ceca8cf9db5ca8e742ef552f98b631a
This commit is contained in:
parent
1942607645
commit
fe10b73097
2 changed files with 34 additions and 6 deletions
|
@ -42,7 +42,7 @@ Ac3dOpen(char *filename, int nbObjects)
|
||||||
{
|
{
|
||||||
FILE *save_fd;
|
FILE *save_fd;
|
||||||
|
|
||||||
save_fd = fopen(filename, "wa");
|
save_fd = fopen(filename, "w"); //save_fd = fopen(filename, "wa");
|
||||||
|
|
||||||
if (save_fd == NULL) {
|
if (save_fd == NULL) {
|
||||||
GfOut("Failed to open '%s' for writing", filename);
|
GfOut("Failed to open '%s' for writing", filename);
|
||||||
|
|
|
@ -79,26 +79,54 @@ static unsigned int *trackindices;
|
||||||
static tdble TrackStep;
|
static tdble TrackStep;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initPits(tTrackPitInfo *pits)
|
initPits(tTrack *theTrack, void *TrackHandle, tTrackPitInfo *pits)
|
||||||
{
|
{
|
||||||
tTrackSeg *curMainSeg;
|
tTrackSeg *curMainSeg;
|
||||||
tTrackSeg *curPitSeg = NULL;
|
tTrackSeg *curPitSeg = NULL;
|
||||||
|
tTrackSeg *pitBuildingsStart = NULL;
|
||||||
|
const char *segName;
|
||||||
|
int found = 0;
|
||||||
tdble toStart = 0;
|
tdble toStart = 0;
|
||||||
tdble offset = 0;
|
tdble offset = 0;
|
||||||
tTrkLocPos curPos;
|
tTrkLocPos curPos;
|
||||||
int changeSeg;
|
int changeSeg;
|
||||||
int i;
|
int i;
|
||||||
|
static char path2[256];
|
||||||
|
sprintf(path2, "%s/%s", TRK_SECT_MAIN, TRK_SECT_PITS);
|
||||||
|
|
||||||
switch (pits->type) {
|
switch (pits->type) {
|
||||||
case TR_PIT_ON_TRACK_SIDE:
|
case TR_PIT_ON_TRACK_SIDE:
|
||||||
pits->driversPits = (tTrackOwnPit*)calloc(pits->nMaxPits, sizeof(tTrackOwnPit));
|
pits->driversPits = (tTrackOwnPit*)calloc(pits->nMaxPits, sizeof(tTrackOwnPit));
|
||||||
pits->driversPitsNb = pits->nMaxPits;
|
pits->driversPitsNb = pits->nPitSeg; // pits->driversPitsNb = pits->nMaxPits;
|
||||||
curPos.type = TR_LPOS_MAIN;
|
curPos.type = TR_LPOS_MAIN;
|
||||||
curMainSeg = pits->pitStart->prev;
|
|
||||||
|
segName = GfParmGetStr(TrackHandle, path2, TRK_ATT_BUILDINGS_START, NULL);
|
||||||
|
if (segName != 0) {
|
||||||
|
pitBuildingsStart = theTrack->seg;
|
||||||
|
found = 0;
|
||||||
|
for(i = 0; i < theTrack->nseg; i++) {
|
||||||
|
if (!strcmp(segName, pitBuildingsStart->name)) {
|
||||||
|
found = 1;
|
||||||
|
} else if (found) {
|
||||||
|
pitBuildingsStart = pitBuildingsStart->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pitBuildingsStart = pitBuildingsStart->prev;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
pitBuildingsStart = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pitBuildingsStart == NULL)
|
||||||
|
pitBuildingsStart = pits->pitStart;
|
||||||
|
|
||||||
|
// curMainSeg = pits->pitStart->prev;
|
||||||
|
curMainSeg = pitBuildingsStart->prev;
|
||||||
changeSeg = 1;
|
changeSeg = 1;
|
||||||
toStart = 0;
|
toStart = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < pits->nMaxPits) {
|
while (i < pits->nPitSeg) { // while (i < pits->nMaxPits) {
|
||||||
if (changeSeg) {
|
if (changeSeg) {
|
||||||
changeSeg = 0;
|
changeSeg = 0;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -2362,7 +2390,7 @@ InitScene(tTrack *Track, void *TrackHandle, int bump)
|
||||||
#define PIT_TOP 0.2
|
#define PIT_TOP 0.2
|
||||||
|
|
||||||
pits = &(Track->pits);
|
pits = &(Track->pits);
|
||||||
initPits(pits);
|
initPits(Track,TrackHandle,pits);
|
||||||
|
|
||||||
if (pits->type == TR_PIT_ON_TRACK_SIDE) {
|
if (pits->type == TR_PIT_ON_TRACK_SIDE) {
|
||||||
int uid = 1;
|
int uid = 1;
|
||||||
|
|
Loading…
Reference in a new issue