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

📄 acmitape.h

📁 空战游戏flacon源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _ACMITAPE_H_
#define _ACMITAPE_H_

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

#include "FalcMesg.h"

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

#define		MAX_ENTITY_CAMS	50

#define ACMI_VERSION 2
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

class ACMITape;
class SimBaseClass;
class DrawableTrail;
class DrawableBSP;
class Drawable2D;
class RViewPoint;
class RenderOTW;
class DrawableTracer;
class SfxClass;

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////


#define ACMI_LABEL_LEN 15

// this structure will hold the in-memory, Sim representation for the
// entity.  IOW base class, drawable objs, etc...
typedef struct 
{
	SimBaseClass *objBase;
	DrawableTrail *objTrail;

	int			flags;

	// object orientation
	float		x;
	float		y;
	float		z;
	float		yaw;
	float		pitch;
	float		roll;

	// average speed between 2 positions
	float		aveSpeed;
	float		aveTurnRate;
	float		aveTurnRadius;

	// for trails, the start and end times
	float		trailStartTime;
	float		trailEndTime;

	// missiles need engine glow drawables
	DrawableBSP  *objBsp1;
	DrawableBSP  *objBsp2;

	// for flare need a glowing sphere
	Drawable2D  *obj2d;

	// for wing tip trails
	int			  wtLength;
	DrawableTrail *wlTrail;
	DrawableTrail *wrTrail;

	// for features we may need an index to the lead component and
	// the slot # that was in the camp component list (for bridges, bases...)
	long		  leadIndex;
	int			  slot;

} SimTapeEntity;

/*
** This struct holds info necessary for handling active tracer events
*/
typedef struct
{
	float		x;
	float		y;
	float		z;
	float		dx;
	float		dy;
	float		dz;
	DrawableTracer *objTracer;
} TracerEventData;


/*
** Each active event will have one of these in a chain
*/
typedef struct _ActiveEvent
{
	long		eventType;
	long		index;
	float		time;
	float		timeEnd;
	void		*eventData;
	struct _ActiveEvent *next;
	struct _ActiveEvent *prev;
} ActiveEvent;

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// These are the headers and data that are used internally for the .vhs format.
// These use offsets instead of pointers so that we can memory map them.
// All offsets are from the start of the file!!!.

////////////////////////////////////////////////////////////////////////////////
//
// Header for the tape file.

#pragma pack (push, pack1, 1)
typedef struct 
{
	long		fileID;
	long		fileSize;
	long		numEntities;
	long		numFeat;
	long 		entityBlockOffset;
	long 		featBlockOffset;
	long		numEntityPositions;
	long		timelineBlockOffset;
	long		firstEntEventOffset;
	long		firstGeneralEventOffset;
	long		firstEventTrailerOffset;
	long		firstTextEventOffset;
	long		firstFeatEventOffset;
	long		numEvents;
	long		numEntEvents;
	long		numTextEvents;
	long		numFeatEvents;
	float		startTime;
	float		totPlayTime;
	float 		todOffset;
} ACMITapeHeader;
#pragma pack (pop, pack1)

////////////////////////////////////////////////////////////////////////////////
//
// Entity data.

#pragma pack (push, pack1, 1)
typedef struct 
{
	long		uniqueID;
	long		type;
	long		count;
	long		flags;
	
		#define		ENTITY_FLAG_MISSILE			0x00000001
		#define		ENTITY_FLAG_FEATURE			0x00000002
		#define		ENTITY_FLAG_AIRCRAFT		0x00000004
		#define		ENTITY_FLAG_CHAFF			0x00000008
		#define		ENTITY_FLAG_FLARE			0x00000010

	// for features we may need an index to the lead component and
	// the slot # that was in the camp component list (for bridges, bases...)
	long		leadIndex;
	int			slot;
	int			specialFlags;


	// Offset from the start of the file to the start of my positional data.
	long 		firstPositionDataOffset;
	long 		firstEventDataOffset;

} ACMIEntityData;
#pragma pack (pop, pack1)

////////////////////////////////////////////////////////////////////////////////
//
// Entity position data.

// enum types for position
enum
{
	PosTypePos = 0,
	PosTypeSwitch,
	PosTypeDOF,
};

#pragma pack (push, pack1, 1)
typedef struct
{
	// Time stamp for the positional data
	float		time;
	BYTE		type;

	// dereference based on type
	union
	{
		// Positional data.
		struct posTag
		{
			float		x;
			float		y;
			float		z;
			float		pitch;
			float		roll;
			float		yaw;
			long	    radarTarget;
		} posData;
		// switch change
		struct switchTag
		{
			int			switchNum;
			int			switchVal;
			int			prevSwitchVal;
		} switchData;
		// DOF change
		struct dofTag
		{
			int			DOFNum;
			float		DOFVal;
			float		prevDOFVal;
		} dofData;
	};

	// Although position data is a fixed size, we still want
	// this so that we can organize the data to be friendly for
	// paging.
	long		nextPositionUpdateOffset;
	long		prevPositionUpdateOffset;
} ACMIEntityPositionData;
#pragma pack (pop, pack1)

//
// This raw format is used by the position/event/sfx bundler to
// create a .vhs file (dig that extension), which is the ACMITape playback format.
// This is the format stored in the flight file.

typedef struct 
{
	int			type;			// type of object
	long		uniqueID;		// A unique ID for the object. Many to One correlation to Falcon Entities
	int			flags;			// side

	// for features we may need an index to the lead component and
	// the slot # that was in the camp component list (for bridges, bases...)
	long		leadIndex;
	int			slot;
	int			specialFlags;
	ACMIEntityPositionData entityPosData;
} ACMIRawPositionData;

////////////////////////////////////////////////////////////////////////////////
//
// Header for event data.

#pragma pack (push, pack1, 1)
typedef struct
{
	// type of event this is
	BYTE		eventType;
	long 		index;

	// Time stamp for this event.
	float		time;
	float		timeEnd;

	// data specific to type of event
	long		type;
	long		user;
	long		flags;
	float		scale;
	float		x, y, z;
	float		dx, dy, dz;
	float		roll, pitch, yaw;

} ACMIEventHeader;
#pragma pack (pop, pack1)

//
// Trailer for event data.
//

#pragma pack (push, pack1, 1)
typedef struct
{
	float		timeEnd;
	long 		index;		// into EventHeader
} ACMIEventTrailer;
#pragma pack (pop, pack1)

////////////////////////////////////////////////////////////////////////////////
//
// Feature Status Event

#pragma pack (push, pack1, 1)
typedef struct
{
	// Time stamp for this event.
	float		time;

	// index of feature on tape
	long 		index;

	// data specific to type of event
	long		newStatus;
	long		prevStatus;

} ACMIFeatEvent;
#pragma pack (pop, pack1)

typedef struct
{
	long		uniqueID;
	ACMIFeatEvent data;
} ACMIFeatEventImportData;

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// .vhs file format:
//
// |                        |                 |                 |
// |        header          | entity block    | timeline block  |
// | sizeof(ACMITapeHeader) | (variable size) | (variable size) |
//
////////////////////////////////////////////////////////////////////////////////
//
// entity block:
//
// |                    |                                       |
// | number of entities |              entities                 |    
// |  sizeof(long)      | num entities * sizeof(ACMIEntityData) |
//
// entity:
//
// |                        |
// |      ACMIEntityData    |
// | sizeof(ACMIEntityData) |
//
////////////////////////////////////////////////////////////////////////////////
//
// timeline block:
//

⌨️ 快捷键说明

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