Re #140 (D11 Support for multiple cars with same 3D model) Done. Check with MPA1 Hartbill 2002 test car
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2624 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 040088af568256d3af811b86e66cc6d992fccdda Former-commit-id: 5214faa63697f9453fcadd9099ae8783109c3702
This commit is contained in:
parent
09845fd18e
commit
ae54200a77
4 changed files with 18 additions and 7 deletions
|
@ -405,6 +405,9 @@ grInitShadow(tCarElt *car)
|
|||
ssgTexCoordArray *shd_tex = new ssgTexCoordArray(GR_SHADOW_POINTS+1);
|
||||
|
||||
sprintf(buf, "cars/%s;", car->_carName);
|
||||
if (strlen(car->_carTemplate) > 0) // Add the master model path if we are using a template.
|
||||
sprintf(buf + strlen(buf), "cars/%s;", car->_carTemplate);
|
||||
|
||||
grFilePath = buf;
|
||||
|
||||
shdTexName = GfParmGetStr(car->_carHandle, SECT_GROBJECTS, PRM_SHADOW_TEXTURE, "");
|
||||
|
@ -496,6 +499,14 @@ void grPropagateDamage (ssgEntity* l, sgVec3 poc, sgVec3 force, int cnt)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
grPreInitCar(tCarElt *car)
|
||||
{
|
||||
strncpy(car->_carTemplate,
|
||||
GfParmGetStr(car->_carHandle, SECT_GROBJECTS, PRM_TEMPLATE, ""), MAX_NAME_LEN - 1);
|
||||
car->_carTemplate[MAX_NAME_LEN - 1] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
grInitCar(tCarElt *car)
|
||||
{
|
||||
|
@ -528,10 +539,6 @@ grInitCar(tCarElt *car)
|
|||
grCarIndex = index = car->index; /* current car's index */
|
||||
handle = car->_carHandle;
|
||||
|
||||
/* Load car template 3D model name if any (needed also by grInitBoardCar => must precede) */
|
||||
strncpy(car->_carTemplate, GfParmGetStr(car->_carHandle, path, PRM_TEMPLATE, ""), MAX_NAME_LEN - 1);
|
||||
car->_carTemplate[MAX_NAME_LEN - 1] = 0;
|
||||
|
||||
/* Initialize board */
|
||||
grInitBoardCar(car);
|
||||
|
||||
|
|
|
@ -90,9 +90,12 @@ public:
|
|||
|
||||
extern tgrCarInfo *grCarInfo;
|
||||
|
||||
// grPreInitCar must be called once for each car before the first call to any other car function
|
||||
extern void grPreInitCar(tCarElt *car);
|
||||
|
||||
extern void grInitShadow(tCarElt *car);
|
||||
extern void grInitCar(tCarElt *car);
|
||||
extern void grDrawCar(tSituation *, tCarElt*, tCarElt *, int, int, double curTime, class cGrPerspCamera *curCam);
|
||||
extern void grInitShadow(tCarElt *car);
|
||||
extern void grInitCommonState(void);
|
||||
extern void grPropagateDamage (ssgEntity* l, sgVec3 poc, sgVec3 force, int cnt);
|
||||
#endif /* _GRCAR_H_ */
|
||||
|
|
|
@ -367,6 +367,8 @@ initCars(tSituation *s)
|
|||
|
||||
for (i = 0; i < s->_ncars; i++) {
|
||||
elt = s->cars[i];
|
||||
/* Car pre-initialization */
|
||||
grPreInitCar(elt);
|
||||
/* Shadow init (Should be done before the cars for display order) */
|
||||
grInitShadow(elt);
|
||||
/* Skidmarks init */
|
||||
|
|
|
@ -66,8 +66,7 @@ int grGetFilename(const char *filename, const char *filepath, char *buf)
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
GfOut("File %s not found\n", filename);
|
||||
GfOut("File Path was %s\n", filepath);
|
||||
GfError("File %s not found in search path %s\n", filename, filepath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue