⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monsterguagedlg.cpp

📁 墨香最新私服
💻 CPP
字号:
// MonsterGuageDlg.cpp: implementation of the CMonsterGuageDlg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MonsterGuageDlg.h"
#include "ObjectGuagen.h"
#include "WindowIDEnum.h"
#include "./Interface/cStatic.h"
#include "Monster.h"
#include "GameResourceStruct.h"
#include "CheatMsgParser.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMonsterGuageDlg::CMonsterGuageDlg()
{
	m_pName = NULL;
	m_pLifeText = NULL;
	m_pLifeGuage = NULL;
	m_pShieldText = NULL;
	m_pShieldGuage = NULL;
	m_type = WT_MONSTERGUAGEDLG;
}

CMonsterGuageDlg::~CMonsterGuageDlg()
{
	m_pCurMonster = NULL;
}

void CMonsterGuageDlg::Linking()
{
	m_pName			= (cStatic *)GetWindowForID(CG_MONSTERGUAGENAME);
	m_pLifeText		= (cStatic *)GetWindowForID(CG_MONSTERGUAGELIFETEXT);
	m_pLifeGuage	= (CObjectGuagen *)GetWindowForID(CG_MONSTERGUAGELIFE);
//	m_pShieldText	= (cStatic *)GetWindowForID(CG_MONSTERGUAGELIFETEXT);
	m_pShieldGuage	= (CObjectGuagen *)GetWindowForID(CG_MONSTERGUAGESHIELD);
}

void CMonsterGuageDlg::SetMonsterName( char * szMonsterName )
{
	if( m_pName )
	m_pName->SetStaticText(szMonsterName);

	m_pCurMonster = NULL;
	m_pLifeGuage->SetValue(0,0);
	m_pShieldGuage->SetValue(0,0);
}


void CMonsterGuageDlg::SetMonsterLife( CMonster * pMonster )
{
	if( pMonster->GetSInfo() )
		SetMonsterLife( pMonster->GetLife(), pMonster->GetSInfo()->Life, 0 );

	m_pCurMonster = pMonster;
}
void CMonsterGuageDlg::SetMonsterLife( DWORD curVal, DWORD maxVal, int type )
{
	ASSERT(maxVal>0);
	if(maxVal == 0)
		maxVal = 1;

	char szValue[50];

	//GuageOverCheck
	if(curVal > maxVal)
		curVal = maxVal;
	sprintf( szValue, "%d / %d", curVal, maxVal );

#ifdef _CHEATENABLE_		
	if( m_pLifeText )
	{
		if(CHEATMGR->IsCheatEnable())
			m_pLifeText->SetStaticText(szValue);
	}
#endif
	if( m_pLifeGuage )
	{
		if(type == 0)
			m_pLifeGuage->SetValue((float)curVal/(float)maxVal, 0);
		else
			m_pLifeGuage->SetValue((float)curVal/(float)maxVal, (1500/maxVal)*curVal);
	}
}

void CMonsterGuageDlg::SetMonsterShield( CMonster * pMonster )
{
	if( pMonster->GetSInfo() )
		SetMonsterShield( pMonster->GetShield(), pMonster->GetSInfo()->Shield, 0 );

	m_pCurMonster = pMonster;
}


void CMonsterGuageDlg::SetMonsterShield( DWORD curVal, DWORD maxVal, int type )
{
	ASSERT(maxVal>0);
	if(maxVal == 0)
		maxVal = 1;

	char szValue[50];

	//GuageOverCheck
	if(curVal > maxVal)
		curVal = maxVal;
	sprintf( szValue, "%d / %d", curVal, maxVal );

#ifdef _CHEATENABLE_
	if( m_pShieldText )
	{
		if(CHEATMGR->IsCheatEnable())
			m_pShieldText->SetStaticText(szValue);
	}
#endif

	if( m_pShieldGuage )
	{
		if(type == 0)
			m_pShieldGuage->SetValue((float)curVal/(float)maxVal, 0);
		else
			m_pShieldGuage->SetValue((float)curVal/(float)maxVal, (1500/maxVal)*curVal);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -