/*----------------------------------------------------------------- * @Desc: prepares _and displays_ the current Playground * * NOTE: this function should only change the USERFENSTER part * so that we can do Infoline-setting before this * * @Ret: void * *-----------------------------------------------------------------*/ void ShowPlayground (void) { int i, j; int color, player; int block; int xoffs, yoffs; SDL_Rect dst; SDL_Rect bak; xoffs = Classic_User_Rect.x; yoffs = Classic_User_Rect.y; // SDL_SetColorKey (ne_screen, 0, 0); // SDL_SetClipRect (ne_screen , &User_Rect); SDL_SetClipRect (ne_screen , NULL); // Fill_Rect (User_Rect, to_bg_color); SDL_BlitSurface (takeover_bg_pic, &User_Rect, ne_screen, &User_Rect); PutInfluence (xoffs + DruidStart[YourColor].x, yoffs + DruidStart[YourColor].y); if (AllEnemys[DroidNum].status != OUT) PutEnemy (DroidNum, xoffs + DruidStart[!YourColor].x, yoffs + DruidStart[!YourColor].y); Set_Rect (dst, xoffs + TO_LeftGroundStart.x, yoffs + TO_LeftGroundStart.y, User_Rect.w, User_Rect.h); SDL_BlitSurface (to_blocks, &ToGroundBlocks[GELB_OBEN], ne_screen, &dst); dst.y += TO_GroundRect.h; for (i = 0; i < 12; i++) { SDL_BlitSurface (to_blocks, &ToGroundBlocks[GELB_MITTE], ne_screen, &dst); dst.y += TO_GroundRect.h; } /* for i=1 to 12 */ SDL_BlitSurface (to_blocks, &ToGroundBlocks[GELB_UNTEN], ne_screen, &dst); /* Mittlere Saeule */ Set_Rect (dst, xoffs + TO_LeaderBlockStart.x, yoffs + TO_LeaderBlockStart.y, 0, 0); SDL_BlitSurface (to_blocks, &ToLeaderBlock, ne_screen, &dst); dst.y += TO_LeaderLed.h; for (i = 0; i < 12; i++, dst.y += TO_ColumnRect.h) SDL_BlitSurface (to_blocks, &ToColumnBlock, ne_screen, &dst); /* rechte Saeule */ Set_Rect (dst, xoffs + TO_RightGroundStart.x, yoffs + TO_RightGroundStart.y, 0, 0); SDL_BlitSurface (to_blocks, &ToGroundBlocks[VIOLETT_OBEN], ne_screen, &dst); dst.y += TO_GroundRect.h; for (i = 0; i < 12; i++, dst.y += TO_GroundRect.h) SDL_BlitSurface (to_blocks, &ToGroundBlocks[VIOLETT_MITTE], ne_screen, &dst); SDL_BlitSurface (to_blocks, &ToGroundBlocks[VIOLETT_UNTEN], ne_screen, &dst); /* Fill the Leader-LED with its color */ Set_Rect (dst, xoffs + TO_LeaderLed.x, yoffs + TO_LeaderLed.y, 0, 0); SDL_BlitSurface (to_blocks, &FillBlocks[LeaderColor], ne_screen, &dst); dst.y += TO_FillBlock.h; SDL_BlitSurface (to_blocks, &FillBlocks[LeaderColor], ne_screen, &dst); /* Fill the Display Column with its leds */ for (i = 0; i < NUM_LINES; i++) { Set_Rect (dst, xoffs + TO_ColumnStart.x, yoffs + TO_ColumnStart.y + i*TO_ColumnRect.h, 0, 0); SDL_BlitSurface (to_blocks, &FillBlocks[DisplayColumn[i]], ne_screen, &dst); } /* Show the yellow playground */ for (i = 0; i < NUM_LAYERS - 1; i++) for (j = 0; j < NUM_LINES; j++) { Set_Rect (dst, xoffs + PlaygroundStart[GELB].x + i * TO_ElementRect.w, yoffs + PlaygroundStart[GELB].y + j * TO_ElementRect.h, 0, 0); block = ToPlayground[GELB][i][j] + ActivationMap[GELB][i][j]*TO_BLOCKS; SDL_BlitSurface (to_blocks, &ToGameBlocks[block], ne_screen, &dst); } /* Show the violett playground */ for (i = 0; i < NUM_LAYERS - 1; i++) for (j = 0; j < NUM_LINES; j++) { Set_Rect (dst, xoffs + PlaygroundStart[VIOLETT].x +(NUM_LAYERS-i-2)*TO_ElementRect.w, yoffs + PlaygroundStart[VIOLETT].y + j * TO_ElementRect.h, 0, 0); block = ToPlayground[VIOLETT][i][j]+ (NUM_PHASES+ActivationMap[VIOLETT][i][j])*TO_BLOCKS; SDL_BlitSurface (to_blocks, &ToGameBlocks[block],ne_screen, &dst); } /* Show the capsules left for each player */ for (player = 0; player < 2; player++) { if (player == YOU) color = YourColor; else color = OpponentColor; Set_Rect (dst, xoffs + CurCapsuleStart[color].x, yoffs + CurCapsuleStart[color].y + CapsuleCurRow[color] * TO_CapsuleRect.h, 0,0); if (NumCapsules[player]) SDL_BlitSurface (to_blocks, &CapsuleBlocks[color], ne_screen, &dst); for (i = 0; i < NumCapsules[player]-1; i++) { Set_Rect (dst, xoffs + LeftCapsulesStart[color].x, yoffs + LeftCapsulesStart[color].y + i*TO_CapsuleRect.h, 0, 0); SDL_BlitSurface (to_blocks, &CapsuleBlocks[color], ne_screen, &dst); } /* for capsules */ } /* for player */ SDL_Flip (ne_screen); return; } /* ShowPlayground */
void Assemble_Combat_Picture (int mask) { int MapBrick; int line, col; int i; static float TimeSinceLastFPSUpdate=10; static int FPS_Displayed=1; SDL_Rect TargetRectangle; SDL_Rect TxtRect; finepoint pos, vect; float len; bool vis = TRUE; grob_point upleft, downright; #define UPDATE_FPS_HOW_OFTEN 0.75 DebugPrintf (2, "\nvoid Assemble_Combat_Picture(...): Real function call confirmed."); SDL_SetClipRect (ne_screen , &User_Rect); if ( !GameConfig.AllMapVisible ) Fill_Rect (User_Rect, Black); if ( (mask & SHOW_FULL_MAP) != 0 ) { upleft.x = -5; upleft.y = -5; downright.x = CurLevel->xlen + 5; downright.y = CurLevel->ylen + 5; } else { upleft.x = Me.pos.x - 6; upleft.y = Me.pos.y - 5; downright.x = Me.pos.x + 7; downright.y = Me.pos.y + 5; } for (line = (int)upleft.y; line < (int)downright.y; line++) { for (col = (int)upleft.x; col < (int)downright.x; col++) { vis = TRUE; if ( !GameConfig.AllMapVisible && ( (mask & SHOW_FULL_MAP) == 0x0) ) { pos.x = col; pos.y = line; vect.x = Me.pos.x - pos.x; vect.y = Me.pos.y - pos.y; len = sqrt( vect.x * vect.x + vect.y * vect.y) + 0.01; vect.x /= len; vect.y /= len; if (len > 0.5) { pos.x += vect.x; pos.y += vect.y; } if ( !IsVisible (&pos) ) continue; } MapBrick = GetMapBrick( CurLevel, col , line ); TargetRectangle.x = UserCenter_x + (int)rint( (-Me.pos.x+1.0*col-0.5 )*Block_Rect.w); TargetRectangle.y = UserCenter_y + (int)rint( (-Me.pos.y+1.0*line-0.5 )*Block_Rect.h); SDL_BlitSurface( MapBlockSurfacePointer[CurLevel->color][MapBrick], NULL, ne_screen, &TargetRectangle); } // for(col) } // for(line) // if we don't use Fullscreen mode, we have to clear the text-background manually // for the info-line text: TxtRect.x = Full_User_Rect.x; TxtRect.y = Full_User_Rect.y+Full_User_Rect.h - FontHeight (Font0_BFont); TxtRect.h = FontHeight (Font0_BFont); TxtRect.w = Full_User_Rect.w; SDL_SetClipRect (ne_screen, &TxtRect); if (!GameConfig.FullUserRect) SDL_FillRect(ne_screen, &TxtRect, 0); if ( GameConfig.Draw_Position ) { PrintStringFont( ne_screen , Font0_BFont , Full_User_Rect.x+Full_User_Rect.w/6 , Full_User_Rect.y+Full_User_Rect.h - FontHeight( Font0_BFont ), "GPS: X=%d Y=%d Lev=%d" , (int) rintf(Me.pos.x) , (int) rintf(Me.pos.y) , CurLevel->levelnum ); } if (!(mask & ONLY_SHOW_MAP) ) { if ( GameConfig.Draw_Framerate ) { TimeSinceLastFPSUpdate += Frame_Time(); if ( TimeSinceLastFPSUpdate > UPDATE_FPS_HOW_OFTEN ) { FPS_Displayed=(int)(1.0/Frame_Time()); TimeSinceLastFPSUpdate=0; } PrintStringFont( ne_screen , Font0_BFont , Full_User_Rect.x , Full_User_Rect.y+Full_User_Rect.h - FontHeight( Font0_BFont ), "FPS: %d " , FPS_Displayed ); } if ( GameConfig.Draw_Energy ) { PrintStringFont( ne_screen , Font0_BFont , Full_User_Rect.x+Full_User_Rect.w/2 , Full_User_Rect.y+Full_User_Rect.h - FontHeight( Font0_BFont ), "Energy: %d" , (int)Me.energy); } if (GameConfig.Draw_DeathCount) { PrintStringFont( ne_screen , Font0_BFont , Full_User_Rect.x+2*Full_User_Rect.w/3 , Full_User_Rect.y+Full_User_Rect.h - FontHeight( Font0_BFont ), "Deathcount: %d", (int)DeathCount ); } SDL_SetClipRect (ne_screen, &User_Rect); // make sure Ashes are displayed _before_ droids, so that they are _under_ them! for (i = 0; i < NumEnemys ; i++) if ( (AllEnemys[i].status == TERMINATED) && (AllEnemys[i].levelnum == CurLevel->levelnum) ) { if (IsVisible (&(AllEnemys[i].pos) ) ) PutAshes (AllEnemys[i].pos.x, AllEnemys[i].pos.y); } for (i = 0; i < NumEnemys ; i++) if ( (AllEnemys[i].levelnum != CurLevel->levelnum) || (AllEnemys[i].status == OUT) || (AllEnemys[i].status == TERMINATED) ) continue; else PutEnemy (i , -1 , -1 ); if (Me.energy > 0) PutInfluence ( -1 , -1 ); for (i = 0; i < (MAXBULLETS); i++) if (AllBullets[i].type != OUT) PutBullet (i); for (i = 0; i < (MAXBLASTS); i++) if (AllBlasts[i].type != OUT) PutBlast (i); } // At this point we are done with the drawing procedure // and all that remains to be done is updating the screen. if ( mask & DO_SCREEN_UPDATE ) { SDL_UpdateRect (ne_screen, User_Rect.x, User_Rect.y, User_Rect.w, User_Rect.h); SDL_UpdateRect (ne_screen, TxtRect.x, TxtRect.y, TxtRect.w, TxtRect.h); } SDL_SetClipRect (ne_screen, NULL); return; } // void Assemble_Combat_Picture(...)