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

📄 miscnm.cpp

📁 <B>DirectX9.0 3D游戏编程</B>
💻 CPP
字号:
/*******************************************************************
 *         Advanced 3D Game Programming using DirectX 9.0
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * copyright (c) 2003 by Peter A Walsh and Adrian Perez
 * See license.txt for modification and distribution information
 ******************************************************************/

#include "stdafx.h"

#include "MiscNM.h"


//==========--------------------------  


cNM_ScoreChange::cNM_ScoreChange( 
	int entID, 
	int newScore )
: m_entID( entID )
, m_newScore( newScore )
{
	LogPrint("cNM_ScoreChange construction: %d score should go to %d",
		m_entID,
		m_newScore );
}

int cNM_ScoreChange::SerializeTo( uchar* pOutput )
{
	int dataSize = 4 + 4; // id, score
	*pOutput++ = 13;
	memcpy( pOutput, &m_entID, dataSize );
	return 1 + dataSize;
}

void cNM_ScoreChange::SerializeFrom( uchar *pFromData, int datasize )
{
	int dataSize = 4 + 4; // id, score
	memcpy( &m_entID, pFromData + 1, dataSize );
}

void cNM_ScoreChange::Exec()
{
	DebPrint("Changing %d's score", m_entID );
	cGamePlayerEnt* pPlayer = (cGamePlayerEnt*)MsgDaemon()->Get( m_entID );

	if( !pPlayer )
	{
		LogPrint("ERROR: score change on bad player %d", m_entID);
		return;
	}

	DebPrint("Changing %d score to %d", m_entID, m_newScore );
	
	pPlayer->SetScore( m_newScore );
}

⌨️ 快捷键说明

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