#include "Sim/Units/CommandAI/CommandAI.h"
#include "Sim/Units/UnitDef.h"
#include "Sim/Misc/LosHandler.h"
#include "Game/SelectedUnits.h"
#include "LogOutput.h"
#include "creg/STL_List.h"
#include "mmgr.h"


CR_BIND_DERIVED(CTransportUnit, CUnit, );

CR_REG_METADATA(CTransportUnit, (
				CR_MEMBER(transported),
				CR_MEMBER(transportCapacityUsed),
				CR_MEMBER(transportMassUsed),
				CR_RESERVED(16),
				CR_POSTLOAD(PostLoad)
				));

CR_BIND(CTransportUnit::TransportedUnit,);

CR_REG_METADATA_SUB(CTransportUnit,TransportedUnit,(
					CR_MEMBER(unit),
					CR_MEMBER(piece),
					CR_MEMBER(size),
					CR_MEMBER(mass),
					CR_RESERVED(8)
					));

CTransportUnit::CTransportUnit()
:	transportCapacityUsed(0),
#include "WeaponProjectiles/MissileProjectile.h"
#include "GlobalUnsynced.h"

CR_BIND_DERIVED(CFlareProjectile, CProjectile, (float3(0,0,0),float3(0,0,0),0,0));

CR_REG_METADATA(CFlareProjectile,(
				CR_SETFLAG(CF_Synced),
				CR_MEMBER(activateFrame),
				CR_MEMBER(deathFrame),

				CR_MEMBER(numSub),
				CR_MEMBER(lastSub),
				CR_MEMBER(subPos),
				CR_MEMBER(subSpeed),
				CR_MEMBER(alphaFalloff),
				CR_RESERVED(8)
				));

CFlareProjectile::CFlareProjectile(const float3& pos, const float3& speed, CUnit* owner, int activateFrame GML_PARG_C):
	//! these are synced, but neither weapon nor piece
	//! (only created by units that can drop flares)
	CProjectile(pos, speed, owner, true, false, false GML_PARG_P),
	activateFrame(activateFrame),
	deathFrame(activateFrame + (owner? owner->unitDef->flareTime: 1)),
	numSub(0),
	lastSub(0)
{
	alphaFalloff = owner? 1.0f / owner->unitDef->flareTime: 1.0f;
	checkCol = false;
	useAirLos = true;
	SetRadius(45);
示例#3
0
#include "NetProtocol.h"
#include "GlobalUnsynced.h"
#include "ConfigHandler.h"
#include "LogOutput.h"
#include "Util.h"
#include "TimeProfiler.h"

#include "creg/STL_Map.h"


CR_BIND_DERIVED(CEngineOutHandler, CObject, )

CR_REG_METADATA(CEngineOutHandler, (
				CR_MEMBER(id_skirmishAI),
				CR_MEMBER(team_skirmishAIs),
				CR_RESERVED(128)
				));


static inline bool isUnitInLosOrRadarOfAllyTeam(const CUnit& unit, const int allyTeamId) {
	return unit.losStatus[allyTeamId] & (LOS_INLOS | LOS_INRADAR);
}

/////////////////////////////
// BEGIN: Exception Handling

bool CEngineOutHandler::IsCatchExceptions() {

	static bool init = false;
	static bool isCatchExceptions;
CR_BIND_DERIVED(CLargeBeamLaserProjectile, CWeaponProjectile, (float3(0,0,0),float3(0,0,0),float3(0,0,0),float3(0,0,0),NULL,NULL));

CR_REG_METADATA(CLargeBeamLaserProjectile,(
	CR_MEMBER(startPos),
	CR_MEMBER(endPos),
	CR_MEMBER(corecolstart),
	CR_MEMBER(kocolstart),
	CR_MEMBER(thickness),
	CR_MEMBER(corethickness),
	CR_MEMBER(flaresize),
	CR_MEMBER(tilelength),
	CR_MEMBER(scrollspeed),
	CR_MEMBER(pulseSpeed),
	CR_MEMBER(beamtex),
	CR_MEMBER(side),
	CR_RESERVED(16)
	));

CLargeBeamLaserProjectile::CLargeBeamLaserProjectile(const float3& startPos, const float3& endPos,
		const float3& color, const float3& color2, CUnit* owner, const WeaponDef* weaponDef):
	CWeaponProjectile(startPos + (endPos - startPos) * 0.5f, ZeroVector, owner, 0, ZeroVector, weaponDef, 0, false,  1),
	startPos(startPos),
	endPos(endPos),
	decay(1.0f)
	//thickness(thickness),
	//corethickness(corethickness),
	//flaresize(flaresize),
	//tilelength(tilelength),
	//scrollspeed(scrollspeed),
	//pulseSpeed(pulseSpeed)
{
示例#5
0
CR_BIND_DERIVED_INTERFACE(AMoveType, CObject);
CR_REG_METADATA(AMoveType, (
	CR_MEMBER(owner),
	CR_MEMBER(goalPos),
	CR_MEMBER(oldPos),
	CR_MEMBER(oldSlowUpdatePos),

	CR_MEMBER(maxSpeed),
	CR_MEMBER(maxSpeedDef),
	CR_MEMBER(maxWantedSpeed),
	CR_MEMBER(repairBelowHealth),

	CR_MEMBER(useHeading),
	CR_ENUM_MEMBER(progressState),
	CR_RESERVED(32)
));

AMoveType::AMoveType(CUnit* owner):
	owner(owner),

	goalPos(owner? owner->pos: ZeroVector),
	oldPos(owner? owner->pos: ZeroVector),
	oldSlowUpdatePos(oldPos),

	useHeading(true),

	progressState(Done),

	maxSpeed(owner->unitDef->speed / GAME_SPEED),
	maxSpeedDef(owner->unitDef->speed / GAME_SPEED),
示例#6
0
	CR_SETFLAG(CF_Synced),
	CR_MEMBER(targeted),
//	CR_MEMBER(weaponDef),
	CR_MEMBER(weaponDefName),
	CR_MEMBER(target),
	CR_MEMBER(targetPos),
	CR_MEMBER(startpos),
	CR_MEMBER(colorTeam),
	CR_MEMBER(ttl),
	CR_MEMBER(bounces),
	CR_MEMBER(keepBouncing),
	CR_MEMBER(cegTag),
	CR_MEMBER(cegID),
	CR_MEMBER(interceptTarget),
	CR_MEMBER(id),
	CR_RESERVED(15),
	CR_POSTLOAD(PostLoad)
	));

CWeaponProjectile::CWeaponProjectile(): CProjectile()
{
	targeted = false;
	weaponDef = 0;
	target = 0;
	projectileType = WEAPON_BASE_PROJECTILE;
	ttl = 0;
	colorTeam = 0;
	interceptTarget = 0;
	bounces = 0;
	keepBouncing = true;
	cegID = -1U;
示例#7
0
	CR_MEMBER(dispList),
	CR_MEMBER(cegID),
	// NOTE: what about this?
	// CR_MEMBER(omp),
	CR_MEMBER(spinVec),
	CR_MEMBER(spinSpeed),
	CR_MEMBER(spinAngle),
	CR_MEMBER(oldSmoke),
	CR_MEMBER(oldSmokeDir),
	CR_MEMBER(alphaThreshold),
	// CR_MEMBER(target),
	CR_MEMBER(drawTrail),
	CR_MEMBER(curCallback),
	CR_MEMBER(age),
	CR_MEMBER(colorTeam),
	CR_RESERVED(36)
	));

void CPieceProjectile::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(numCallback, sizeof(int));
	for (int i = 0; i < 8; i++) {
		s.Serialize(oldInfos[i], sizeof(CPieceProjectile::OldInfo));
	}
}

CPieceProjectile::CPieceProjectile(const float3& pos, const float3& speed, LocalModelPiece* lmp, int f, CUnit* owner, float radius):
	CProjectile(pos, speed, owner, true, false, true),
	flags(f),
	dispList(lmp? lmp->dispListID: 0),
	omp(NULL),
示例#8
0
                    CR_MEMBER(mapy),
                    CR_MEMBER(mapSquares),
                    CR_MEMBER(hmapx),
                    CR_MEMBER(hmapy),
                    CR_MEMBER(pwr2mapx),
                    CR_MEMBER(pwr2mapy),
                    CR_MEMBER(tempNum),
                    CR_MEMBER(godMode),
                    CR_MEMBER(globalLOS),
                    CR_MEMBER(cheatEnabled),
                    CR_MEMBER(noHelperAIs),
                    CR_MEMBER(editDefsEnabled),
                    CR_MEMBER(useLuaGaia),
                    CR_MEMBER(randSeed),
                    CR_MEMBER(initRandSeed),
                    CR_RESERVED(64)
                ));


/**
 * Initializes variables in CGlobalSynced
 */
CGlobalSynced::CGlobalSynced()
{
    mapx  = 512;
    mapy  = 512;
    mapxm1 = mapx - 1;
    mapym1 = mapy - 1;
    mapxp1 = mapx + 1;
    mapyp1 = mapy + 1;
    mapSquares = mapx * mapy;
示例#9
0
#include "Sim/Units/UnitDef.h"
#include "Sim/Units/UnitTypes/Building.h"
#include "Sim/Units/UnitTypes/TransportUnit.h"
#include "Sim/MoveTypes/MoveDefHandler.h"
#include "Sim/MoveTypes/HoverAirMoveType.h"
#include "System/creg/STL_List.h"
#include "System/myMath.h"

#define AIRTRANSPORT_DOCKING_RADIUS 16
#define AIRTRANSPORT_DOCKING_ANGLE 50

CR_BIND_DERIVED(CTransportCAI,CMobileCAI , );

CR_REG_METADATA(CTransportCAI, (
	CR_MEMBER(toBeTransportedUnitId),
	CR_RESERVED(1),
	CR_MEMBER(lastCall),
	CR_MEMBER(unloadType),
	CR_MEMBER(dropSpots),
	CR_MEMBER(isFirstIteration),
	CR_MEMBER(lastDropPos),
	CR_MEMBER(approachVector),
	CR_MEMBER(endDropPos),
	CR_RESERVED(16)
));

CTransportCAI::CTransportCAI()
	: CMobileCAI()
	, unloadType(-1)
	, toBeTransportedUnitId(-1)
	, lastCall(0)
示例#10
0
#include "Sim/Units/Unit.h"
#include "Sim/Units/UnitHandler.h"
#include "Sim/Units/UnitDef.h"
#include "ExternalAI/GlobalAI.h"
#include "ExternalAI/GlobalAIHandler.h"
#include "System/EventHandler.h"
#include "creg/STL_List.h"
#include "creg/STL_Map.h"
#include "creg/STL_Set.h"
#include "NetProtocol.h"

CR_BIND(CTeam,);

CR_REG_METADATA(CTeam, (
				CR_MEMBER(teamNum),
				CR_RESERVED(1),
				CR_MEMBER(isDead),
				CR_MEMBER(gaia),
				CR_MEMBER(color),
				CR_MEMBER(leader),
				CR_MEMBER(lineageRoot),
				CR_MEMBER(handicap),
				CR_MEMBER(side),
				CR_MEMBER(isAI),
				CR_MEMBER(luaAI),
				CR_MEMBER(dllAI),
				CR_MEMBER(units),
				CR_MEMBER(startPos),
				CR_MEMBER(metal),
				CR_MEMBER(energy),
				CR_MEMBER(metalPull),
示例#11
0
#include "creg/STL_List.h"

CR_BIND_DERIVED(CFireProjectile, CProjectile, (float3(0,0,0),float3(0,0,0),NULL,0,0,0,0));
CR_BIND(CFireProjectile::SubParticle, );

CR_REG_METADATA(CFireProjectile,(
	CR_SETFLAG(CF_Synced),
	CR_MEMBER(ttl),
	CR_MEMBER(emitPos),
	CR_MEMBER(emitRadius),
	CR_MEMBER(particleTime),
	CR_MEMBER(particleSize),
	CR_MEMBER(ageSpeed),
	CR_MEMBER(subParticles2),
	CR_MEMBER(subParticles),
	CR_RESERVED(16)
	));

CR_REG_METADATA_SUB(CFireProjectile, SubParticle, (
	CR_MEMBER(pos),
	CR_MEMBER(posDif),
	CR_MEMBER(age),
	CR_MEMBER(maxSize),
	CR_MEMBER(rotSpeed),
	CR_MEMBER(smokeType),
	CR_RESERVED(8)
	));


CFireProjectile::CFireProjectile(const float3& pos, const float3& speed, CUnit* owner, int emitTtl, float emitRadius, int particleTtl, float particleSize GML_PARG_C):
	//! these are synced, but neither weapon nor piece
示例#12
0
		CR_MEMBER(rudder),
		CR_MEMBER(elevator),
		CR_MEMBER(aileronRight),
		CR_MEMBER(aileronLeft),
		CR_MEMBER(rudders),

		CR_MEMBER(lastRudderUpdate),
		CR_MEMBER(lastRudderPos),
		CR_MEMBER(lastElevatorPos),
		CR_MEMBER(lastAileronPos),

		CR_MEMBER(inefficientAttackTime),
		CR_MEMBER(exitVector),

		CR_RESERVED(63)
		));

CR_REG_METADATA_SUB(CAirMoveType, DrawLine, (
		CR_MEMBER(pos1), CR_MEMBER(pos2),
		CR_MEMBER(color)));

CR_REG_METADATA_SUB(CAirMoveType, RudderInfo, (CR_MEMBER(rotation)));



CAirMoveType::CAirMoveType(CUnit* owner):
	AAirMoveType(owner),
	subState(0),
	maneuver(0),
	maneuverSubState(0),
示例#13
0
#include "System/EventHandler.h"
#include "System/NetProtocol.h"
#include "System/LogOutput.h"
#include "System/Sound.h"
#include "creg/STL_List.h"


#define DRAW_QUAD_SIZE 32

CInMapDraw* inMapDrawer = NULL;

CR_BIND(CInMapDraw, );

CR_REG_METADATA(CInMapDraw, (
	CR_MEMBER(drawQuads),
	CR_RESERVED(4)
));

CR_BIND(CInMapDraw::MapPoint, );

CR_REG_METADATA_SUB(CInMapDraw, MapPoint, (
	CR_MEMBER(pos),
	CR_MEMBER(label),
	CR_MEMBER(senderAllyTeam),
	CR_MEMBER(senderSpectator),
	CR_RESERVED(4),
	CR_SERIALIZER(Serialize)
));

CR_BIND(CInMapDraw::MapLine, );
示例#14
0
	CR_MEMBER(creationTime),
	CR_MEMBER(lifeTime),
	CR_MEMBER(color),
	CR_MEMBER(dir1),
	CR_MEMBER(dir2),
	CR_MEMBER(drawTrail),
	CR_MEMBER(dirpos1),
	CR_MEMBER(dirpos2),
	CR_MEMBER(midpos),
	CR_MEMBER(middir),
	CR_MEMBER(drawSegmented),
	CR_MEMBER(firstSegment),
	CR_MEMBER(lastSegment),
	CR_MEMBER(drawCallbacker),
	CR_MEMBER(texture),
	CR_RESERVED(4)
));

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSmokeTrailProjectile::CSmokeTrailProjectile(
	CUnit* owner,
	const float3& pos1,
	const float3& pos2,
	const float3& dir1,
	const float3& dir2,
	bool firstSegment,
	bool lastSegment,
	float size,
示例#15
0
文件: Command.cpp 项目: 9heart/spring
#include "Command.h"

#include "System/creg/creg_cond.h"


namespace springLegacyAI {

CR_BIND(Command, );
CR_REG_METADATA(Command, (
				CR_MEMBER(id),
				CR_MEMBER(options),
				CR_MEMBER(params),
				CR_MEMBER(tag),
				CR_MEMBER(timeOut),
				CR_RESERVED(16)
				));

CR_BIND(CommandDescription, );
CR_REG_METADATA(CommandDescription, (
				CR_MEMBER(id),
				CR_MEMBER(type),
				CR_MEMBER(name),
				CR_MEMBER(action),
				CR_MEMBER(iconname),
				CR_MEMBER(mouseicon),
				CR_MEMBER(tooltip),
				CR_MEMBER(hidden),
				CR_MEMBER(disabled),
				CR_MEMBER(showUnique),
				CR_MEMBER(onlyTexture),