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
4 changes: 2 additions & 2 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(GAMEENGINE_SRC
# Include/Common/AcademyStats.h
Include/Common/AcademyStats.h
# Include/Common/ActionManager.h
Include/Common/AddonCompat.h
Include/Common/ArchiveFile.h
Expand Down Expand Up @@ -621,7 +621,7 @@ set(GAMEENGINE_SRC
Source/Common/RandomValue.cpp
# Source/Common/Recorder.cpp
Source/Common/ReplaySimulation.cpp
# Source/Common/RTS/AcademyStats.cpp
Source/Common/RTS/AcademyStats.cpp
# Source/Common/RTS/ActionManager.cpp
# Source/Common/RTS/Energy.cpp
# Source/Common/RTS/Handicap.cpp
Expand Down
4 changes: 0 additions & 4 deletions Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8789,11 +8789,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
PathfindCell *ignoreCell = getClippedCell(goalObj->getLayer(), goalObj->getPosition());
if ( (goalCell->getObstacleID()==ignoreCell->getObstacleID()) && (goalCell->getObstacleID() != INVALID_ID) ) {
Object* newObstacle = TheGameLogic->findObjectByID(goalCell->getObstacleID());
#if RTS_GENERALS
if (newObstacle != nullptr && newObstacle->isKindOf(KINDOF_AIRFIELD))
#else
if (newObstacle != nullptr && newObstacle->isKindOf(KINDOF_FS_AIRFIELD))
#endif
{
m_ignoreObstacleID = goalCell->getObstacleID();
goalOnObstacle = true;
Expand Down
37 changes: 35 additions & 2 deletions Generals/Code/GameEngine/Include/Common/KindOf.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "Common/BitFlags.h"
#include "Common/BitFlagsIO.h"

//-------------------------------------------------------------------------------------------------
/** Kind of flags for determining groups of things that belong together
Expand All @@ -42,7 +43,7 @@ enum KindOfType CPP_11(: Int)
KINDOF_INVALID = -1,

KINDOF_OBSTACLE, ///< an obstacle to land-based pathfinders
KINDOF_SELECTABLE, ///< Selectable
KINDOF_SELECTABLE, ///< Actually means MOUSE-INTERACTABLE (doesn't mean you can select it!)
KINDOF_IMMOBILE, ///< fixed in location
KINDOF_CAN_ATTACK, ///< can attack
KINDOF_STICK_TO_TERRAIN_SLOPE, ///< should be stuck at ground level, aligned to terrain slope. requires that IMMOBILE bit is also set.
Expand Down Expand Up @@ -79,7 +80,9 @@ enum KindOfType CPP_11(: Int)
KINDOF_STEALTH_GARRISON, /** enemy teams can't tell that unit is in building.. and if they
garrison that building, they stealth unit will eject. */
KINDOF_CASH_GENERATOR, ///< used to check if the unit generates cash... checked by cash hackers and whatever else comes up
#if RTS_GENERALS
KINDOF_AIRFIELD, ///< unit has a runway that planes can takeoff/land on
#endif
KINDOF_DRAWABLE_ONLY, ///< template is used only to create drawables (not Objects)
KINDOF_MP_COUNT_FOR_VICTORY, ///< If a player loses all his buildings that have this kindof in a multiplayer game, he loses.
KINDOF_REBUILD_HOLE, ///< a GLA rebuild hole
Expand Down Expand Up @@ -119,7 +122,7 @@ enum KindOfType CPP_11(: Int)
KINDOF_TECH_BUILDING, ///< Neutral tech building - Oil derrick, Hospital, Radio Station, Refinery.
KINDOF_POWERED, ///< This object gets the Underpowered disabled condition when its owning player has power consumption exceed supply
KINDOF_PRODUCED_AT_HELIPAD, ///< ugh... hacky fix for comanche. (srj)
KINDOF_DRONE, ///< Object drone type -- used for filtering them out of battle plan bonuses and whatever else may come up.
KINDOF_DRONE, ///< Object drone type -- used for filtering them out of battle plan bonuses, making un-snipable, and whatever else may come up.
KINDOF_CAN_SEE_THROUGH_STRUCTURE,///< Structure does not block line of sight.
KINDOF_BALLISTIC_MISSILE, ///< Large ballistic missiles that are specifically large enough to be targetted by base defenses.
KINDOF_CLICK_THROUGH, ///< Objects with this will never be picked by mouse interactions!
Expand All @@ -139,6 +142,35 @@ enum KindOfType CPP_11(: Int)
KINDOF_HERO, ///< Any of the single-instance infantry, JarmenKell, BlackLotus, ColonelBurton
KINDOF_IGNORES_SELECT_ALL, ///< Too late to figure out intelligently if something should respond to a Select All command
KINDOF_DONT_AUTO_CRUSH_INFANTRY, ///< These units don't try to crush the infantry if ai.
// TheSuperHackers @info Added in Zero Hour:
KINDOF_CLIFF_JUMPER, ///< Can't climb cliffs, but can jump off of them.
KINDOF_FS_SUPPLY_DROPZONE, ///< A supply dropzone.
KINDOF_FS_SUPERWEAPON, ///< A superweapon structure like a nuke silo, particle uplink cannon, scudstorm.
KINDOF_FS_BLACK_MARKET, ///< Is this object a black market?
KINDOF_FS_SUPPLY_CENTER, ///< Is this object a supply center?
KINDOF_FS_STRATEGY_CENTER, ///< Is this object a strategy center?
KINDOF_MONEY_HACKER, ///< Unit that generates money from air. Needed for things that directly power them up.
KINDOF_ARMOR_SALVAGER, ///< subset of salvager that can get armor upgrades from salvage
KINDOF_REVEALS_ENEMY_PATHS, ///< like the listening outpost... when selected, any enemy drawable will draw show paths when moused over
KINDOF_BOOBY_TRAP, ///< A sticky bomb that gets set off by 5 random and unrelated events.
KINDOF_FS_FAKE, ///< Fake structure!
KINDOF_FS_INTERNET_CENTER, ///< Internet Center.
KINDOF_BLAST_CRATER, ///< deeply gouges out the terrain under object footprint
KINDOF_PROP, ///< A prop, visual only, doesn't interact with other objects (rock, street sign, inert fire hydrant)
KINDOF_OPTIMIZED_TREE, ///< An optimized, client side only tree. (The only good kind of tree. jba)
KINDOF_FS_ADVANCED_TECH, ///< Represents each faction's advanced techtree building -- strategy center, propaganda center, and palace.
KINDOF_FS_BARRACKS, ///< A barracks
KINDOF_FS_WARFACTORY, ///< A war factory or arms dealer.
KINDOF_FS_AIRFIELD, ///< An airfield.
KINDOF_AIRCRAFT_CARRIER, ///< An aircraft carrier.
KINDOF_NO_SELECT, ///< Can't select it but you can mouse over it to see it's health (drones!)
KINDOF_REJECT_UNMANNED, ///< Unit cannot enter an unmanned vehicle.
KINDOF_CANNOT_RETALIATE, ///< Unit will not retaliate if asked.
KINDOF_TECH_BASE_DEFENSE, ///< Tech Building that acts as base defence when captured
KINDOF_EMP_HARDENED, ///< Like a delivery plane (B52, B3, CargoPlane,etc.) or a SpectreGunship, which sort-of IS the weapon...
KINDOF_DEMOTRAP, ///< Added strictly only for disarming purposes. They don't act like mines which have rendering and selection implications!
KINDOF_CONSERVATIVE_BUILDING, ///< Conservative structures aren't considered part of your base for sneak attack boundary calculations...
KINDOF_IGNORE_DOCKING_BONES, ///< Structure will not look up docking bones. Patch 1.03 hack.

KINDOF_COUNT, // total number of kindofs
KINDOF_FIRST = 0,
Expand Down Expand Up @@ -186,3 +218,4 @@ inline void FLIP_KINDOFMASK(KindOfMaskType& m)

// defined in Common/System/Kindof.cpp
extern KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes
extern KindOfMaskType KINDOFMASK_FS; // Initializes all FS types for faction structures.
8 changes: 7 additions & 1 deletion Generals/Code/GameEngine/Include/Common/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#pragma once

#include "Common/AcademyStats.h"
#include "Common/Debug.h"
#include "Common/Energy.h"
#include "Common/GameType.h"
Expand Down Expand Up @@ -519,7 +520,7 @@ class Player : public Snapshot
/**
* Iterate all objects that this player has
*/
void iterateObjects( ObjectIterateFunc func, void *userData );
void iterateObjects( ObjectIterateFunc func, void *userData ) const;

/**
return this player's "default" team.
Expand Down Expand Up @@ -651,6 +652,9 @@ class Player : public Snapshot
void setCashBounty(Real percentage) { m_cashBountyPercent = percentage; }
void doBountyForKill(const Object* killer, const Object* victim);

AcademyStats* getAcademyStats() { return &m_academyStats; }
const AcademyStats* getAcademyStats() const { return &m_academyStats; }

//Set via logical message. Options menu sets the client value in global data. Player::update()
//detects a change, and posts a message. When the message gets processed, this value gets set.
Bool isLogicalRetaliationModeEnabled() const { return m_logicalRetaliationModeEnabled; }
Expand Down Expand Up @@ -772,6 +776,8 @@ class Player : public Snapshot
PlayerRelationMap *m_playerRelations; ///< allies & enemies
TeamRelationMap *m_teamRelations; ///< allies & enemies

AcademyStats m_academyStats; ///< Keeps track of various statistics in order to provide advice to the player about how to improve playing.

Bool m_canBuildUnits; ///< whether the current player is allowed to build units
Bool m_canBuildBase; ///< whether the current player is allowed to build Base buildings
Bool m_observer;
Expand Down
3 changes: 2 additions & 1 deletion Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PlayerTemplate
UnicodeString getDisplayName() const { return m_displayName; }

AsciiString getSide() const { return m_side; }
AsciiString getBaseSide() const { return m_baseSide; }

/// return the tech tree for the player.
const Handicap *getHandicap() const { return &m_handicap; }
Expand Down Expand Up @@ -142,7 +143,7 @@ class PlayerTemplate

NameKeyType m_nameKey;
UnicodeString m_displayName;
AsciiString m_side;
AsciiString m_side, m_baseSide;
Handicap m_handicap; ///< initial baseline for Player capabilities
Money m_money; ///< starting credits, if any
RGBColor m_preferredColor; ///< our preferred starting color
Expand Down
3 changes: 3 additions & 0 deletions Generals/Code/GameEngine/Include/Common/SpecialPower.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ObjectCreationList;
class Object;
enum ScienceType CPP_11(: Int);
struct FieldParse;
enum AcademyClassificationType CPP_11(: Int);

// For SpecialPowerType and SpecialPowerMaskType::s_bitNameList. Part of detangling.
#include "Common/SpecialPowerType.h"
Expand Down Expand Up @@ -121,6 +122,7 @@ class SpecialPowerTemplate : public Overridable
Real getViewObjectRange() const { return getFO()->m_viewObjectRange; }
Real getRadiusCursorRadius() const { return getFO()->m_radiusCursorRadius; }
Bool isShortcutPower() const { return getFO()->m_shortcutPower; }
AcademyClassificationType getAcademyClassificationType() const { return m_academyClassificationType; }

private:

Expand All @@ -133,6 +135,7 @@ class SpecialPowerTemplate : public Overridable
ScienceType m_requiredScience; ///< science required (if any) to actually execute this power
AudioEventRTS m_initiateSound; ///< sound to play when initiated
AudioEventRTS m_initiateAtLocationSound; ///< sound to play at target location (if any)
AcademyClassificationType m_academyClassificationType; ///< A value used by the academy to evaluate advice based on what players do.
UnsignedInt m_detectionTime; ///< (frames) after using infiltration power (defection, etc.),
///< how long it takes for ex comrades to realize it on their own
UnsignedInt m_viewObjectDuration; ///< Lifetime of a looking object we slap down so you can watch the effect
Expand Down
5 changes: 4 additions & 1 deletion Generals/Code/GameEngine/Include/Common/Upgrade.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Player;
class UpgradeTemplate;
enum NameKeyType CPP_11(: Int);
class Image;
enum AcademyClassificationType CPP_11(: Int);

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
Expand All @@ -51,7 +52,7 @@ enum UpgradeStatusType CPP_11(: Int)
};

//The maximum number of upgrades.
// TheSuperHackers @tweak Stubbjax 22/01/2026 Increases max upgrade count from 64 to allow for more upgrades.
// TheSuperHackers @tweak Stubbjax 22/01/2026 Increases max upgrade count from Generals:64, Zero Hour:128 to allow for more upgrades.
// A value of 512 was chosen to allow room for plenty of upgrades while also conserving memory.
#define UPGRADE_MAX_COUNT 512

Expand Down Expand Up @@ -178,6 +179,7 @@ class UpgradeTemplate : public MemoryPoolObject
UpgradeType getUpgradeType() const { return m_type; }
const AudioEventRTS* getResearchCompleteSound() const { return &m_researchSound; }
const AudioEventRTS* getUnitSpecificSound() const { return &m_unitSpecificSound; }
AcademyClassificationType getAcademyClassificationType() const { return m_academyClassificationType; }

/// inventory pictures
void cacheButtonImage();
Expand Down Expand Up @@ -207,6 +209,7 @@ class UpgradeTemplate : public MemoryPoolObject
UpgradeMaskType m_upgradeMask; ///< Unique bitmask for this upgrade template
AudioEventRTS m_researchSound; ///< Sound played when upgrade researched.
AudioEventRTS m_unitSpecificSound; ///< Secondary sound played when upgrade researched.
AcademyClassificationType m_academyClassificationType; ///< A value used by the academy to evaluate advice based on what players do.

UpgradeTemplate *m_next; ///< next
UpgradeTemplate *m_prev; ///< prev
Expand Down
12 changes: 6 additions & 6 deletions Generals/Code/GameEngine/Include/GameClient/CommandXlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class CommandTranslator : public GameMessageTranslator
Int m_objective;
Bool m_teamExists; ///< is there a currently selected "team"?

// these are for determining if a drag occurred or it was just a sloppy click
ICoord2D m_mouseRightDragAnchor; // the location of a possible mouse drag start
ICoord2D m_mouseRightDragLift; // the location of a possible mouse drag end
UnsignedInt m_mouseRightDown; // when the mouse down happened
UnsignedInt m_mouseRightUp; // when the mouse up happened
// these are for determining if a drag occurred or it was just a sloppy click
ICoord2D m_mouseRightDragAnchor; // the location of a possible mouse drag start
ICoord2D m_mouseRightDragLift; // the location of a possible mouse drag end
UnsignedInt m_mouseRightDown; // when the mouse down happened
UnsignedInt m_mouseRightUp; // when the mouse up happened

GameMessage::Type createMoveToLocationMessage( Drawable *draw, const Coord3D *dest, CommandEvaluateType commandType );
GameMessage::Type createMoveToLocationMessage( Drawable *draw, const Coord3D *dest, CommandEvaluateType commandType );
GameMessage::Type createAttackMessage( Drawable *draw, Drawable *other, CommandEvaluateType commandType );
GameMessage::Type createEnterMessage( Drawable *enter, CommandEvaluateType commandType );
GameMessage::Type issueMoveToLocationCommand( const Coord3D *pos, Drawable *drawableInWay, CommandEvaluateType commandType );
Expand Down
11 changes: 10 additions & 1 deletion Generals/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ friend class Drawable; // for selection/deselection transactions
ACTIONTYPE_MAKE_DEFECTOR,
ACTIONTYPE_SET_RALLY_POINT,
ACTIONTYPE_COMBATDROP_INTO,
ACTIONTYPE_SABOTAGE_BUILDING,

NUM_ACTIONTYPES
};
Expand Down Expand Up @@ -538,10 +539,12 @@ friend class Drawable; // for selection/deselection transactions
void setCameraRotateRight( Bool set ) { m_cameraRotatingRight = set; }
void setCameraZoomIn( Bool set ) { m_cameraZoomingIn = set; }
void setCameraZoomOut( Bool set ) { m_cameraZoomingOut = set; }
void setCameraTrackingDrawable( Bool set ) { m_cameraTrackingDrawable = set; }
Bool isCameraRotatingLeft() const { return m_cameraRotatingLeft; }
Bool isCameraRotatingRight() const { return m_cameraRotatingRight; }
Bool isCameraZoomingIn() const { return m_cameraZoomingIn; }
Bool isCameraZoomingOut() const { return m_cameraZoomingOut; }
Bool isCameraTrackingDrawable() const { return m_cameraTrackingDrawable; }
void resetCamera();

virtual void addIdleWorker( Object *obj );
Expand Down Expand Up @@ -586,6 +589,9 @@ friend class Drawable; // for selection/deselection transactions
void registerWindowLayout(WindowLayout *layout); // register a layout for updates
void unregisterWindowLayout(WindowLayout *layout); // stop updates for this layout

void triggerDoubleClickAttackMoveGuardHint();


public:
// World 2D animation methods
void addWorldAnimation( Anim2DTemplate *animTemplate,
Expand Down Expand Up @@ -647,7 +653,7 @@ friend class Drawable; // for selection/deselection transactions
struct MilitarySubtitleData
{
UnicodeString subtitle; ///< The complete subtitle to be drawn, each line is separated by L"\n"
UnsignedInt index; ///< the current index that we are at through the sibtitle
UnsignedInt index; ///< the current index that we are at through the subtitle
ICoord2D position; ///< Where on the screen the subtitle should be drawn
DisplayString *displayStrings[MAX_SUBTITLE_LINES]; ///< We'll only allow MAX_SUBTITLE_LINES worth of display strings
UnsignedInt currentDisplayString; ///< contains the current display string we're on. (also lets us know the last display string allocated
Expand Down Expand Up @@ -726,6 +732,8 @@ friend class Drawable; // for selection/deselection transactions
Int m_maxSelectCount; ///< Max number of objects to select
UnsignedInt m_frameSelectionChanged; ///< Frame when the selection last changed.

Int m_duringDoubleClickAttackMoveGuardHintTimer; ///< Frames left to draw the doubleClickFeedbackTimer
Coord3D m_duringDoubleClickAttackMoveGuardHintStashedPosition;

// Video playback data
VideoBuffer* m_videoBuffer; ///< video playback buffer
Expand Down Expand Up @@ -930,6 +938,7 @@ friend class Drawable; // for selection/deselection transactions
Bool m_cameraRotatingLeft;
Bool m_cameraRotatingRight;
Bool m_cameraZoomingIn;
Bool m_cameraTrackingDrawable;
Bool m_cameraZoomingOut;

Bool m_drawRMBScrollAnchor;
Expand Down
3 changes: 3 additions & 0 deletions Generals/Code/GameEngine/Include/GameLogic/GameLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class GameLogic : public SubsystemInterface, public Snapshot

void preUpdate();

#if defined(RTS_DEBUG)
Int getNumberSleepyUpdates() const {return m_sleepyUpdates.size();} //For profiling, so not in Release.
#endif
void processCommandList( CommandList *list ); ///< process the command list

void prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rankPoints ); ///< prepare for new game
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class ContainModuleInterface
virtual PlayerMaskType getPlayerWhoEntered() const = 0;

virtual void processDamageToContained(Real percentDamage) = 0; ///< Do our % damage to units now.
virtual Object* getClosestRider ( const Coord3D *pos ) = 0;

virtual void enableLoadSounds( Bool enable ) = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class OpenContain : public UpdateModule,

virtual void enableLoadSounds( Bool enable ) override { m_loadSoundsEnabled = enable; }

virtual Object* getClosestRider ( const Coord3D *pos ) override;
protected:

virtual void monitorConditionChanges(); ///< check to see if we need to update our occupant postions from a model change or anything else
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Bool ActionManager::canGetRepairedAt( const Object *obj, const Object *repairDes
{
// aircraft require an airfield.
if( !obj->isAboveTerrain() ||
repairDest->isKindOf( KINDOF_AIRFIELD ) == FALSE )
repairDest->isKindOf( KINDOF_FS_AIRFIELD ) == FALSE )
return FALSE;
}
else
Expand Down Expand Up @@ -577,7 +577,7 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt
}

// Special case for aircraft.
if( obj->isKindOf( KINDOF_AIRCRAFT ) && objectToEnter->isKindOf( KINDOF_AIRFIELD ) )
if( obj->isKindOf( KINDOF_AIRCRAFT ) && objectToEnter->isKindOf( KINDOF_FS_AIRFIELD ) )
{
if (!obj->isAboveTerrain())
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ void Player::healAllObjects()
}

//=============================================================================
void Player::iterateObjects( ObjectIterateFunc func, void *userData )
void Player::iterateObjects( ObjectIterateFunc func, void *userData ) const
{
for (PlayerTeamList::const_iterator it = m_playerTeamPrototypes.begin();
it != m_playerTeamPrototypes.end(); ++it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
static const FieldParse TheFieldParseTable[] =
{
{ "Side", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_side ) },
{ "BaseSide", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_baseSide ) },
{ "PlayableSide", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_playableSide ) },
{ "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( PlayerTemplate, m_displayName) },
{ "StartMoney", PlayerTemplate::parseStartMoney, nullptr, offsetof( PlayerTemplate, m_money ) },
Expand Down
Loading
Loading