b8 ( °‡€€€€€þÿüp €.text€€°‰ .rdata°‰€°‰€ °©.dataPŠ€PŠ€ Pª@.sdatap€p€°p­.sbss Ž€ Ž€X.bss€Ž€€Ž€` €World(&WorldOverlay,WORLD_OVERLAY_PRECISION); DrawPlayer(&TheCar); DrawBullet(&TheBullet,WORLD_OVERLAY_PRECISION); // Draw all enemies DrawEnemy(WORLD_OVERLAY_PRECISION); // wait for V_BLANK interrupt VerticalSync=VSync(0); // print the vSync interval FntPrint("VSync Interval: %d.\n",VerticalSync); // force text output to the PSX screen FntFlush(-1); DrawSprite(&sprCrossHairs, 1); // Draw cross hairs at the top priority RenderFinish(); } void ResetToIdentity(GsCOORDINATE2 *Object_Coord) { // reset matrix to the identity matrix Object_Coord->coord.m[0][0]=Object_Coord->coord.m[1][1]= Object_Coord->coord.m[2][2]=ONE; Object_Coord->coord.m[0][1]=Object_Coord->coord.m[0][2]= Object_Coord->coord.m[1][0]=Object_Coord->coord.m[1][2]= Object_Coord->coord.m[2][0]=Object_Coord->coord.m[2][1]=0; } void RotateModelMatrix (GsCOORDINATE2 *Object_Coord,VECTOR *currentRotation, int nRX, int nRY, int nRZ ) { MATRIX matTmp; SVECTOR svRotate; // Reset to the identity matrix ResetToIdentity(Object_Coord); // Use currentRotation as the cummulative direction currentRotation->vx = (currentRotation->vx + nRX) % ONE; currentRotation->vy = (currentRotation->vy + nRY) % ONE; currentRotation->vz = (currentRotation->vz + nRZ) % ONE; // Limit the rotation to be 0 to 90 degrees of inclination if (currentRotation->vx < -15) currentRotation->vx = -15; if (currentRotation->vx > ONE/4) currentRotation->vx = ONE/4; // Now rotate about the Y axis // This is the vector describing the rotation svRotate.vx = 0; svRotate.vy = currentRotation->vy; svRotate.vz = 0; // RotMatrix sets up the matrix coefficients for rotation RotMatrix(&svRotate, &matTmp); // Concatenate the existing objects matrix with the // rotation matrix MulMatrix0(&Object_Coord->coord, &matTmp,&Object_Coord->coord); // Now rotate abou the X axis // This is the vector describing the rotation svRotate.vx = currentRotation->vx; svRotate.vy = 0; svRotate.vz = 0; // RotMatrix sets up the matrix coefficients for rotation RotMatrix(&svRotate, &matTmp); // Concatenate the existing objects matrix with the // rotation matrix MulMatrix0(&Object_Coord->coord, &matTmp,&Object_Coord->coord); Object_Coord->flg = 0; } void AdvanceModel (GsCOORDINATE2 *gsObjectCoord, VECTOR *currentDirection, int nD) { int tmpz,tmpx; if(nD!=0){ // avoid divide by 0 error nD = ONE/nD; gsObjectCoord->coord.t[0] += currentDirection->vx/ nD; gsObjectCoord->coord.t[1] += currentDirection->vy/ nD; gsObjectCoord->coord.t[2] += currentDirection->vz/ nD; gsObjectCoord->flg = 0; SetBoundingBox(TheCar.Range,TheCar.Model.Object_Coord.coord.t[0], TheCar.Model.Object_Coord.coord.t[1], TheCar.Model.Object_Coord.coord.t[2], -205,205,-158,158,-500,500); for (tmpz = ClipZStart; tmpz < ClipZEnd; tmpz++ ) { for (tmpx = ClipXStart; tmpx < ClipXEnd; tmpx++ ){ if(!(WorldOverlay.ModelMap[tmpz][tmpx]=='0')&& (!(WorldOverlay.Model[tmpz][tmpx].Object_Handler.attribute&(1<<31)))&& CollisionDetect(TheCar.Range, WorldOverlay.Range[tmpz][tmpx])){ gsObjectCoord->coord.t[0] -= (currentDirection->vx/ nD)*2;//64; gsObjectCoord->coord.t[1] -= (currentDirection->vy/ nD)*2; gsObjectCoord->coord.t[2] -= (currentDirection->vz/ nD)*2;//64; } } } } } // move the model void MoveModel (GsCOORDINATE2 *Object_Coord, int nX, int nY, int nZ) { Object_Coord->coord.t[0]+=nX; Object_Coord->coord.t[1]+=nY; Object_Coord->coord.t[2]+=nZ; Object_Coord->flg=0; } void ProcessUserInput() { int tmpz,tmpx; static int bR1Down = FALSE; PADstatus=PadRead(); if(PADstatus & PADselect)GameRunning=0; if (Pøÿ½'¾¯!ð į ůƯǯ €„4 €<„ ˜H„4 €<„ S„4 €<„ `U„4 €<„  u„4 €<„ à•„4!èÀ¿¾à½'Àÿ½'<¿¯8¾¯!ð @į@Ãb$Ã'! @_Š !(`—§—§ —§"—§Ä'$ÅÝ  ÃÂC0`(—§*—§,—§.—§Ä'0ÅÝ  S  ! º!!èÀ<¿8¾à@½'Àÿ½'<¿¯8¾¯!ð @įDůHƯLǯDÃb$! @_Š Å'Ãb0$ CC,`$ Cê0À¯$ê4¯$0¯$ê4¯$0¯$ê4¯@Â0Ã&D¬@ÂH×C¤@ÂL×C¤@Â×4Äd@H¤@Â× C¤‡Ç0Ä!(!0@ !8`@à b¤@ÂÇ! `?„$ƒ!!(€€!#dC @ÂÇ! `ÿ„$"!(€"#dC 0Â$ C@ ×C¤@Â"×C¤@Â@Ã@Ä€$… €$d €$C @Â×4Äd@BC¤@ÂÄ—BC¤@Â@Ã$d¤$C¤@ @¬!èÀ<¿8¾à@½'Øÿ½' ¾¯!ð (į,ů0Ư(Ãb$Cï,Ãb$Cï0Ãb$CïÂÃC8ǯÂÄDÇ!ãÃÄd8ǯÇ!GC$ ¯ Âÿ<ÿÿc4*b@ Â! @€!b@ ¯ Â$Object_Handler,OTable_Header,precision,(u_long *)getScratchAddr(0)); } void InitialiseALight(GsF_LIGHT *flLight, int nLight, int nX, int nY, int nZ, int nRed, int nGreen, int nBlue) { // Set the direction in which light travels flLight->vx = nX;flLight->vy = nY; flLight->vz = nZ; // Set the colour flLight->r = nRed; flLight->g = nGreen; flLight->b = nBlue; // Activate light GsSetFlatLight(nLight, flLight); } // this function initialises the graphics system void Initialise3DGraphics() { // Initialise The Graphics System to PAL as opposed to NTSC SetVideoMode(MODE_PAL); // Set the Actual Size of the Video memory GsInitGraph(SCREEN_WIDTH, SCREEN_HEIGHT, GsNONINTER|GsOFSGPU, 1, 0); // Set the Top Left Coordinates Of The Two Buffers in video memory GsDefDispBuff(0, 0, 0, SCREEN_HEIGHT); // Initialise the 3D Graphics... GsInit3D(); // Before we can use the ordering table headers, // we need to... // 1. Set them to the right length OTable_Header[0].length = ORDERING_TABLE_LENGTH; OTable_Header[1].length = ORDERING_TABLE_LENGTH; // 2. Associate them with an actual ordering table OTable_Header[0].org = OTable_Array[0]; OTable_Header[1].org = OTable_Array[1]; // 3. initialise the World Ordering Table Headers and Arrays GsClearOt(0,0,&OTable_Header[0]); GsClearOt(0,0,&OTable_Header[1]); } void InitialiseLights() { InitialiseALight(&LightSource[0], 0, -100, -100, -100, 255,255,255); InitialiseALight(&LightSource[1], 1, 1000, 1000, 1000, 255,255,255); GsSetAmbient(0,0,0); GsSetLightMode(0); } void InitialiseStaticView(GsRVIEW2 *view, int nProjDist, int nRZ, int nVPX, int nVPY, int nVPZ, int nVRX, int nVRY, int nVRZ) { // This is the distance between the eye // and the imaginary projection screen GsSetProjection(nProjDist); // Set the eye position or center of projection view->vpx = nVPX; view->vpy = nVPY; view->vpz = nVPZ; // Set the look at position view->vrx = nVRX; view->vry = nVRY; view->vrz = nVRZ; // Set which way is up view->rz=-nRZ; // Set the origin of the coord system in this case the world view->super = WORLD; //&TheCar.Object_Coord ; // Activate view GsSetRefView2(view); } void InitialiseTrackerView(GsRVIEW2 *view, int nProjDist, int nRZ, int nVPX, int nVPY, int nVPZ, int nVRX, int nVRY, int nVRZ,GsCOORDINATE2 *Object_Coord) { // This is the distance between the eye // and the imaginary projection screen GsSetProjection(nProjDist); // Set the eye position or center of projection view->vpx = nVPX; view->vpy = nVPY; view->vpz = nVPZ; // Set the look at position view->vrx = nVRX; view->vry = nVRY; view->vrz = nVRZ; // Set which way is up view->rz=-nRZ; // Set the origin of the coord system in this case the world view->super = Object_Coord ; // Activate view GsSetRefView2(view); } void InitialiseMaps() {int tmpz,tmpx; for (tmpz = 0; tmpz < GROUNDMAX_Z; tmpz++ ){ for (tmpx = 0; tmpx < GROUNDMAX_X; tmpx++ ){ WorldGround.ModelMap[tmpz][tmpx]=worldGroundData[tmpz][tmpx]; WorldOverlay.ModelMap[tmpz][tmpx]=WorldOverlayData[tmpz][tmpx]; } } } void InitialiseWorld () { int tmpx,tmpz; char c; // initialise world ground maps InitialiseMaps(); // then for each element of the worldGroundData array if we find a 1 // then place an instance of square.tmd at the aåFASTUN FFL"h<”/$P$¨šJ$`åFASTUN FFA"ž<”/$P$©šJ$åffastfunT.fflåFASTUNTFFL"/¨mP$P$¬mP$`åffastrunT.ffxåFASTUNTFFX"m«mP$P$¬mP$€åffastiunT.ffoåFASTUNTFFO"®«mP$P$­mP$”$@åFASTUN0FFX"‘<”/$P$¬mP$€åFASTUN FFO"•<”/$P$­mP$”$@åFASTUN FFL"h<”/$P$¬mP$`åFASTUN FFA"ž<”/$P$­mP$åffastfunT.fflåFASTUNTFFL"´Ë}Me: X=%d,Y=%d,Z=%d Him:X=%d,Y=%d,Z=%d Ratio %dVSync %d333333ã?´@333333ã?´@ffffffæ?´@ffffffæ?´@ffffffæ?´@ffffffæ?´@ggg555555555555ggggggg1555555555g45552155555555g55555g55555555215555g555555555215552153g155555g5yyy2g45215555g5yxy55555g555345yyy55555g55345555555555g55g55555555555g552155555555534555215553gggg4555552ggg4555555555555555555555000000000000000000000000000000000000110000000000002000000000100010000101000000100000002000000100000000000000000000000000000000000002020000200000000000000010000010200000002000000000000000210000000000000001200000000000000000000@ ÿÿÿÿÿÿÿÿp €à¨€@ ÿÿÿÿÿÿÿÿp €à¨€b