Skip to content
Open
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
3 changes: 3 additions & 0 deletions Generals/Code/GameEngine/Include/Common/ActionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class ActionManager : public SubsystemInterface
CanAttackResult getCanAttackObject( const Object *obj, const Object *objectToAttack, CommandSourceType commandSource, AbleToAttackType attackType );
Bool canConvertObjectToCarBomb( const Object *obj, const Object *objectToConvert, CommandSourceType commandSource );
Bool canHijackVehicle( const Object *obj, const Object *ObjectToHijack, CommandSourceType commandSource ); // LORENZEN
#if RTS_ZEROHOUR
Bool canSabotageBuilding( const Object *obj, const Object *objectToSabotage, CommandSourceType commandSource );
#endif
Bool canCaptureBuilding( const Object *obj, const Object *objectToCapture, CommandSourceType commandSource );
Bool canDisableVehicleViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource, Bool checkSourceRequirements = true );
#ifdef ALLOW_SURRENDER
Expand Down
11 changes: 11 additions & 0 deletions Generals/Code/GameEngine/Include/Common/Energy.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class Energy : public Snapshot
{
m_energyProduction = 0;
m_energyConsumption = 0;
#if RTS_ZEROHOUR
m_powerSabotagedTillFrame = 0;
#endif
m_owner = owner;
}

Expand All @@ -94,6 +97,11 @@ class Energy : public Snapshot
void addPowerBonus( Object *obj );
void removePowerBonus( Object *obj );

#if RTS_ZEROHOUR
void setPowerSabotagedTillFrame( UnsignedInt frame ) { m_powerSabotagedTillFrame = frame; }
UnsignedInt getPowerSabotagedTillFrame() const { return m_powerSabotagedTillFrame; }

#endif
/**
return the percentage of energy needed that we actually produce, as a 0.0 ... 1.0 fraction.
*/
Expand All @@ -113,5 +121,8 @@ class Energy : public Snapshot

Int m_energyProduction; ///< level of energy production, in kw
Int m_energyConsumption; ///< level of energy consumption, in kw
#if RTS_ZEROHOUR
UnsignedInt m_powerSabotagedTillFrame; ///< If power is sabotaged, the frame will be greater than now.
#endif
Player *m_owner; ///< Tight pointer to the Player I am intrinsic to.
};
82 changes: 82 additions & 0 deletions Generals/Code/GameEngine/Include/Common/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class Player : public Snapshot
NameKeyType getPlayerNameKey() const { return m_playerNameKey; }

AsciiString getSide() const { return m_side; }
#if RTS_ZEROHOUR
AsciiString getBaseSide() const { return m_baseSide; }
#endif

const PlayerTemplate* getPlayerTemplate() const { return m_playerTemplate; }
/// return the Player's Handicap sub-object
Expand All @@ -235,7 +238,11 @@ class Player : public Snapshot
Money *getMoney() { return &m_money; }
const Money *getMoney() const { return &m_money; }

#if RTS_GENERALS
UnsignedInt getSupplyBoxValue();///< Many things can affect the alue of a crate, but at heart it is a GlobalData ratio.
#elif RTS_ZEROHOUR
UnsignedInt getSupplyBoxValue();///< Many things can affect the value of a crate, but at heart it is a GlobalData ratio.
#endif

Energy *getEnergy() { return &m_energy; }
const Energy *getEnergy() const { return &m_energy; }
Expand Down Expand Up @@ -268,6 +275,11 @@ class Player : public Snapshot
// Can we afford to build?
Bool canAffordBuild( const ThingTemplate *whatToBuild ) const;

#if RTS_ZEROHOUR
// Check MaxSimultaneousOfType
Bool canBuildMoreOfType( const ThingTemplate *whatToBuild ) const;

#endif
/// Difficulty level for this player.
GameDifficulty getPlayerDifficulty() const;

Expand Down Expand Up @@ -322,6 +334,7 @@ class Player : public Snapshot
void onUpgradeCompleted( const UpgradeTemplate *upgradeTemplate ); ///< An upgrade just finished, do things like tell all objects to recheck UpgradeModules
void onUpgradeRemoved(){} ///< An upgrade just got removed, this doesn't do anything now.

#if RTS_GENERALS
#if defined(RTS_DEBUG)
/// Prereq disabling cheat key
void toggleIgnorePrereqs(){ m_DEMO_ignorePrereqs = !m_DEMO_ignorePrereqs; }
Expand All @@ -337,6 +350,27 @@ class Player : public Snapshot
void toggleInstantBuild(){ m_DEMO_instantBuild = !m_DEMO_instantBuild; }
void enableInstantBuild(Bool enable) { m_DEMO_instantBuild = enable; }
Bool buildsInstantly() const { return m_DEMO_instantBuild; }
#endif
#elif RTS_ZEROHOUR
#if defined(RTS_DEBUG)
/// Prereq disabling cheat key
void toggleIgnorePrereqs(){ m_DEMO_ignorePrereqs = !m_DEMO_ignorePrereqs; }
void enableIgnorePrereqs(Bool enable) { m_DEMO_ignorePrereqs = enable; }
Bool ignoresPrereqs() const { return m_DEMO_ignorePrereqs; }

/// No cost building cheat key
void toggleFreeBuild(){ m_DEMO_freeBuild = !m_DEMO_freeBuild; }
void enableFreeBuild(Bool enable) { m_DEMO_freeBuild = enable; }
Bool buildsForFree() const { return m_DEMO_freeBuild; }

#endif

#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
/// No time building cheat key
void toggleInstantBuild(){ m_DEMO_instantBuild = !m_DEMO_instantBuild; }
void enableInstantBuild(Bool enable) { m_DEMO_instantBuild = enable; }
Bool buildsInstantly() const { return m_DEMO_instantBuild; }
#endif
#endif

///< Power just changed at all. Didn't make two functions so you can't forget to undo something you didin one of them.
Expand Down Expand Up @@ -435,7 +469,11 @@ class Player : public Snapshot
/// Have the team guard a supply center.
void guardSupplyCenter( Team *team, Int minSupplies );

#if RTS_GENERALS
virtual void computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D *pos, Int playerNdx, Real weaponRadius); ///< Calculates best pos for weapon given radius.
#elif RTS_ZEROHOUR
virtual Bool computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D *pos, Int playerNdx, Real weaponRadius); ///< Calculates best pos for weapon given radius.
#endif

/// Get the enemy an ai player is currently focused on. NOTE - Can be nullptr.
Player *getCurrentEnemy();
Expand Down Expand Up @@ -555,10 +593,14 @@ class Player : public Snapshot
Bool getUnitsShouldHunt() const { return m_unitsShouldHunt; }

/// All of our units are new spied upon; they sight for the given enemy
#if RTS_GENERALS
void setUnitsVisionSpied( Bool setting, PlayerIndex byWhom );

/// This will be asked by units when they look to get extra people to sight for
PlayerMaskType getVisionSpiedMask() const;
#elif RTS_ZEROHOUR
void setUnitsVisionSpied( Bool setting, KindOfMaskType whichUnits, PlayerIndex byWhom );
#endif

/// Destroy all of the teams for this player, causing him to DIE.
void killPlayer();
Expand All @@ -575,6 +617,11 @@ class Player : public Snapshot
/// Build a building near a supply dump with at least cash. Gets passed to aiPlayer.
void buildBySupplies(Int minimumCash, const AsciiString &thingName);

#if RTS_ZEROHOUR
/// Build an instance of a specific building nearest specified team. Gets passed to aiPlayer.
void buildSpecificBuildingNearestTeam( const AsciiString &thingName, const Team *team );

#endif
/// Build an upgrade. Gets passed to aiPlayer.
void buildUpgrade(const AsciiString &upgrade);

Expand All @@ -587,6 +634,11 @@ class Player : public Snapshot
/// Recruits an instance of a specific team. Gets passed to aiPlayer.
void recruitSpecificTeam(TeamPrototype *teamProto, Real recruitRadius);

#if RTS_ZEROHOUR
/// Calculates the closest construction zone location based on a template. Gets plassed to aiPlayer
Bool calcClosestConstructionZoneLocation( const ThingTemplate *constructTemplate, Coord3D *location );

#endif
/// Enable/Disable the construction of units
Bool getCanBuildUnits() { return m_canBuildUnits; }
void setCanBuildUnits(Bool canProduce) { m_canBuildUnits = canProduce; }
Expand Down Expand Up @@ -736,6 +788,9 @@ class Player : public Snapshot
NameKeyType m_playerNameKey; ///< This player's internal name (for matching map objects)
PlayerIndex m_playerIndex; ///< player unique index.
AsciiString m_side; ///< the "side" this player is on
#if RTS_ZEROHOUR
AsciiString m_baseSide; ///< the base side, GLA, USA, or China
#endif
PlayerType m_playerType; ///< human/computer control
Money m_money; ///< Player's current wealth
Upgrade* m_upgradeList; ///< list of all upgrades this player has
Expand All @@ -762,15 +817,29 @@ class Player : public Snapshot
TunnelTracker* m_tunnelSystem; ///< All TunnelContain buildings use this part of me for actual containment
Team* m_defaultTeam; ///< our "default" team.

#if RTS_GENERALS
ScienceVec m_sciences; ///< (SAVE) sciences that we know (either intrinsically or via later purchases)
ScienceVec m_sciencesDisabled; ///< (SAVE) sciences that we are not permitted to purchase "yet". Controlled by mission scripts.
ScienceVec m_sciencesHidden; ///< (SAVE) sciences that aren't shown. Controlled by mission scripts.
#elif RTS_ZEROHOUR
ScienceVec m_sciences; ///< (SAVE) sciences that we know (either intrinsically or via later purchases)
ScienceVec m_sciencesDisabled; ///< (SAVE) sciences that we are not permitted to purchase "yet". Controlled by mission scripts.
ScienceVec m_sciencesHidden; ///< (SAVE) sciences that aren't shown. Controlled by mission scripts.
#endif

#if RTS_GENERALS
Int m_rankLevel; ///< (SAVE) our RankLevel, 1...n
Int m_skillPoints; ///< (SAVE) our cumulative SkillPoint total
Int m_sciencePurchasePoints; ///< (SAVE) our unspent SciencePurchasePoint total
Int m_levelUp, m_levelDown; ///< (NO-SAVE) skill points to go up/down a level (runtime only)
UnicodeString m_generalName; ///< (SAVE) This is the name of the general the player is allowed to change.
#elif RTS_ZEROHOUR
Int m_rankLevel; ///< (SAVE) our RankLevel, 1...n
Int m_skillPoints; ///< (SAVE) our cumulative SkillPoint total
Int m_sciencePurchasePoints; ///< (SAVE) our unspent SciencePurchasePoint total
Int m_levelUp, m_levelDown; ///< (NO-SAVE) skill points to go up/down a level (runtime only)
UnicodeString m_generalName; ///< (SAVE) This is the name of the general the player is allowed to change.
#endif

PlayerTeamList m_playerTeamPrototypes; ///< ALL the teams we control, via prototype
PlayerRelationMap *m_playerRelations; ///< allies & enemies
Expand All @@ -789,16 +858,29 @@ class Player : public Snapshot

Bool m_attackedBy[MAX_PLAYER_COUNT]; ///< For each player, have they attacked me?
UnsignedInt m_attackedFrame; ///< Last frame attacked.
#if RTS_GENERALS
Int m_visionSpiedBy[MAX_PLAYER_COUNT]; ///< Reference count of having units spied on by players.
PlayerMaskType m_visionSpiedMask; ///< For quick lookup and edge triggered maintenance
#endif

Real m_cashBountyPercent;

/// @todo REMOVE (not disable) these cheat keys
#if RTS_GENERALS
#if defined(RTS_DEBUG)
Bool m_DEMO_ignorePrereqs; ///< Can I ignore prereq checks?
Bool m_DEMO_freeBuild; ///< Can I build everything for no money?
Bool m_DEMO_instantBuild; ///< Can I build anything in one frame?
#endif
#elif RTS_ZEROHOUR
#if defined(RTS_DEBUG)
Bool m_DEMO_ignorePrereqs; ///< Can I ignore prereq checks?
Bool m_DEMO_freeBuild; ///< Can I build everything for no money?
#endif

#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
Bool m_DEMO_instantBuild; ///< Can I build anything in one frame?
#endif
#endif

ScoreKeeper m_scoreKeeper; ///< The local scorekeeper for this player
Expand Down
30 changes: 30 additions & 0 deletions Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,17 @@ class PlayerTemplate
//const Image *getHiliteImage() const;
//const Image *getPushedImage() const;
const Image *getSideIconImage() const;
#if RTS_ZEROHOUR
const Image *getGeneralImage() const;
#endif
const AsciiString getTooltip() const { return m_tooltip; }
#if RTS_ZEROHOUR
const AsciiString getGeneralFeatures() const { return m_strGeneralFeatures; }

AsciiString getMedallionNormal() const { return m_strMedallionNormal; }
AsciiString getMedallionHilite() const { return m_strMedallionHilite; }
AsciiString getMedallionSelected() const { return m_strMedallionSelected; }
#endif

const ScienceVec& getIntrinsicSciences() const { return m_intrinsicSciences; }
Int getIntrinsicSciencePurchasePoints() const { return m_intrinsicSPP; }
Expand All @@ -125,6 +135,9 @@ class PlayerTemplate
Int getSpecialPowerShortcutButtonCount() const {return m_specialPowerShortcutButtonCount; }

AsciiString getLoadScreenMusic() const {return m_loadScreenMusic; }
#if RTS_ZEROHOUR
AsciiString getScoreScreenMusic() const { return m_scoreScreenMusic; }
#endif

Bool isOldFaction() const { return m_oldFaction; }

Expand Down Expand Up @@ -161,6 +174,9 @@ class PlayerTemplate
AsciiString m_specialPowerShortcutWinName; ///< The name of the window we'll be using for the shortcut bar
Int m_specialPowerShortcutButtonCount; ///< The number of buttons located on the shortcut bar
AsciiString m_loadScreenMusic; ///< the load screen music we want to play
#if RTS_ZEROHOUR
AsciiString m_scoreScreenMusic; ///< the score screen music we want to play
#endif
AsciiString m_tooltip; ///< The tooltip describing this player template
Bool m_observer;
Bool m_playableSide;
Expand All @@ -178,8 +194,18 @@ class PlayerTemplate
//AsciiString m_hiliteImage; ///< hilite button image
//AsciiString m_pushedImage; ///< pushed button image
AsciiString m_sideIconImage; ///< The little icon we show on game info screens for the sides
#if RTS_ZEROHOUR
AsciiString m_generalImage; ///< The icon overlayed on the rank image in My Persona
#endif

AsciiString m_beaconTemplate; ///< ThingTemplate name for beacons
#if RTS_ZEROHOUR

AsciiString m_strGeneralFeatures; ///< used in loadscreens
AsciiString m_strMedallionNormal;
AsciiString m_strMedallionHilite;
AsciiString m_strMedallionSelected;
#endif
};

// ----------------------------------------------------------------------------------------------
Expand All @@ -202,7 +228,11 @@ class PlayerTemplateStore : public SubsystemInterface
const PlayerTemplate* getNthPlayerTemplate(Int i) const;
const PlayerTemplate* findPlayerTemplate(NameKeyType namekey) const;
Int getPlayerTemplateCount() const { return m_playerTemplates.size(); }
#if RTS_GENERALS

#elif RTS_ZEROHOUR
Int getTemplateNumByName(AsciiString name) const;
#endif

// This function will fill outStringList with all the sides found in all the templates
void getAllSideStrings(AsciiStringList *outStringList);
Expand Down
55 changes: 55 additions & 0 deletions Generals/Code/GameEngine/Include/Common/SpecialPowerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ enum SpecialPowerType CPP_11(: Int)
SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES,
SPECIAL_REMOTE_CHARGES,
SPECIAL_TIMED_CHARGES,
#if RTS_ZEROHOUR
SPECIAL_HELIX_NAPALM_BOMB,
#endif
SPECIAL_HACKER_DISABLE_BUILDING,
SPECIAL_TANKHUNTER_TNT_ATTACK,
SPECIAL_BLACKLOTUS_CAPTURE_BUILDING,
Expand All @@ -80,6 +83,9 @@ enum SpecialPowerType CPP_11(: Int)
SPECIAL_RADAR_VAN_SCAN,
SPECIAL_SPY_DRONE,
SPECIAL_DISGUISE_AS_VEHICLE,
#if RTS_ZEROHOUR
SPECIAL_BOOBY_TRAP,
#endif
// don't forget to add new strings to SpecialPowerMaskType::s_bitNameList[]
SPECIAL_REPAIR_VEHICLES,
SPECIAL_PARTICLE_UPLINK_CANNON,
Expand All @@ -90,8 +96,57 @@ enum SpecialPowerType CPP_11(: Int)
// don't forget to add new strings to SpecialPowerMaskType::s_bitNameList[]
SPECIAL_LAUNCH_BAIKONUR_ROCKET,

#if RTS_ZEROHOUR
SPECIAL_SPECTRE_GUNSHIP,
SPECIAL_GPS_SCRAMBLER,

SPECIAL_FRENZY,
SPECIAL_SNEAK_ATTACK,

//Ack, this is ass. These enums fix a bug where new enums were missing for
//shortcut powers... but the real clincher was that if you were say USA and
//captured a Tank China command center, your US paradrop would be assigned
//to the china tank drop and when you tried to fire it from the shortcut
//it could pick the china one and not fire it because it didn't have
//complete connection... ugh!!!
SPECIAL_CHINA_CARPET_BOMB,
EARLY_SPECIAL_CHINA_CARPET_BOMB,
SPECIAL_LEAFLET_DROP,
EARLY_SPECIAL_LEAFLET_DROP,
EARLY_SPECIAL_FRENZY,
SPECIAL_COMMUNICATIONS_DOWNLOAD,
EARLY_SPECIAL_REPAIR_VEHICLES,
SPECIAL_TANK_PARADROP,
SUPW_SPECIAL_PARTICLE_UPLINK_CANNON,
AIRF_SPECIAL_DAISY_CUTTER,
NUKE_SPECIAL_CLUSTER_MINES,
NUKE_SPECIAL_NEUTRON_MISSILE,
AIRF_SPECIAL_A10_THUNDERBOLT_STRIKE,
AIRF_SPECIAL_SPECTRE_GUNSHIP,
INFA_SPECIAL_PARADROP_AMERICA,
SLTH_SPECIAL_GPS_SCRAMBLER,
AIRF_SPECIAL_CARPET_BOMB,
SUPR_SPECIAL_CRUISE_MISSILE,
LAZR_SPECIAL_PARTICLE_UPLINK_CANNON,
SUPW_SPECIAL_NEUTRON_MISSILE,

SPECIAL_BATTLESHIP_BOMBARDMENT,

#endif
SPECIALPOWER_COUNT,
// don't forget to add new strings to SpecialPowerMaskType::s_bitNameList[]
};

#if RTS_GENERALS
static_assert(SPECIAL_HACKER_DISABLE_BUILDING == 24, "Generals special-power save ordinals changed");
static_assert(SPECIAL_LAUNCH_BAIKONUR_ROCKET == 39, "Generals special-power save ordinals changed");
static_assert(SPECIALPOWER_COUNT == 40, "Generals special-power count changed");
#elif RTS_ZEROHOUR
static_assert(SPECIAL_HELIX_NAPALM_BOMB == 24, "Zero Hour special-power save ordinals changed");
static_assert(SPECIAL_HACKER_DISABLE_BUILDING == 25, "Zero Hour special-power save ordinals changed");
static_assert(SPECIAL_BOOBY_TRAP == 34, "Zero Hour special-power save ordinals changed");
static_assert(SPECIAL_BATTLESHIP_BOMBARDMENT == 66, "Zero Hour special-power save ordinals changed");
static_assert(SPECIALPOWER_COUNT == 67, "Zero Hour special-power count changed");
#endif

// Definition of these names is located in SpecialPower.cpp
4 changes: 4 additions & 0 deletions Generals/Code/GameEngine/Include/Common/Team.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ class Team : public MemoryPoolObject,
a convenience routine used to estimate the team's position by just returning the position
of the first member of the team
*/
#if RTS_GENERALS
const Coord3D* getEstimateTeamPosition();
#elif RTS_ZEROHOUR
const Coord3D* getEstimateTeamPosition() const;
#endif

/**
a convenience routine to move a team's units to another team.
Expand Down
Loading
Loading