Subversion Repositories spk

Rev

Rev 242 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 242 Rev 294
Line 3... Line 3...
3
//////////////////////////////////////////////////////////////////////
3
//////////////////////////////////////////////////////////////////////
4
 
4
 
5
#include "stdafx.h"
5
#include "stdafx.h"
6
#include "LCDDisplay.h"
6
#include "LCDDisplay.h"
7
//#include "LCDCustomScreen.h"
7
//#include "LCDCustomScreen.h"
8
 
-
 
-
 
8
#include "Utils\String.h"
9
//////////////////////////////////////////////////////////////////////
9
//////////////////////////////////////////////////////////////////////
10
// Construction/Destruction
10
// Construction/Destruction
11
//////////////////////////////////////////////////////////////////////
11
//////////////////////////////////////////////////////////////////////
12
 
12
 
13
CLCDDisplay::CLCDDisplay( CEzLcd *lcd, CX3Data *data )
13
CLCDDisplay::CLCDDisplay( CEzLcd *lcd, CX3Data *data )
Line 67... Line 67...
67
	{
67
	{
68
		int x = (40 * (i % 4));
68
		int x = (40 * (i % 4));
69
		int y = 14 + (10 * (i / 4));
69
		int y = 14 + (10 * (i / 4));
70
	    HANDLE shipsText = lcd->AddText(LG_STATIC_TEXT, LG_SMALL, DT_LEFT, 20);
70
	    HANDLE shipsText = lcd->AddText(LG_STATIC_TEXT, LG_SMALL, DT_LEFT, 20);
71
	    lcd->SetOrigin ( shipsText, x, y);
71
	    lcd->SetOrigin ( shipsText, x, y);
72
		lcd->SetText ( shipsText, GetShipClassName(i) );
72
		lcd->SetText ( shipsText, GetShipClassName(i).c_str() );
73
	}
73
	}
74
 
74
 
75
	// class stats varibless
75
	// class stats varibless
76
	for ( i = 0; i < MAXSHIPCLASS; i++ )
76
	for ( i = 0; i < MAXSHIPCLASS; i++ )
77
	{
77
	{
Line 265... Line 265...
265
	m_pLcd->SetText ( m_hGameTime, m_pData->gameTime().c_str() );
265
	m_pLcd->SetText ( m_hGameTime, m_pData->gameTime().c_str() );
266
	m_pLcd->SetText ( m_hInsurance1, Utils::WString::Number(m_pData->GetInsurance()).c_str() );
266
	m_pLcd->SetText ( m_hInsurance1, Utils::WString::Number(m_pData->GetInsurance()).c_str() );
267
 
267
 
268
	// second stats pages (each ship classes)
268
	// second stats pages (each ship classes)
269
    m_pLcd->ModifyControlsOnPage(1);
269
    m_pLcd->ModifyControlsOnPage(1);
270
	m_pLcd->SetText(m_hStatsTitle2, name);
270
	m_pLcd->SetText(m_hStatsTitle2, name.c_str());
271
	for ( i = 0; i < MAXSHIPCLASS; i++ )
271
	for ( i = 0; i < MAXSHIPCLASS; i++ )
272
		m_pLcd->SetText ( m_hClasses[i], Utils::WString::Number(m_pData->GetShipClass(i)).c_str() );
272
		m_pLcd->SetText ( m_hClasses[i], Utils::WString::Number(m_pData->GetShipClass(i)).c_str() );
273
	m_pLcd->SetText ( m_hInsurance2, Utils::WString::Number(m_pData->GetInsurance()).c_str() );
273
	m_pLcd->SetText ( m_hInsurance2, Utils::WString::Number(m_pData->GetInsurance()).c_str() );
274
 
274
 
275
	// first combat page, your current ship)
275
	// first combat page, your current ship)
276
    m_pLcd->ModifyControlsOnPage(2);
276
    m_pLcd->ModifyControlsOnPage(2);
277
	m_pLcd->SetText ( m_hCombatTitle1, m_pData->myShip() );
277
	m_pLcd->SetText ( m_hCombatTitle1, m_pData->myShip().c_str());
278
	m_pLcd->SetProgressBarPosition ( m_hMyHull, (float)m_pData->GetHull());
278
	m_pLcd->SetProgressBarPosition ( m_hMyHull, (float)m_pData->GetHull());
279
	m_pLcd->SetProgressBarPosition ( m_hMyShield, (float)m_pData->GetShields());
279
	m_pLcd->SetProgressBarPosition ( m_hMyShield, (float)m_pData->GetShields());
280
	m_pLcd->SetProgressBarPosition ( m_hMyWeapon, (float)m_pData->GetWeaponEnergy ());
280
	m_pLcd->SetProgressBarPosition ( m_hMyWeapon, (float)m_pData->GetWeaponEnergy ());
281
	m_pLcd->SetText ( m_hMissiles, Utils::WString::Number(m_pData->GetMissiles()).c_str() );
281
	m_pLcd->SetText ( m_hMissiles, Utils::WString::Number(m_pData->GetMissiles()).c_str() );
282
	m_pLcd->SetText ( m_hEnemies, Utils::WString::Number(m_pData->GetEnemies()).c_str() );
282
	m_pLcd->SetText ( m_hEnemies, Utils::WString::Number(m_pData->GetEnemies()).c_str() );
Line 288... Line 288...
288
	if ( !m_pData->targetRelation().empty() )
288
	if ( !m_pData->targetRelation().empty() )
289
	{
289
	{
290
		target += L" / ";
290
		target += L" / ";
291
		target += m_pData->targetRelation();
291
		target += m_pData->targetRelation();
292
	}
292
	}
293
	m_pLcd->SetText ( m_hCombatTitle2, target);
293
	m_pLcd->SetText ( m_hCombatTitle2, target.c_str());
294
	m_pLcd->SetText ( m_hSpeedText1, _T("Speed:") );
294
	m_pLcd->SetText ( m_hSpeedText1, _T("Speed:") );
295
	m_pLcd->SetText ( m_hSpeedText2, _T("Distance:") );
295
	m_pLcd->SetText ( m_hSpeedText2, _T("Distance:") );
296
	Utils::WString speed = Utils::WString::Number(m_pData->GetTargetSpeed()) + L" (" + Utils::WString::Number(m_pData->GetMySpeed()) + L")";
296
	Utils::WString speed = Utils::WString::Number(m_pData->GetTargetSpeed()) + L" (" + Utils::WString::Number(m_pData->GetMySpeed()) + L")";
297
	m_pLcd->SetText ( m_hMySpeed, speed);
297
	m_pLcd->SetText ( m_hMySpeed, speed.c_str());
298
	m_pLcd->SetText ( m_hTargetSpeed, m_pData->GetTargetDistanceStr());
298
	m_pLcd->SetText ( m_hTargetSpeed, m_pData->GetTargetDistanceStr().c_str());
299
	m_pLcd->SetProgressBarPosition ( m_hTargetHull, (float)m_pData->GetTargetHull() );
299
	m_pLcd->SetProgressBarPosition ( m_hTargetHull, (float)m_pData->GetTargetHull() );
300
	m_pLcd->SetProgressBarPosition ( m_hTargetShield, (float)m_pData->GetTargetShield() );
300
	m_pLcd->SetProgressBarPosition ( m_hTargetShield, (float)m_pData->GetTargetShield() );
301
	m_pLcd->SetText ( m_hMissiles2, Utils::WString::Number(m_pData->GetMissiles()).c_str() );
301
	m_pLcd->SetText ( m_hMissiles2, Utils::WString::Number(m_pData->GetMissiles()).c_str() );
302
	m_pLcd->SetText ( m_hEnemies2, Utils::WString::Number(m_pData->GetEnemies()).c_str() );
302
	m_pLcd->SetText ( m_hEnemies2, Utils::WString::Number(m_pData->GetEnemies()).c_str() );
303
 
303
 
Line 319... Line 319...
319
		else if ( pos < 0 )
319
		else if ( pos < 0 )
320
			continue;
320
			continue;
321
		Utils::WString sRep = rep.sRank + L" (" + (long)rep.iRepPct + L"%)";
321
		Utils::WString sRep = rep.sRank + L" (" + (long)rep.iRepPct + L"%)";
322
		if ( rep.bIncludeRace )
322
		if ( rep.bIncludeRace )
323
			sRep = rep.sRace + ": " + sRep;
323
			sRep = rep.sRace + ": " + sRep;
324
		m_pLcd->SetText ( m_hRepText[pos], sRep);
324
		m_pLcd->SetText ( m_hRepText[pos], sRep.c_str());
325
	}
325
	}
326
 
326
 
327
	// wait while data is locked
327
	// wait while data is locked
328
	while ( m_pData->IsLocked() ) Sleep(1);
328
	while ( m_pData->IsLocked() ) Sleep(1);
329
 
329
 
Line 333... Line 333...
333
	Utils::WString page(L"(Page: ");
333
	Utils::WString page(L"(Page: ");
334
	page += (long)(pages + 1);
334
	page += (long)(pages + 1);
335
	page += L"/";
335
	page += L"/";
336
	page += (long)(m_iSplitPage + 1);
336
	page += (long)(m_iSplitPage + 1);
337
	page += L")";
337
	page += L")";
338
	m_pLcd->SetText ( m_hCustomPage, page);
338
	m_pLcd->SetText ( m_hCustomPage, page.c_str());
339
 
339
 
340
	size_t pos = m_iSplitPage * 4;
340
	size_t pos = m_iSplitPage * 4;
341
	const Utils::WStringNode* pCustom = list[pos];
341
	const Utils::WStringNode* pCustom = list[pos];
342
 
342
 
343
	for ( i = 0; i < 4; i++ )
343
	for ( i = 0; i < 4; i++ )
344
	{
344
	{
345
		if ( !pCustom )
345
		if ( !pCustom )
346
			m_pLcd->SetText ( m_hCustomText[i], _T("") );
346
			m_pLcd->SetText ( m_hCustomText[i], _T("") );
347
		else
347
		else
348
		{
348
		{
349
			m_pLcd->SetText ( m_hCustomText[i], pCustom->data);
349
			m_pLcd->SetText ( m_hCustomText[i], pCustom->data.c_str());
350
			pCustom = list[++pos];
350
			pCustom = list[++pos];
351
		}
351
		}
352
	}
352
	}
353
 
353
 
354
    m_pLcd->ModifyControlsOnPage(6);
354
    m_pLcd->ModifyControlsOnPage(6);
355
	m_pLcd->SetText ( m_hMissiles2, Utils::WString::Number(m_pData->GetMissiles()));
355
	m_pLcd->SetText ( m_hMissiles2, Utils::WString::Number(m_pData->GetMissiles()).c_str());
356
	m_pLcd->SetText ( m_hEnemies2, Utils::WString::Number(m_pData->GetEnemies2()));
356
	m_pLcd->SetText ( m_hEnemies2, Utils::WString::Number(m_pData->GetEnemies2()).c_str());
357
 
357
 
358
    m_pLcd->ModifyControlsOnPage(m_iTitlePage);
358
    m_pLcd->ModifyControlsOnPage(m_iTitlePage);
359
	m_pLcd->SetText(m_hMainText, m_pData->GetGameName().tokens(L" ", 2));
359
	m_pLcd->SetText(m_hMainText, m_pData->GetGameName().tokens(L" ", 2).c_str());
360
    m_pLcd->ModifyControlsOnPage(m_iLoadingPage);
360
    m_pLcd->ModifyControlsOnPage(m_iLoadingPage);
361
	m_pLcd->SetText(m_hMainText2, m_pData->GetGameName().tokens(L" ", 2));
361
	m_pLcd->SetText(m_hMainText2, m_pData->GetGameName().tokens(L" ", 2).c_str());
362
 
362
 
363
}
363
}
364
 
364
 
365
int CLCDDisplay::FindMaxRacePages()
365
int CLCDDisplay::FindMaxRacePages()
366
{
366
{