home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 July & August / PCWorld_2006-07-08_cd.bin / temacd / planearcade / planearcade.exe / Tank3.bmp / score.cpp < prev    next >
C/C++ Source or Header  |  2004-05-08  |  2KB  |  98 lines

  1.  
  2. #include "main.h"
  3.  
  4. //-----------
  5. //Globals
  6. //-----------
  7. SCORE Score;
  8.  
  9.  
  10. //inicializacia
  11. //-------------------------------------------------------------
  12. void SCORE::Initialize()
  13. {
  14.     Panel.Create(64,32,10);
  15.     Panel.AddFrame("menu/score/10.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  16.     Panel.AddFrame("menu/score/20.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  17.     Panel.AddFrame("menu/score/30.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  18.     Panel.AddFrame("menu/score/40.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  19.     Panel.AddFrame("menu/score/50.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  20.     Panel.AddFrame("menu/score/60.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  21.     Panel.AddFrame("menu/score/70.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  22.     Panel.AddFrame("menu/score/80.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  23.     Panel.AddFrame("menu/score/90.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  24.     Panel.AddFrame("menu/score/100.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
  25.  
  26.     Reset();
  27. }
  28.  
  29. //reset
  30. //-------------------------------------------------------------
  31. void SCORE::Reset()
  32. {
  33.  
  34.     for (int i=0;i<Score_Max_Captions;i++)
  35.     {
  36.         Caption[i].Active = false;
  37.         Caption[i].Time = 0.0f;
  38.     }
  39.  
  40. }
  41.  
  42. //refresh
  43. //-------------------------------------------------------------
  44. void SCORE::Refresh()
  45. {
  46.  
  47.     for (int i=0;i<Score_Max_Captions;i++)
  48.     {
  49.         if(Caption[i].Active == false)
  50.             continue;
  51.  
  52.         //process
  53.         Caption[i].Pos.Y += Power(1.0f);
  54.  
  55.         //render
  56.         VECTOR3D ScreenPos = Project(Caption[i].Pos);
  57.  
  58.         Engine.SetBlendTrans();
  59.             Panel.Color.A = 1.0f - (Caption[i].Time/Score_Time);
  60.             Panel.Pos = ScreenPos;
  61.             Panel.Frame = ((float)Caption[i].Value) - 1.0f;
  62.             Panel.Render();
  63.         Engine.SetBlendNone();
  64.  
  65.         //time
  66.         Caption[i].Time += PowerTime(1.0f);
  67.         if (Caption[i].Time > Score_Time)
  68.         {
  69.             Caption[i].Time = 0.0f;
  70.             Caption[i].Active = false;
  71.         }
  72.         
  73.     }
  74. }
  75.  
  76. //pridaj napis
  77. //-------------------------------------------------------------
  78. void SCORE::DrawScore(int Value, VECTOR3D Pos)
  79. {
  80.  
  81.     for (int i=0;i<Score_Max_Captions;i++)
  82.     {
  83.         if(Caption[i].Active == true)
  84.             continue;
  85.  
  86.         //time
  87.         Caption[i].Time = 0.0f;
  88.         Caption[i].Value = Value/100;
  89.         Caption[i].Pos = Pos;
  90.         Caption[i].Active = true;
  91.  
  92.         break;
  93.  
  94.     }
  95. }
  96.  
  97. //
  98. //-------------------------------------------------------------