b8  `] .text .rdata :.data@:@.sdata<.sbsspp(.bssHj[theWorld->nTotalModels]++; // map data to actual address GsMapModelingData(theWorld->lObjectPointer[theWorld->nTotalModels]); //initialise the objects coordinate systemto that of the world GsInitCoordinate2(WORLD, &theWorld->gsObjectCoord [theWorld->nTotalModels]); // increment pointer twice theWorld->lObjectPointer[theWorld->nTotalModels]++; theWorld->lObjectPointer[theWorld->nTotalModels]++; //limk the model9tmd0with the player object handler GsLinkObject4((unsigned long *)theWorld->lObjectPointer [theWorld->nTotalModels], &theWorld->gsObjectHandler [theWorld->nTotalModels],0); // set the amount of polygon subdivision that will be done in runtime theWorld->gsObjectHandler[theWorld->nTotalModels].attribute = GsDIV1; //assign thecoordinates of the object model to object handler theWorld->gsObjectHandler[theWorld->nTotalModels].coord2 = &theWorld->gsObjectCoord[theWorld->nTotalModels]; //set the position of the object theWorld->gsObjectCoord[theWorld->nTotalModels].coord.t[0]=nX; //x theWorld->gsObjectCoord[theWorld->nTotalModels].coord.t[1]=nY; //x theWorld->gsObjectCoord[theWorld->nTotalModels].coord.t[2]=nZ; //x //increment the object counter theWorld->nTotalModels++; //flag the object as needing to be drawn theWorld->gsObjectCoord[theWorld->nTotalModels].flg = 0; } // This function associates a model with our player datastructure void AddModelToPlayer(PlayerStructType1 *thePlayer, int nX, int nY, int nZ, unsigned long *lModelAddress) { //increment the pointer to past the model id. (weird huh?) lModelAddress++; LoadTexture(CAR_TEX_MEM_ADDR); // map tmd data to its actual address GsMapModelingData(lModelAddress); // initialise the players coordinate system - set to be that of the //world GsInitCoordinate2(WORLD, &thePlayer->gsObjectCoord); // increment pointer twice more - to point to top of model data // (beats me!) lModelAddress++; lModelAddress++; // link the model (tmd) with the players object handler GsLinkObject4((unsigned long *)lModelAddress, &thePlayer->gsObjectHandler,0); // Assign the coordinates of the object model to the Object Handler thePlayer->gsObjectHandler.coord2 = &thePlayer->gsObjectCoord; // Set the initial position of the object thePlayer->gsObjectCoord.coord.t[0]=nX; // X thePlayer->gsObjectCoord.coord.t[1]=nY; // Y thePlayer->gsObjectCoord.coord.t[2]=nZ; // Z // setting the players gsObjectCoord.flg to 0 indicates it is to be // drawn thePlayer->gsObjectCoord.flg = 0; } // This function deals with setting up matrices needed for rendering // and sends the object to the ordering table so it is drawn void DrawPlayer(PlayerStructType1 *thePlayer, GsOT *othWorld) { MATRIX tmpls, tmplw; GsDOBJ2 *tmpPtr; // Set The Local World/Screen MATRIX GsGetLws(thePlayer->gsObjectHandler.coord2, &tmplw, &tmpls); GsSetLightMatrix(&tmplw); GsSetLsMatrix(&tmpls); tmpPtr = &thePlayer->gsObjectHandler; // Send Object To Ordering Table GsSortObject4( tmpPtr,othWorld,4,//14 - ORDERING_TABLE_LENGTH, (u_long *)getScratchAddr(0)); } void DrawWorld(WorldStructType0 * theWorld, GsOT *othWorld) { MATRIX tmpls,tmplw; int nCurrentModel; for(nCurrentModel = 0; nCurrentModel < theWorld->nTotalModels; nCurrentModel++) { //get local &screen coorinates, forlight calculations GsGetLws(theWorld->gsObjectHandler[nCurrentModel].coord2, &tmp'!įů Ư$ǯÏd! !dTC$(bÏd! !dTC$Ïd! !dTb$Ïď! (!dTd$$! `DÏd! !dTC$d Ïb! @!bC$ď!d! z !(@Ïd! !dTC$Ïd! !dTb$Ïď! (!dTd$$! `DÏd! !dTC$Ïd! !dTb$Ïď! (!dTd$$! `DÏd! !dTb$Ïd!!$ď!dD!(`= !0Ïd!!!D$CÏd!!!Dď!(` ! d$Ï! dDď!(` ! !CÏ,Cď!(` ! !C Ï0Cď!(` ! !C$Ï4CϏÏd$! `Dď!(` ! !C@!''!įů Ư$ǯ(Ïb$!@(ïJ <(ď Ïb$! z !(@(Ïb$!@(ï(Ïb$!@(ïÏb$(ď!(@= !0Ïd$ DÏ0C Ï4C$Ï8C@!''\X!`įdů`0' D!(`+ '0' ! @ '`C$PïPďdŏ$ @02$4§Lď '0'8''!(@J !0`HHÏ8ćPŏ $#c! dDHHÏ:ćPŏ $#c! dDHHÏ<ćPŏ $# c! d DH@!D@H''!į<BÏ!C<"<ByC(`<BC$<#<BC(`<BC$<#<B9!''40!8į<ů@ƯDǯ@F@8Ïb$ ! @<<ÏdDŏ!! `$#!(##dC<<ÏdHŏ!! `$#!(##dC<<ÏdLŏ!! `$#!(##dC<ď '8Ïb$8ď$! @'~ !0`8@!408''!įď$ŏ$$$d$CÏb$ď$ŏ$Ə $Ǐ $ȏ%`@!'' !b0@b0 @$<$<$<ƌ= !8 b0 @@$<$<$<ƌ= !8b0 @ $<$<$ !0@&@b0 @ $<$<$ !0@&<B @ $<$<$ !0@&<B A $<$<$ !0@! ''! į$ů(Ư,ǯ @ @ @ <<$$ŏ(Ə,Ǐ ! ''<8!@į@Ïb$'! @_ !(`—§—§ —§"—§'$ŏݠ ÏC0`(—§*—§,—§.—§'0ŏݠ S ! !!<8@''!<$coord.t[0] +=(currentDirection.vx * nD)/4096; gsObjectCoord->coord.t[1] +=(currentDirection.vy * nD)/4096; gsObjectCoord->coord.t[2] +=(currentDirection.vz * nD)/4096; //set flag gsObjectCoord->flg = 0; } } int SPEED(int Acceleration) { theCar.speed += Acceleration; if (theCar.speed > 140){ theCar.speed += -5; } if (theCar.speed < -60){ theCar.speed += 5; } return theCar.speed; } void RotateModel (GsCOORDINATE2 *gsObjectCoord, SVECTOR *rotateVector,int speed,int nRX, int nRY, int nRZ) { MATRIX matTmp; //reset Player coord system to ID MATRIX if (speed!=0){ ResetMatrix (gsObjectCoord->coord.m); //Add the new rotation factors into players rotation vector //and then set them to the remainder of division by ONE(4096) rotateVector->vx = (rotateVector->vx+nRX)%ONE; rotateVector->vy = (rotateVector->vy+nRY)%ONE; rotateVector->vz = (rotateVector->vz+nRZ)%ONE; //RotMatrix to set up matrix coeffiencients for rotation RotMatrix(rotateVector, &matTmp); //concate the existing objects matrix with the rotation matrix MulMatrix0(&gsObjectCoord->coord, &matTmp, &gsObjectCoord->coord); // set the flag to redraw gsObjectCoord->flg = 0; } } void ResetMatrix (short m[3] [3]) { m[0][0]=m[1][1]=m[2][2]=ONE; m[0][1]=m[0][2]=m[1][0]=m[1][2]=m[2][0]=m[2][1]=0; } void ProcessUserInput() { PADstatus = PadRead(); if(PADstatus & PADselect)PLAYING = 0; if (PADstatus & PADstart){ FntPrint ("PAD start\n"); theCar.gsObjectCoord.coord=GsIDMATRIX; theCar.rotation.vx=0; theCar.rotation.vy=0; theCar.rotation.vz=0; theCar.speed=0; theCar.gsObjectCoord.flg=0; }; if(PADstatus & PADLleft){ RotateModel(&theCar.gsObjectCoord,&theCar.rotation,theCar.speed, 0,-64,0); }; if(PADstatus & PADLright){ RotateModel(&theCar.gsObjectCoord,&theCar.rotation,theCar.speed, 0, 64, 0); }; if(PADstatus & PADRup){ AdvanceModel(&theCar.gsObjectCoord,&theCar.rotation,SPEED(2)); } else if(PADstatus & PADcross){ AdvanceModel(&theCar.gsObjectCoord,&theCar.rotation,SPEED(-2)); } else height %d cam at Z %d000000000000000000000000000000000111000000000000456631100000001511366311100014410111366310015100000111331115100000000133144100000000015441001111100115510014666310115531144111331144366641000146641000000000000000000000000000000 b