Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -677,5 +677,10 @@ static PoolSizeRec PoolSizes[] =
{ "SmudgeSet", 32, 32},
{ "Smudge", 128, 32},
{ "ResetSpecialPowerTimerWhileAliveUpdate", 8, 8 },
{ "DroneCarrierAIUpdate", 8, 8 },
{ "DroneCarrierSlavedUpdate", 8, 8 },
{ "DroneCarrierContain", 8, 8 },
{ "W3DDependencyCarrierDraw", 16, 16 },
{ "CarrierDroneAIUpdate", 16, 16 },
{ 0, 0, 0 }
};
8 changes: 8 additions & 0 deletions GeneralsMD/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ set(GAMEENGINE_SRC
Include/GameLogic/Module/DelayedUpgradeBehavior.h
Include/GameLogic/Module/FlammableUpdate.h
Include/GameLogic/Module/FlightDeckBehavior.h
Include/GameLogic/Module/DroneCarrierAIUpdate.h
Include/GameLogic/Module/FloatUpdate.h
Include/GameLogic/Module/FXListDie.h
Include/GameLogic/Module/GarrisonContain.h
Expand Down Expand Up @@ -497,6 +498,9 @@ set(GAMEENGINE_SRC
Include/GameLogic/Module/WorkerAIUpdate.h
Include/GameLogic/Module/KodiakDeploymentUpdate.h
Include/GameLogic/Module/KodiakUpdate.h
Include/GameLogic/Module/DroneCarrierSlavedUpdate.h
Include/GameLogic/Module/DroneCarrierContain.h
Include/GameLogic/Module/CarrierDroneAIUpdate.h
Include/GameLogic/Object.h
Include/GameLogic/ObjectCreationList.h
Include/GameLogic/ObjectIter.h
Expand Down Expand Up @@ -946,6 +950,7 @@ set(GAMEENGINE_SRC
Source/GameLogic/Object/Contain/RiderChangeContain.cpp
Source/GameLogic/Object/Contain/TransportContain.cpp
Source/GameLogic/Object/Contain/TunnelContain.cpp
Source/GameLogic/Object/Contain/DroneCarrierContain.cpp
Source/GameLogic/Object/Create/CreateModule.cpp
Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp
Source/GameLogic/Object/Create/LockWeaponCreate.cpp
Expand Down Expand Up @@ -1017,6 +1022,8 @@ set(GAMEENGINE_SRC
Source/GameLogic/Object/Update/AIUpdate/WanderAIUpdate.cpp
Source/GameLogic/Object/Update/AIUpdate/TeleporterAIUpdate.cpp
Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp
Source/GameLogic/Object/Update/AIUpdate/DroneCarrierAIUpdate.cpp
Source/GameLogic/Object/Update/AIUpdate/CarrierDroneAIUpdate.cpp
Source/GameLogic/Object/Update/AnimationSteeringUpdate.cpp
Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp
Source/GameLogic/Object/Update/AutoDepositUpdate.cpp
Expand Down Expand Up @@ -1094,6 +1101,7 @@ set(GAMEENGINE_SRC
Source/GameLogic/Object/Update/ArmorDamageScalarUpdate.cpp
Source/GameLogic/Object/Update/KodiakDeploymentUpdate.cpp
Source/GameLogic/Object/Update/KodiakUpdate.cpp
Source/GameLogic/Object/Update/DroneCarrierSlavedUpdate.cpp
Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp
Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp
Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include "Common/STLTypedefs.h"
#include "Common/GameMemory.h"
#include "GameLogic/AIStateMachine.h"
#include "GameLogic/Module/AIUpdate.h"


//-------------------------------------------------------------------------------------------------
class CarrierDroneAIUpdate : public AIUpdateInterface
{

MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(CarrierDroneAIUpdate, "CarrierDroneAIUpdate")
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA(CarrierDroneAIUpdate, AIUpdateModuleData)

//virtual UpdateSleepTime update();

public:

CarrierDroneAIUpdate(Thing* thing, const ModuleData* moduleData);
// virtual destructor prototype provided by memory pool declaration

//stop contained drones from attacking
virtual void privateAttackPosition(const Coord3D* pos, Int maxShotsToFire, CommandSourceType cmdSource) override; ///< attack given spot
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// FILE: DroneCarrierAIUpdate.h /////////////////////////////////////////////////////////////////////
// Desc: Mobile drone carrier.
///////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once

#ifndef __DRONE_CARRIER_AI_UPDATE_H
#define __DRONE_CARRIER_AI_UPDATE_H

// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "GameLogic/Module/BehaviorModule.h"
#include "GameLogic/Module/DieModule.h"
#include "GameLogic/Module/AIUpdate.h"
#include "GameLogic/Module/SpawnBehavior.h"


//-------------------------------------------------------------------------------------------------
class DroneCarrierAIUpdateModuleData : public AIUpdateModuleData
{
public:
Int m_slots;
UnsignedInt m_respawn_time;

std::vector<AsciiString> m_spawnTemplateNameData;

DroneCarrierAIUpdateModuleData();

static void buildFieldParse(MultiIniFieldParse& p);
};

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
class DroneCarrierAIUpdate : public AIUpdateInterface,
public SpawnBehaviorInterface,
public DieModuleInterface
//public ExitInterface
{

MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(DroneCarrierAIUpdate, "DroneCarrierAIUpdate")
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA(DroneCarrierAIUpdate, DroneCarrierAIUpdateModuleData)

public:

DroneCarrierAIUpdate(Thing* thing, const ModuleData* moduleData);
// virtual destructor prototype provided by memory pool declaration

static Int getInterfaceMask() { return UpdateModule::getInterfaceMask() | (MODULEINTERFACE_DIE); }

// BehaviorModule
virtual DieModuleInterface* getDie() { return this; }

// UpdateModule
virtual UpdateSleepTime update();

// SpawnBehaviorInterface
virtual SpawnBehaviorInterface* getSpawnBehaviorInterface() { return this; }

virtual Bool maySpawnSelfTaskAI(Real maxSelfTaskersRatio) { return false; };
virtual void onSpawnDeath(ObjectID deadSpawn, DamageInfo* damageInfo);
virtual Object* getClosestSlave(const Coord3D* pos);
virtual void orderSlavesToAttackTarget(Object* target, Int maxShotsToFire, CommandSourceType cmdSource);
virtual void orderSlavesToAttackPosition(const Coord3D* pos, Int maxShotsToFire, CommandSourceType cmdSource);
virtual CanAttackResult getCanAnySlavesAttackSpecificTarget(AbleToAttackType attackType, const Object* target, CommandSourceType cmdSource);
virtual CanAttackResult getCanAnySlavesUseWeaponAgainstTarget(AbleToAttackType attackType, const Object* victim, const Coord3D* pos, CommandSourceType cmdSource);
virtual Bool canAnySlavesAttack();
virtual void orderSlavesToGoIdle(CommandSourceType cmdSource);
virtual void orderSlavesDisabledUntil(DisabledType type, UnsignedInt frame);
virtual void orderSlavesToClearDisabled(DisabledType type);
virtual void giveSlavesStealthUpgrade(Bool grantStealth);
virtual Bool areAllSlavesStealthed() const;
virtual void revealSlaves();
virtual Bool doSlavesHaveFreedom() const { return false; };

// DieModule
virtual void onDie(const DamageInfo* damageInfo);

// AIUpdateInterface
virtual void aiDoCommand(const AICommandParms* parms);

static bool isDroneCombatReady(Object* drone);

private:

Bool is_full(); ///< has this carrier an open spot?
Bool createSpawn(); ///< Actual work of creating a guy

void deployDrones(); ///< let all drones exit the transport
void retrieveDrones(); ///< order all drones to go back to the transport

void propagateOrdersToDrones();
void propagateOrderToSpecificDrone(Object* drone);

//works for both Object and Coord3D
template <typename T>
bool targetInRange(const T* target);

const ThingTemplate* m_spawnTemplate; ///< What it is I spawn
std::vector<ObjectID> m_spawnIDs; ///< IDs of currently active drones
std::vector<AsciiString>::const_iterator m_templateNameIterator;
UnsignedInt m_rebuild_time; // which frame a drone will be rebuilt. 0 if not active
Bool m_active; ///< Am I currently turned on
Bool m_initial_spawns; ///< Have initial drones be spawned? (first update frame)
ObjectID m_designatedTarget;
AICommandType m_designatedCommand;
Coord3D m_designatedPosition;
};

template bool DroneCarrierAIUpdate::targetInRange<Object>(const Object* target);
template bool DroneCarrierAIUpdate::targetInRange<Coord3D>(const Coord3D* target);

#endif // __DRONE_CARRIER_AI_UPDATE_H

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// FILE: DroneCarrierContain.h ////////////////////////////////////////////////////////////////////////
// Desc: expanded transport contain to work with drone carrier
///////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once

#ifndef __DRONE_CARRIER_CONTAIN_H_
#define __DRONE_CARRIER_CONTAIN_H_

// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "GameLogic/Module/OpenContain.h"
#include "GameLogic/Module/TransportContain.h"
#include "GameLogic/Module/GarrisonContain.h"

//-------------------------------------------------------------------------------------------------
class DroneCarrierContainModuleData: public TransportContainModuleData
{
public:
Real m_launchVelocityBoost;

DroneCarrierContainModuleData();

static void buildFieldParse(MultiIniFieldParse& p);

};

//-------------------------------------------------------------------------------------------------
class DroneCarrierContain: public TransportContain
{

MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(DroneCarrierContain, "DroneCarrierContain")
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA(DroneCarrierContain, DroneCarrierContainModuleData)

public:

DroneCarrierContain(Thing* thing, const ModuleData* moduleData);
// virtual destructor prototype provided by memory pool declaration

//Only allow slaved units in
virtual Bool isValidContainerFor(const Object* obj, Bool checkCapacity) const;

virtual Bool isEnclosingContainerFor(const Object* obj) const { return true; } //TODO param in module

virtual Bool isPassengerAllowedToFire(ObjectID id = INVALID_ID) const override; ///< Hey, can I shoot out of this container?

//support for specific exit bones
virtual void onRemoving(Object* obj) override;
virtual void onContaining(Object* obj, Bool wasSelected) override; ///< object now contains 'obj'

virtual short getRiderSlot(ObjectID riderID) const override;
virtual short getPortableSlot(ObjectID portableID) const override;
virtual const ContainedItemsList* getAddOnList() const override;
virtual ContainedItemsList* getAddOnList() override;

// Called from the AI update to reload the contained drones
void updateContainedReloadingStatus();

protected:

// Saves slot assignement and frame when entered
std::vector<std::tuple<ObjectID, UnsignedInt>> m_contained_units;
};

#endif // __TransportContain_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

// FILE: DroneCarrierSlavedUpdate.cpp /////////////////////////////////////////////////////////////////////////
// Desc: expanded Slaved update to work with drone carrier
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#ifndef _DRONE_CARRIER_SLAVED_UPDATE_H_
#define _DRONE_CARRIER_SLAVED_UPDATE_H_
#include "Common/INI.h"
#include "GameLogic/Module/UpdateModule.h"
#include "GameLogic/Module/SlavedUpdate.h"

//-------------------------------------------------------------------------------------------------
class DroneCarrierSlavedUpdateModuleData : public SlavedUpdateModuleData
{
public:
Real m_leashRange;

DroneCarrierSlavedUpdateModuleData();
static void buildFieldParse(MultiIniFieldParse& p);
};

class DroneCarrierSlavedUpdate : public SlavedUpdate
{

MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(DroneCarrierSlavedUpdate, "DroneCarrierSlavedUpdate")
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA(DroneCarrierSlavedUpdate, DroneCarrierSlavedUpdateModuleData)

public:

DroneCarrierSlavedUpdate(Thing* thing, const ModuleData* moduleData);
// virtual destructor prototype provided by memory pool declaration

virtual UpdateSleepTime update(); ///< Deciding whether or not to make new guys

virtual SlavedUpdateInterface* getSlavedUpdateInterface() { return this; }

};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SlavedUpdate : public UpdateModule, public SlavedUpdateInterface

virtual UpdateSleepTime update(); ///< Deciding whether or not to make new guys

private:
protected:
void startSlavedEffects( const Object *slaver ); ///< We have been marked as Slaved, so we can't be selected or move too far or other stuff
void stopSlavedEffects(); ///< We are no longer slaved.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ class TransportContain : public OpenContain
void letRidersUpgradeWeaponSet( void );

Bool m_payloadCreated;

private:

Int m_extraSlotsInUse;

UnsignedInt m_frameExitNotBusy;

};
Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ class Object : public Thing, public Snapshot
// Weapons & Damage -------------------------------------------------------------------------------------------------
void reloadAllAmmo(Bool now);
Bool isOutOfAmmo() const;
Bool isFullAmmo() const; //added by OFS
Bool hasAnyWeapon() const;
Bool hasAnyDamageWeapon() const; //Kris: a should be used for real weapons that directly inflict damage... not deploy, hack, etc.
Bool hasWeaponToDealDamageType(DamageType typeToDeal) const;
Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class WeaponSet : public Snapshot
void updateWeaponSet(const Object* obj);
void reloadAllAmmo(const Object *obj, Bool now);
Bool isOutOfAmmo() const;
Bool isFullAmmo() const; // Added for OFS
Bool hasAnyWeapon() const { return m_filledWeaponSlotMask != 0; }
Bool hasAnyDamageWeapon() const { return m_hasDamageWeapon; }
Bool hasWeaponToDealDamageType(DamageType typeToDeal) const { return m_totalDamageTypeMask.test(typeToDeal); }
Expand Down Expand Up @@ -281,6 +282,7 @@ class WeaponSet : public Snapshot

Weapon* getWeaponInWeaponSlot(WeaponSlotType wslot) const;


static ModelConditionFlags getModelConditionForWeaponSlot(WeaponSlotType wslot, WeaponSetConditionType a);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@
#include "GameLogic/Module/CheckpointUpdate.h"
#include "GameLogic/Module/EMPUpdate.h"
#include "GameLogic/Module/ResetSpecialPowerTimerWhileAliveUpdate.h"
#include "GameLogic/Module/DroneCarrierAIUpdate.h"
#include "GameLogic/Module/DroneCarrierSlavedUpdate.h"
#include "GameLogic/Module/DroneCarrierContain.h"
#include "GameLogic/Module/CarrierDroneAIUpdate.h"

// upgrade includes
#include "GameLogic/Module/ActiveShroudUpgrade.h"
Expand Down Expand Up @@ -395,6 +399,7 @@ void ModuleFactory::init( void )
addModule( JetSlowDeathBehavior );
addModule( RailroadBehavior );
addModule( SpawnBehavior );
addModule( DroneCarrierContain );

// die modules
addModule( DestroyDie );
Expand Down Expand Up @@ -503,6 +508,9 @@ void ModuleFactory::init( void )
addModule( PowerPlantUpdate );
addModule( CheckpointUpdate );
addModule( ResetSpecialPowerTimerWhileAliveUpdate );
addModule( DroneCarrierAIUpdate );
addModule( DroneCarrierSlavedUpdate );
addModule( CarrierDroneAIUpdate );

// upgrade modules
addModule( CostModifierUpgrade );
Expand Down
Loading