sensory.h

来自「2002年」· C头文件 代码 · 共 145 行

H
145
字号
#ifndef __SENSORY_H__
#define __SENSORY_H__


#include "serverparam.h"
#include "clientparam.h"
#include "types.h"
#include "smp_datastruct.h"
#include "parsevisual.h"
#include "parsesound.h"
#include "parseparam.h"

class SenseBodyInfo{
public:
	Time time;
	
	float stamina;
	float effort;
	float speed;
	AngleDeg rel_spd_angle;
	AngleDeg head_angle;
	VIEWWIDTH view_width;
	VIEWQUALITY view_qual;
	
	int kicks;
	int dashes;
	int turns;
	int says;
	int turn_necks;
	void setvalues(VIEWWIDTH viewidth, VIEWQUALITY viewqual, float stamina,float effort,float speed,AngleDeg rel_spd_angle,AngleDeg head_angle,int kicks,
		int dashes,int turns,int says,int turn_necks,Time time){
		view_width = viewidth;
		view_qual = viewqual;
		this->stamina    = stamina;
		this->effort     = effort;
		this->speed      = speed;
		this->rel_spd_angle= rel_spd_angle;
		this->head_angle = head_angle;
		this->kicks      = kicks;
		this->dashes     = dashes;
		this->says       = says;
		this->turn_necks = turn_necks;
		this->turns      = turns;
		this->time       = time;
	}
	////////////////////V8
	int ArmMoveable;
	int ArmExpires;
	Vector ArmTarget;
	int Arms;
	int Focus;
	int Focuses;
	int TackleExpire;
	int Tackles;
	
	void setvalues(
		int ArmMoveable,
		int ArmExpires,
		Vector ArmTarget,
		int Arms,
		int Focus,
		int Focuses,
		int TackleExpire,
		int Tackles
		){
		this->ArmMoveable = ArmMoveable;
		this->ArmExpires = ArmExpires;
		this->ArmTarget = ArmTarget;
		this->Arms = Arms;
		this->Focus =  Focus;
		this->Focuses =  Focuses;
		this->TackleExpire = TackleExpire;
		this->Tackles = Tackles;
	}
};



class Player;
class Sensory : public ParseVisualV8 , 				
				public ParseParamV8,
				public ParseSoundV8{
private:
/********	SenseBodyInfo	********************/
	int latestsenseinfo;
	SenseBodyInfo sensebodyinfo[2]; /* store latest two sense infomation*/
	Time dir_time;
	
	void IdentifyUnkPlayers(Time t);
	bool AppointUnkPlayer(Player* mp, VisualUnkPlayer* p);

/* -Parse----All Kinds of Messages - */	
	void Parse_Sense(Time time,char* SensoryInfo);
protected:
	VIEWWIDTH desire_viewidth;
	VIEWQUALITY desire_quality;
	void Make_ViewModeDecision();
public:
	void SetDesireView(VIEWWIDTH width, VIEWQUALITY quality);
	void change_view(VIEWWIDTH width, VIEWQUALITY quality);
public:
	void Initialize();
/*************************************************************/
	Time LatestTime;
	Time PrevInterruptTime;
	Time LastSightTime;
	Time PrevSightTime;
	Time LastSenseTime;
	Time LastSoundTime;
	Time PrevSenseTime;

	SenseType LastSenseType;

	bool NewSight;
	bool NewSenseInfo;
	bool NewSound;
	bool TwiceSight;
/********************  SYNC   *******************************************/
	inline bool LastMsgIsSense(){return bool(LastSenseType==Sense_Msg);}
	inline bool LastMsgIsSight(){return bool(LastSenseType==See_Msg);}
	inline bool LastMsgIsFull(){return bool(LastSenseType == FI_Msg);}
	inline bool LastMsgIsNonemptySound(){return bool((LastSenseType == Hear_Msg) && nonempty_msg) ;}
/********************  Parse   *******************************************/
	void Parse(char* SensoryInfo);
	bool Parse_initialize_message(char *pstr);
/*******************  Visual Information   ********************************/
	void SetMySensedInfo(VIEWWIDTH viewidth, VIEWQUALITY viewqual, float stamina,float effort,float speed,AngleDeg rel_spd_angle,
		AngleDeg head_angle,int kicks,int dashes,int turns,int says,int turn_necks,Time time);
	SenseBodyInfo& GetSenseBodyInfo(Time time);

/********************** ******************* ***************************/
/**********************  Update Infomation ****************************/
	void Update();	
	void Update_others(Time time);
	void Update_dirconf(Time time, bool NewSight);
	void Reset();
/************************************************************************/
	inline bool SensedInfKnown(Time time){return bool(time == LastSenseTime||time == PrevSenseTime);}
	bool HasFullState();
	void StopClock(bool value);
	void SetMyNumber(UNum no);
};

#endif //__SENSORY_H__

⌨️ 快捷键说明

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