intercept_util.h

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

H
81
字号
#ifndef __INTERCEPT_UTIL_H__
#define __INTERCEPT_UTIL_H__
/*********************************
Author:	Yaojinyi
Date:	2002-3-1 16:39:34
Description:

Last modifier:	Yaojinyi
Last modification date:	2002-3-1 16:39:35
Note:
*********************************/


#include "types.h"
#include "geometry.h"
#include "goingthroughspeed.h"

const int IT_closeball_max_cycles = 5;
const float IT_dash_angle = 360.0f;

enum IT_mode{
	IT_closeball,
	IT_turn,
	IT_dash
};

enum IT_test_res{
	IT_test_beyond,
	IT_test_ok,
	IT_test_not_desired
};

struct InterceptionInfo{
	union{
		float IT_rapidness;
		float IT_dashpow;
	};
	Vector IT_point;
	float IT_cycles;
	AngleDeg IT_angle;
	bool IT_is_closeball;
	bool IT_valid;
};

class Intercept_util : public GT_speed_utils{
protected:
	//param setting
	float dash_rate;
	float rundash_power;
	float max_speed;
	float player_decay;
	float maxdash_effect;
	float kickarea;
	float reliable_kickarea;
	//the ball distance at the end cycle of interception
	float getball_dist;
	int adversary_cycles;
	bool safecloseit;
	int noturn_cycles;
public:
	Intercept_util();	

/******************	getinterceptioninfo	************************/
	IT_test_res interception_test(Ray& ballcourse, Ray& playercourse, float ballspeed, float selffacing, float& dist_ball, InterceptionInfo& inf);
	inline void InfCycleProcess(float& cycles);
	bool getcloseballinterceptioninfo(Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selffacing, InterceptionInfo &inf, bool testonly = false);
	bool OneCycleIntercept(Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selfbodyfacing, float& dashpow, bool testonly = false);
	int Close_to_ball_line_intercept(Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selfbodyfacing, float dist_player, float dist_ball, float& dashpow, int maxcycles,  bool testonly = false);
	int OnlyDashIntercept(int maxcycles, Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selfbodyfacing, float& dashpow, bool testonly = false);
	int TurnDashIntercept(int maxcycles, Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selfbodyfacing, InterceptionInfo& inf, bool testonly = false);
	float TwoCycleAvoidEnemy_Adjust(Vector selfpos, Vector ballpos, Vector selfvel, Vector ballvel, float selfbodyfacing);
	void simulate_one_dash_step(Vector& selfpos, Vector & ballpos, Vector& selfvel, Vector& ballvel, float bdfc, float dashpow = 100);	

	//no bodyfacing, cursory interception
	void getinterceptioninfo(const Vector& ballpos, const Vector& ballvel, const Vector& startpoint, const Vector& selfvel,  InterceptionInfo& inf);
	//valid bodyfacing, careful interception
	void getinterceptioninfo(const Vector& ballpos, const Vector& ballvel, const Vector& startpoint, const Vector& playervel, float bdfacing, InterceptionInfo &inf);
};

#endif //__INTERCEPT_UTIL_H__

⌨️ 快捷键说明

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