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

📄 character.h

📁 《光线引擎演示程序》执行程序+源代码,《光线引擎演示程序》执行程序+源代码
💻 H
字号:


#include "main.h"


// 帧和动作的最大值
#define MAX_FRAME     8
#define MAX_SEQUENCE  8

// 演员姓名最大值
#define MAX_NAME      16

// Changed the speed from 300 because of the frame interval change in CalculateFrameRate()
#define kSpeed	200.0f		
// We need to have a gravity and jump acceleration for our simple physics
#define kGravity   9.8f
//const float kJumpAcceleration = 4;
#define kJumpAcceleration   2.7



// 演员结构
typedef struct player_s
{
	char   name[MAX_NAME]; // 姓名
	//role_t rold;           // 角色
	int    life;           // 生命
	int    state;          // 状态
	int    x, y;           // 位置
	int    level;          // 级别
	int    score;          // 得分
	int    experience;     // 经验
	int    sequence;       // 当前动作
	int    frame;          // 当前帧
	int    nexttime;       // 显示最后一帧的时间

	int    upper;          // 上部动作
	int    lower;          // 下部动作

	LightModelMD3 *md3;
	LightModelMD3 *boss;
	LightSound *step[4]; // 脚步声
	LightSound *m4a1[4]; // M4 枪声
	LightSound *biggun;  // 大枪声
	LightSound *hit;     // 攻击声
	LightSound *sjump;    // 跳起声
	int    shoot;     // 处理射击状态的标志
	int    shoottime; // 上次射击的时间
	int    steptime;  // 上次脚步声响的时间	
	vec3_t pos;
	vec3_t eyes;
	vec3_t up;
	vec3_t rotate;
	vec3_t direction;
	int mouse_speed;
	int forward, right, move, jump;
	int lastforward, lastright;
	int jumptime;
	float viewline;
	float velocity; // 速度
	int lasttime;   // 时间

} player_t;


// 动作结构
typedef struct seq_s
{
	int     sound;            // 声音
	int     hit;              // 攻击力
} seq_t;


// 角色类
class Character
{

public:

	// 读取角色资源
	int Load();

	// 更新角色状态
	int Update();

	// 渲染角色
	void Render();

	// 渲染角色阴影
	void RenderShadow();

	// 释放角色资源
	int Unload();

	player_t   player;

	vec3_t rotate;
	// This is our velocity vector that is added to our camera position for gravity/jumping
	CVector3 g_vVelocity;
	// Our global float that stores the elapsed time between the current and last frame
	double g_FrameInterval;
	
	LightEngine *engine;
	LightCamera *camera;	
};

⌨️ 快捷键说明

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