void draw_function(void) { //Reseting Z Buffer to the maximal negative value spResetZBuffer(); //Cleaning the target (in this case the screen surface) with 0 (black). spClearTarget(0); //Reseting the ModelViewMatrix to an identity matrix. spIdentity(); //Binding the texture spBindTexture(texture); //Going to the "position" -8.0f spTranslate(0,0,-8<<SP_ACCURACY); //rotation aorund every axis spRotateX(rotation); spRotateY(rotation); spRotateZ(rotation); spRotateX(SP_PI/8); //Drawing the mesh and no update of the edgelist spMesh3D(mesh,0); //Show it! spFlip(); }
void draw_target(int rotation) { SDL_Surface* screen = spGetWindowSurface(); //drawing on the target_texture spSelectRenderTarget(target_texture); spClearTarget(65535); spSetZSet(0); spSetZTest(0); target_sprite->rotation = 0; spDrawSprite( target_texture->w / 4, target_texture->h / 4, 0, target_sprite ); target_sprite->zoomX = spSin( rotation * 8 ) + spFloatToFixed( 1.5f ); target_sprite->zoomY = spCos( rotation * 6 ) + spFloatToFixed( 1.5f ); spDrawSprite( 3 * target_texture->w / 4, target_texture->h / 4, 0, target_sprite ); target_sprite->rotation = rotation * 4; spDrawSprite( target_texture->w / 4, 3 * target_texture->h / 4, 0, target_sprite ); target_sprite->zoomX = SP_ONE; target_sprite->zoomY = SP_ONE; spDrawSprite( 3 * target_texture->w / 4, 3 * target_texture->h / 4, 0, target_sprite ); //drawing on the target_graph spSelectRenderTarget(target_graph); spClearTarget(01234); spSetZSet(0); spSetZTest(0); Uint16* pixeldata = spGetTargetPixel(); int x; for (x = 0;x < GRAPH_SIZE; x++) { Sint32 sx = spIntToFixed(x-GRAPH_SIZE/2)/16; Sint32 sy = spSin(sx+rotation*16); int y = spFixedToInt(sy*16)+GRAPH_SIZE/2; if (y>=0 && y<GRAPH_SIZE) pixeldata[y*GRAPH_SIZE+x] = 56789; sy = spCos(sx+rotation*32); y = spFixedToInt(sy*16)+GRAPH_SIZE/2; if (y>=0 && y<GRAPH_SIZE) pixeldata[y*GRAPH_SIZE+x] = 45678; } spUnlockRenderTarget(); for (x = 0;x < GRAPH_SIZE-1; x++) { Sint32 sx1 = spIntToFixed(x-GRAPH_SIZE/2)/16; Sint32 sy1 = spTan(sx1+rotation*8); int y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2; Sint32 sx2 = spIntToFixed(x+1-GRAPH_SIZE/2)/16; Sint32 sy2 = spTan(sx2+rotation*8); int y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2; spLine(x,y1,0,x+1,y2,0,34567); sy1 = spAcos(sx1/2+spSin(rotation*24)); y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2; sy2 = spAcos(sx2/2+spSin(rotation*24)); y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2; spLine(x,y1,0,x+1,y2,0,23456); sy1 = spAsin(sx1/2+spCos(rotation*24)); y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2; sy2 = spAsin(sx2/2+spCos(rotation*24)); y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2; spLine(x,y1,0,x+1,y2,0,12345); } //drawing on the screen spSelectRenderTarget(screen); spClearTarget(0); spSetZSet(1); spSetZTest(1); spResetZBuffer(); spIdentity(); spTranslate( 0,0, spFloatToFixed( -7.0f ) ); spRotateX( rotation ); spRotateY( rotation ); spRotateZ( rotation ); //Front / Back spBindTexture(target_texture); spQuadTex3D( -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_texture->h - 1, -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, 0, spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_texture->w - 1, 0, spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_texture->w - 1, target_texture->h - 1, 65535); spQuadTex3D( spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, target_texture->h - 1, spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0, -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_texture->w - 1, 0, -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_texture->w - 1, target_texture->h - 1, 65535 ); //Left / Right spBindTexture(target_graph); spQuadTex3D( -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_graph->h - 1, -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0, -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_graph->w - 1, 0, -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_graph->w - 1, target_graph->h - 1, 65535 ); spQuadTex3D( spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_graph->h - 1, spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0, spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_graph->w - 1, 0, spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_graph->w - 1, target_graph->h - 1, 65535 ); //Up / Down spBindTexture(target_garfield); spQuadTex3D( spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_garfield->h - 1, spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0, -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_garfield->w - 1, 0, -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_garfield->w - 1, target_garfield->h - 1, 65535 ); spQuadTex3D( -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_garfield->h - 1, -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0, spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_garfield->w - 1, 0, spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_garfield->w - 1, target_garfield->h - 1, 65535 ); }
void DebugStage::Render() { int elevation = 24; spResetZBuffer(); spIdentity(); spClearTarget(SDL_MapRGB( display->format, 190, 190, 220 )); spSetLight(1); spSetCulling(1); spSetZSet(1); spSetZTest(1); spSetAlphaTest(1); Sint32 brightness = 65535; // (spCos(rotation+a*SP_PI/8)>>SP_HALF_ACCURACY)*abs(spCos(rotation+a*SP_PI/8)>>SP_HALF_ACCURACY)/2+(3<<SP_ACCURACY-1); Uint16 color = 0x8410; // 0xFFFF; // ((brightness>>SP_ACCURACY-4)<<11)+((brightness>>SP_ACCURACY-5)<<5)+(brightness>>SP_ACCURACY-4); spTranslate(0,-6<<SP_ACCURACY,-24<<SP_ACCURACY); spRotateX(rotation); for( int a = 0; a < 64; a++ ) { spRotateX(SP_PI/32); if( ((rotation / (SP_PI/32)) + a) % 64 > 32 ) { int yA, yB; ////////////////////////////////////////// Left OffRoad yA = -15; // + LeftWall[a+1]; yB = -15 + LeftWall[a]; if( yA > yB ) { int yT = yB; yB = yA; yA = yT; } elevation = 25; spBindTexture(roadsideTexture); if( ((rotation / (SP_PI/32)) + a) % 64 > 56 ) { spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } yA = -15 + LeftWall[(a+1) % 64] + 1; if( LeftWall[a+1] != LeftWall[a] ) { spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } spQuadTex3D(((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); yA = -15; // + LeftWall[a+1]; spBindTexture(offroadTexture); spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); ////////////////////////////////////////// Right OffRoad yA = 15 - RightWall[a]; yB = 15; if( yA > yB ) { int yT = yB; yB = yA; yA = yT; } elevation = 25; spBindTexture(roadsideTexture); if( ((rotation / (SP_PI/32)) + a) % 64 > 56 ) { spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } yB = 15 - RightWall[(a+1) % 64] - 1; if( RightWall[a+1] != RightWall[a] ) { spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,roadsideTexture->h-SP_FONT_EXTRASPACE-1, ((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadsideTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); yB = 15; // + LeftWall[a+1]; spBindTexture(offroadTexture); spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); // Draw Road yA = -14 + LeftWall[a]; yB = 14 - RightWall[a]; spBindTexture(roadTexture); elevation = 24; spQuadTex3D(((4*yA)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*yA)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,roadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadTexture->w-SP_FONT_EXTRASPACE-1,roadTexture->h-SP_FONT_EXTRASPACE-1, ((4*yB)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,roadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); /* for( int y = -15; y <= 15; y++ ) { if( y <= -15 + LeftWall[a] || y >= 15 - RightWall[a] ) { elevation = 25; //if( ((rotation / (SP_PI/32)) + a) % 64 == 60 && y == carPos ) // spBindTexture(carTexture); //else spBindTexture(roadsideTexture); if( ((rotation / (SP_PI/32)) + a) % 64 > 56 ) { spQuadTex3D(((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } if( y == -15 + LeftWall[a] || y == 15 - RightWall[a] ) { if( (y == -15 + LeftWall[a] && LeftWall[a] > LeftWall[a+1]) || (y == 15 - RightWall[a] && RightWall[a] > RightWall[a+1]) ) { spQuadTex3D(((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } spQuadTex3D(((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); spQuadTex3D(((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, (elevation-1)<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } spBindTexture(offroadTexture); spQuadTex3D(((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } else { //if( ((rotation / (SP_PI/32)) + a) % 64 == 60 && y == carPos ) // spBindTexture(carTexture); //else spBindTexture(roadTexture); elevation = 24; spQuadTex3D(((4*y)-2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,SP_FONT_EXTRASPACE,SP_FONT_EXTRASPACE, ((4*y)-2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,-3<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,offroadTexture->h-SP_FONT_EXTRASPACE-1, ((4*y)+2)<<SP_ACCURACY-2,+2<<SP_ACCURACY-2, elevation<<SP_ACCURACY-1,offroadTexture->w-SP_FONT_EXTRASPACE-1,SP_FONT_EXTRASPACE,color); } } */ } } spIdentity(); spBindTexture(carTexture); spTranslate( carGfxAt, -3<<SP_ACCURACY, -12<<SP_ACCURACY ); spRotateY( (SP_PI/8)*12 ); spRotateZ( (SP_PI/16)*26 ); if( crashed != 0 ) { spRotateX( (SP_PI/16)*(crashTick < 6 ? crashTick : 6) ); spRotateY( (SP_PI/16)*crashTick ); spRotateZ( (SP_PI/16)*crashTick ); char crashText[80]; int crashYAdj; if( crashHiScore >= 0 ) { sprintf((char*)&crashText, "Well Done\nNew High Score\nRank %d", (crashHiScore+1) ); crashYAdj = (int)((double)fontHiSHnd->maxheight * 1.5); } else { sprintf((char*)&crashText, "Game Over" ); crashYAdj = (int)(fontHiSHnd->maxheight / 2); } spSetZSet( 0 ); spSetZTest( 0 ); spFontDrawMiddle( (gameSettings->ScreenWidth / 2) + 4, (gameSettings->ScreenHeight / 2) + 4 - crashYAdj, -1, (char*)&crashText, fontHiSHnd ); spFontDrawMiddle( (gameSettings->ScreenWidth / 2), (gameSettings->ScreenHeight / 2) - crashYAdj, -1, (char*)&crashText, fontHiHnd ); spSetZSet( 1 ); spSetZTest( 1 ); } else if( carGfxTo > carGfxAt ) { spRotateY( -(SP_PI/16) ); } else if( carGfxTo < carGfxAt ) { spRotateY( (SP_PI/16) ); } spMesh3D( carMesh, 0 ); char scoreText[15]; sprintf((char*)&scoreText, "Score: %d", (int)(score > 9999999 ? 9999999 : score) ); spFontDraw( 10, 10, -1, (char*)&scoreText, fontHnd ); }