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

📄 actiontable.h

📁 C人工智能游戏开发的一些实例源代码 C Game development in artificial intelligence source code of some examples
💻 H
字号:
#ifndef ActionTable_H
#define ActionTable_H

//
// This is an optimized version of the ActionTable.
// It uses one multimap rather than nested maps.
//

#pragma warning(disable:4786)
#include <Map>

#define MAX_PATH 80

#define CREATE_KEY(condition, action) (condition << 16) | action


enum EnumAction
{
	kAct_Invalid	= -1,
	kAct_Default	=  0,
	kAct_Idle,
	kAct_Walk,
	kAct_Run,
	kAct_Attack,
};

enum EnumAnimCondition
{
	kACond_Invalid	= -1,
	kACond_Default	=  0,
	kACond_OneHanded,
	kACond_TwoHanded,
	kACond_Bow,
	kACond_Staff,
};

enum EnumActionDescriptor
{
	kADesc_Invalid	= -1,
	kADesc_None		=  0,
	kADesc_Swing,
	kADesc_Jab,
};

// --------------------------------------------------------------------------

struct ActionAnimInfoStruct
{
	char					szAnimFileName[MAX_PATH];
	EnumActionDescriptor	eActionDesc;
};

// --------------------------------------------------------------------------

typedef	std::multimap<unsigned long, ActionAnimInfoStruct> CONDITION_ACTION_MAP;	// <ActionConditionKey, (szAnimFileName, eActionDesc)>

// --------------------------------------------------------------------------

class CActionTable {

public:
	
	void		Read(void);

	const char*	GetAnimation(EnumAnimCondition eAnimCond, EnumAction eAction, EnumActionDescriptor* peActionDesc);

protected:

	CONDITION_ACTION_MAP	m_condActionMap;
};

// --------------------------------------------------------------------------

#endif // ActionTable_H

⌨️ 快捷键说明

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