b8  `]À€€€ €þÿüàœ€.text€€€ .rdata€€€€ €:.data € €@ :@.sdataà€à€�à<.sbssp€p€(.bss € €Hj€[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Å�$–� €@0À§2À§$4§LÄ�¾· Å'0Â'8Ã'Ä'!(@Jµ !0`HÂ�HÃ�8ćPÅ�… �ÿ„$#cŒ! dD¬HÂ�HÃ�:ćPÅ�… �ÿ„$#cŒ! dD¬HÂ�HÃ�<ćPÅ�… �ÿ„$# cŒ! d D¬HÂ�@¬!èÀD¿�@¾�àH½'øÿ½'¾¯!ð į€<öBŒÃ�!C€<ö"¬€<öBŒyC(`€<öBŒûÿC$€<ö#¬€<öBŒÄÿC(`€<öBŒC$€<ö#¬€<öBŒ9!èÀ¾�à½'Èÿ½'4¿¯0¾¯!ð 8į<ů@ƯDǯ@Â�F@8Ã�b$“ ! @<Â�<Ã�d„DÅ�!…! `�ÿ„$#!(€##dC¤<Â�<Ã�d„HÅ�!…! `�ÿ„$#!(€##dC¤<Â�<Ã�d„LÅ�!…! `�ÿ„$#!(€##dC¤<Ä�¾· Å'8Ã�b$8Ä�ƒ$! @Å'~² !0`8Â�@¬!èÀ4¿�0¾�à8½'øÿ½'¾¯!ð įÂ�Ä�ƒ$Å�¤$$…¤$d¤$C¤Ã�b$Ä�ƒ$Å�¤$Æ� Å$Ç� æ$È�%à¤À¤ ¤€¤`¤@¤!èÀ¾�à½'àÿ½'¿¯¾¯ò !𠀂¯€ƒ�b0@€€¯€ƒ�€b0 @Àÿ$¢¯ ¯€<Èõ„$€<°õ¥$€<öÆŒ= !8€ƒ� b0 @@$¢¯ ¯€<Èõ„$€<°õ¥$€<öÆŒ= !8€ƒ�b0 @ $€<Èõ„$€<°õ¥$Å !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