void StateHighscores::render(SDL_Surface* target) { spClearTarget( COLOUR_BACKGROUND ); int posOffset = spFontWidth( (unsigned char*) Utility::numToStr( file.scores.size() ).c_str(), fontB ); int numEntries = std::min( HIGHS_ENTRIES_ON_SCREEN, (int)file.scores.size() ); int vertOffset = ( APP_SCREEN_HEIGHT + 40 - numEntries * HIGHS_FONT_SIZE ) / 2; int I = drawOffset; for ( HighscoreFile::scoreIter iter = offsetIter; I < drawOffset + numEntries && iter != file.scores.end(); ++iter ) { spFontPointer temp = fontB; if ( I == selOffset ) temp = fontW; int yPos = APP_SCREEN_HEIGHT - vertOffset - ( I - drawOffset + 1 ) * HIGHS_FONT_SIZE; spFontDrawRight( posOffset + 16, yPos, -1, (unsigned char*) (Utility::numToStr( I + 1 ) + "." ).c_str(), temp ); spFontDraw( posOffset + 28, yPos, -1, (unsigned char*) iter->name.c_str(), temp ); spFontDrawRight( APP_SCREEN_WIDTH - 16, yPos, -1, (unsigned char*) Utility::numToStr( iter->score ).c_str(), temp ); ++I; } if ( file.scores.empty() ) { spFontDrawMiddle( APP_SCREEN_WIDTH / 2, APP_SCREEN_HEIGHT / 2, -1, (unsigned char*) "No highscores set yet, go play the game!", fontB ); } else { spFontDrawMiddle( APP_SCREEN_WIDTH / 2, APP_SCREEN_HEIGHT - HIGHS_FONT_SIZE, -1, (unsigned char*) "Press \""SP_BUTTON_B_NAME"\" to load the replay for a score. Press \""SP_BUTTON_START_NAME"\" to exit.", fontHint ); } }
void StateMenu::render(SDL_Surface* target) { spClearTarget( spGetRGB(128,0,0) ); if ( textMode == -1 ) { SDL_SetAlpha( text, SDL_SRCALPHA, (1.0f - (float)textTimer.getTime() / (float)textTimer.getDuration()) * 255.0f ); if ( textTimer.isStopped() ) { textTimer.start( MENU_TEXT_SHOW_TIME ); textMode = 0; SDL_SetAlpha( text, SDL_SRCALPHA, SDL_ALPHA_OPAQUE ); } } else if ( textMode == 0 ) { if ( textTimer.isStopped() ) { textTimer.start( MENU_TEXT_FADE_TIME ); textMode = 1; } } else if ( textMode == 1 ) { SDL_SetAlpha( text, SDL_SRCALPHA, (float)textTimer.getTime() / (float)textTimer.getDuration() * 255.0f ); if ( textTimer.isStopped() ) { ++textIndex; if ( textIndex >= lines.size() ) textIndex = 0; textTimer.start( MENU_TEXT_FADE_TIME ); textMode = -1; SDL_FillRect( text, NULL, spGetRGB( 255, 0, 255 ) ); SDL_SetColorKey( text, SDL_SRCCOLORKEY, spGetRGB( 255, 0, 255 ) ); spSelectRenderTarget( text ); spFontDraw( 20, 10, -1, (unsigned char*) lines[textIndex].first.c_str(), fontDark ); spFontDraw( 20, 10 + MENU_FONT_SIZE, -1, (unsigned char*) lines[textIndex].second.c_str(), fontDark ); spSelectRenderTarget( spGetWindowSurface() ); SDL_SetAlpha( text, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT ); } } SDL_Rect rect = { 0,0,APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT / 2 }; spUnlockRenderTarget(); SDL_BlitSurface( text, NULL, spGetWindowSurface(), &rect ); spLockRenderTarget(); for ( int I = entries.size()-1; I >= 0; --I ) { if ( choice == I ) { spFontDrawRight( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT - MENU_FONT_SIZE * (I+1), -1, (unsigned char*) entries[I].name.c_str(), fontBright ); } else { spFontDrawRight( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT - MENU_FONT_SIZE * (I+1), -1, (unsigned char*) entries[I].name.c_str(), fontDark ); } } }
void help_draw(void) { spClearTarget(LL_BG); const int B1 = spMax(spGetSizeFactor()>>16,1); const int B2 = spMax(spGetSizeFactor()>>15,1); spFontDrawMiddle( spGetWindowSurface()->w/2, 2, 0, "How to Play", help_font ); int h = spGetWindowSurface()->h - 4 - 4*help_font->maxheight; spFontDrawTextBlock(left,2+spGetWindowSurface()->w/6,2*help_font->maxheight+2, 0,help_block,h,help_scroll,help_font); if (help_scroll != SP_ONE) { const char button_text[] = "[v]"; help_button[2].w = spFontWidth( button_text, help_font ); help_button[2].h = help_font->maxheight; help_button[2].x = 2+spGetWindowSurface()->w*5/6; help_button[2].y = spGetWindowSurface()->h-2-2*help_font->maxheight; int width = help_button[2].w; int height = help_font->maxheight; draw_edgy_rectangle(help_button[2].x,help_button[2].y,&width,&height,B1,B2); spFontDraw( help_button[2].x, help_button[2].y, 0, button_text, help_font ); } else { help_button[2].x = -1; help_button[2].y = -1; help_button[2].w = -1; help_button[2].h = -1; } if (help_scroll != 0) { const char button_text[] = "[^]"; help_button[1].w = spFontWidth( button_text, help_font ); help_button[1].h = help_font->maxheight; help_button[1].x = 2+spGetWindowSurface()->w*5/6; help_button[1].y = 2+ help_font->maxheight; int width = help_button[1].w; int height = help_font->maxheight; draw_edgy_rectangle(help_button[1].x,help_button[1].y,&width,&height,B1,B2); spFontDraw( help_button[1].x, help_button[1].y, 0, button_text, help_font ); } else { help_button[1].x = -1; help_button[1].y = -1; help_button[1].w = -1; help_button[1].h = -1; } const char button_text[] = "{jump}Okay"; help_button[0].w = spFontWidth( button_text, help_font ); help_button[0].h = help_font->maxheight; help_button[0].x = spGetWindowSurface()->w/2 - help_button[0].w/2; help_button[0].y = spGetWindowSurface()->h-B2*2-help_font->maxheight; int width = help_button[0].w; int height = help_font->maxheight; draw_edgy_rectangle(help_button[0].x,help_button[0].y,&width,&height,B1,B2); spFontDraw( help_button[0].x, help_button[0].y, 0, button_text, help_font ); spFlip(); }
void draw_function( void ) { spClearTarget( 0 ); char buffer[256]; sprintf(buffer,"FPS: %i",spGetFPS()); spFontDrawRight( spGetWindowSurface()->w-1, spGetWindowSurface()->h-font->maxheight, -1, buffer, font ); spFlip(); }
void draw_splash(void) { spClearTarget(0); spResetZBuffer(); spIdentity(); spTranslate(0,0,-3<<SP_ACCURACY); spSetZTest(0); spSetZSet(0); spMesh3D( sparrow_mesh, 1 ); spMesh3D( logo_mesh, 1 ); spFlip(); }
void DebugStage::Render() { Bullet* b; spClearTarget( spGetRGB(0, 0, 0) ); TestShip->Render(); for( int i = 0; i < Bullets.size(); i++ ) { Bullets.at( i )->Render(); } }
void TransitionFadeIn::Render() { SDL_Surface* b = spGetWindowSurface(); SDL_Surface* t = spUniqueCopySurface( b ); // Fade from colour spClearTarget( SourceColour ); // Buffer the next stages screen spSelectRenderTarget( t ); Target->Render(); spSelectRenderTarget( b ); // Alpha it to the actual screen spSetHorizontalOrigin( SP_LEFT ); spSetVerticalOrigin( SP_TOP ); spSetBlending( Alpha ); spBlitSurface( 0, 0, -1, t ); spSetBlending( SP_ONE ); spDeleteSurface( t ); }
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 loadInformation(char* information) { spClearTarget(0); spFontDrawMiddle(screen->w/2,screen->h/2,0,information,font); spFlip(); }
void draw_function( void ) { //Cleaning the target (in this case the screen surface) with 0 (black). //In this case I don't clean the zBuffer, because I don't use it. ;-) //But you ARE able to use it, if you want! spResetZBuffer(); spClearTarget( 34567 ); //Set the origin: switch ( ( rotation >> 17 ) % 9 ) { case 0: spSetHorizontalOrigin( SP_CENTER ); spSetVerticalOrigin( SP_CENTER ); break; case 1: spSetHorizontalOrigin( SP_LEFT ); spSetVerticalOrigin( SP_CENTER ); break; case 2: spSetHorizontalOrigin( SP_LEFT ); spSetVerticalOrigin( SP_TOP ); break; case 3: spSetHorizontalOrigin( SP_CENTER ); spSetVerticalOrigin( SP_TOP ); break; case 4: spSetHorizontalOrigin( SP_RIGHT ); spSetVerticalOrigin( SP_TOP ); break; case 5: spSetHorizontalOrigin( SP_RIGHT ); spSetVerticalOrigin( SP_CENTER ); break; case 6: spSetHorizontalOrigin( SP_RIGHT ); spSetVerticalOrigin( SP_BOTTOM ); break; case 7: spSetHorizontalOrigin( SP_CENTER ); spSetVerticalOrigin( SP_BOTTOM ); break; case 8: spSetHorizontalOrigin( SP_LEFT ); spSetVerticalOrigin( SP_BOTTOM ); break; } //Drawing the sprite in the middle of the screen spDrawSprite( screen->w / 2, screen->h / 2, -1, sprite ); spDrawSprite( screen->w - 1, screen->h - 1, -1, sprite ); spDrawSprite( screen->w - 1, 0, -1, sprite ); spDrawSprite( 0, screen->h - 1, -1, sprite ); spDrawSprite( 0, 0, -1, sprite ); //mark the center //spEllipseBorder( screen->w / 2, screen->h / 2, -100, 60+spSin(rotation/2)/1000, 60+spCos(rotation/3)/1000, 20+spCos(rotation/7)/10000, 20+spSin(rotation/5)/10000, 0 ); spEllipseBorder( screen->w / 2, screen->h / 2, -100, 6, 6, 2, 2, 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 TitleStage::Render() { spClearTarget( spGetRGB(0, 0, 24) ); }
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 ); }