D:/Zythum/DinoKod/Mod_Aeternis_Client/A_WinScore.cpp

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : A_WinScore.cpp
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 13/06/2003
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #include "Common/Time.h"
00012 #include "Render/Render.h"
00013 #include "Render/Font.h"
00014 #include "Mod/Mod.h"
00015 #include "Common/LocalizedString.h"
00016 
00017 #include "Mod_Aeternis/A_Team.h"
00018 #include "Mod_Aeternis_Client/A_Interface.h"
00019 #include "Mod_Aeternis_Client/A_ClientGameManager.h"
00020 
00021 #include "Mod_Aeternis_Client/A_WinScore.h"
00022 
00023 //------------------------------------------------------------------------------------------
00024 //------------------------------------------------------------------------------------------
00025 //------------------------------------------------------------------------------------------
00026 KAWinScore::KAWinScore( KWin* pFather, KFPt& Pos, KFPt& Size, KInterface* pInterface )
00027 : KWin( pFather, Pos, Size, pInterface )
00028 {
00029         m_hBackGround = KSHADER_NO;
00030 }
00031 
00032 //------------------------------------------------------------------------------------------
00033 KAWinScore::~KAWinScore()
00034 {
00035 }
00036 
00037 //------------------------------------------------------------------------------------------
00038 void KAWinScore::Display()
00039 {
00040         u8              FadeAlpha = (u8)(255.0f * GetFade());
00041 
00042         u8              FadeBack = (u8)(240.0f * GetFade());
00043         DrawQuad( m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_hBackGround, KRGBA( 255, 255, 255, FadeBack ) );
00044 
00045         // Affiche la liste des joueurs
00046         KAClientPlayer*         pClientPlayer;
00047         u32                                     nTeams[KMAT_COUNT] = { 0 };
00048         KFPt                            PosTeams[KMAT_COUNT];
00049 
00050         PosTeams[KMAT_BLUE]                     = KFPt( 0.22f, 0.25f );
00051         PosTeams[KMAT_RED]                      = KFPt( 0.22f, 0.45f );
00052         PosTeams[KMAT_SPECTATOR]        = KFPt( 0.22f, 0.65f );
00053 
00054         // Affichage des en-tetes
00055         KFPt PosText = PosTeams[KMAT_BLUE] - KFPt( 0.0f, 0.033f ) ;
00056         m_pRender->DrawText( GetIntPoint( PosText ),                                                                            (char*)GETLOCALSTRING(LS_NAME) ,        KRGBA( 0, 0, 190, 255 )) ;
00057         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.175f, 0.0f ) ),      (char*)GETLOCALSTRING(LS_SCORE) ,       KRGBA( 0, 0, 190, 255 )) ;
00058         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.34f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_PING) ,        KRGBA( 0, 0, 190, 255 )) ;
00059         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.45f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_HEALTH) ,      KRGBA( 0, 0, 190, 255 )) ;
00060         PosText = PosTeams[KMAT_RED] - KFPt( 0.0f, 0.033f ) ;
00061         m_pRender->DrawText( GetIntPoint( PosText ),                                                                            (char*)GETLOCALSTRING(LS_NAME) ,        KRGBA( 190, 0, 0, 255 )) ;
00062         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.175f, 0.0f ) ),      (char*)GETLOCALSTRING(LS_SCORE) ,       KRGBA( 190, 0, 0, 255 )) ;
00063         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.34f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_PING) ,        KRGBA( 190, 0, 0, 255 )) ;
00064         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.45f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_HEALTH) ,      KRGBA( 190, 0, 0, 255 )) ;
00065         PosText = PosTeams[KMAT_SPECTATOR] - KFPt( 0.0f, 0.033f ) ;
00066         m_pRender->DrawText( GetIntPoint( PosText ),                                                                            (char*)GETLOCALSTRING(LS_NAME) ,        KRGBA( 255, 255, 255, 255 )) ;
00067         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.175f, 0.0f ) ),      (char*)GETLOCALSTRING(LS_SCORE) ,       KRGBA( 255, 255, 255, 255 )) ;
00068         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.34f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_PING) ,        KRGBA( 255, 255, 255, 255 )) ;
00069         m_pRender->DrawText( GetIntPoint( PosText ) + GetIntPoint( KFPt( 0.45f, 0.0f ) ),       (char*)GETLOCALSTRING(LS_HEALTH) ,      KRGBA( 255, 255, 255, 255 )) ;
00070 
00071 
00072         for( KPlayer* pPlayer = g_pClientGameManager->GetpFirstPlayer(); pPlayer; pPlayer = g_pClientGameManager->GetpNextPlayer( pPlayer ) )
00073         {
00074                 pClientPlayer = (KAClientPlayer*)pPlayer;
00075                 if( pClientPlayer->GetpTeam() )
00076                 {
00077                         KMATEAM Team = pClientPlayer->GetpTeam()->GetTeam();
00078                         KFPt    Pos = PosTeams[Team] + KFPt( 0.0f, 0.02f ) * (float)nTeams[Team];
00079                         m_pRender->DrawText( GetIntPoint( Pos ), pClientPlayer->GetsName() );
00080 
00081                         char    pScore[32];
00082                         sprintf( pScore, "%i", pClientPlayer->GetScore() );
00083                         m_pRender->DrawText( GetIntPoint( Pos ) + GetIntPoint( KFPt( 0.175f, 0.0f ) ), pScore );
00084 
00085                         char    pPing[32];
00086                         sprintf( pPing, "%i", pClientPlayer->GetPing() );
00087                         m_pRender->DrawText( GetIntPoint( Pos ) + GetIntPoint( KFPt( 0.34f, 0.0f ) ), pPing );
00088 
00089                         char    pHealth[32];
00090                         if( pClientPlayer->IsAlive() )
00091                                 sprintf( pHealth, "%i", pClientPlayer->GetHealth() );
00092                         else
00093                                 strcpy( pHealth, "MORT" );
00094                         m_pRender->DrawText( GetIntPoint( Pos ) + GetIntPoint( KFPt( 0.45f, 0.0f ) ), pHealth );
00095 
00096                         nTeams[Team] ++;
00097                 }
00098         }
00099 }
00100 
00101 //------------------------------------------------------------------------------------------
00102 void KAWinScore::Manage()
00103 {
00104 }
00105 
00106 //------------------------------------------------------------------------------------------
00107 void KAWinScore::Load()
00108 {
00109         KWin::Load();
00110 
00111         m_hBackGround = m_pRender->GetpShaderBank()->LoadShader( "GUI/WinScore" );
00112 
00113         if(((KAInterface*)m_pInterface)->GetWin() != KAIW_NONE)
00114                 ((KAInterface*)m_pInterface)->SetWin(KAIW_NONE) ;
00115 }
00116 
00117 //------------------------------------------------------------------------------------------
00118 void KAWinScore::Unload()
00119 {
00120         KWin::Unload();
00121 
00122         m_pRender->GetpShaderBank()->UnloadShader( m_hBackGround );
00123 }

Generated on Sun Mar 25 20:02:14 2007 for Zythum Project by  doxygen 1.5.1-p1