Skip to content

Commit cb91723

Browse files
authored
Merge pull request #46 from Andreas-W/misc_updates2
Misc updates2
2 parents 386fa4a + 04636ab commit cb91723

File tree

9 files changed

+55
-14
lines changed

9 files changed

+55
-14
lines changed

GeneralsMD/Code/GameEngine/Include/Common/KindOf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ enum KindOfType CPP_11(: Int)
172172
KINDOF_IGNORE_DOCKING_BONES, ///< Structure will not look up docking bones. Patch 1.03 hack.
173173

174174
// NEW KINDOFs
175+
KINDOF_CAN_RETALIATE, ///< Required for Drones to override hardcoded retaliate behavior
176+
177+
KINDOF_NO_BATTLE_PLAN, ///< No implicit logic, but can be used for BattlePlan ValidKindof lists
178+
179+
KINDOF_ENABLE_INFANTRY_LIGHTING, ///< Enable infantry-style ambient lighting for this object
180+
KINDOF_DISABLE_INFANTRY_LIGHTING, ///< Use regular lighting on this infantry object
175181

176182
KINDOF_VTOL,
177183
KINDOF_LARGE_AIRCRAFT,
@@ -203,6 +209,8 @@ enum KindOfType CPP_11(: Int)
203209
KINDOF_EXTRA14,
204210
KINDOF_EXTRA15,
205211
KINDOF_EXTRA16,
212+
KINDOF_EXTRA17,
213+
KINDOF_EXTRA18,
206214

207215

208216
KINDOF_COUNT // total number of kindofs

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattlePlanBonusBehavior.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class BattlePlanBonusBehaviorModuleData : public BehaviorModuleData
5252
public:
5353
UpgradeMuxData m_upgradeMuxData;
5454

55-
Bool m_initiallyActive; // Apply upgrade immediately (Does this make sense?)
55+
Bool m_initiallyActive; // Apply upgrade immediately
5656
Bool m_overrideGlobal; // Do not apply effects from global BattlePlan bonus
5757
Bool m_shouldParalyze; // Paralyze this unit when applying BattlePlans
5858

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ExperienceScalarUpgrade.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ExperienceScalarUpgradeModuleData: public UpgradeModuleData
4949

5050
static void buildFieldParse(MultiIniFieldParse& p);
5151

52+
Bool m_initiallyActive; // Apply upgrade immediately
5253
Real m_addXPScalar; ///< Additive bonus to scalar for XP this unit gains
5354
Real m_addXPValueScalar; ///< Additive bonus to scalar for XP this unit gives when killed
5455

GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ class WeaponTemplate : public MemoryPoolObject
459459
inline const AudioEventRTS& getFireSound() const { return m_fireSound; }
460460
inline UnsignedInt getFireSoundLoopTime() const { return m_fireSoundLoopTime; }
461461
inline UnsignedInt getContinuousLaserLoopTime() const { return m_continuousLaserLoopTime; }
462+
inline Real getLaserGroundUnitTargetHeight() const { return m_laserGroundUnitTargetHeight; }
463+
inline Real getLaserGroundTargetHeight() const { return m_laserGroundTargetHeight; }
462464
inline UnsignedInt getScatterTargetResetTime() const { return m_scatterTargetResetTime; }
463465
inline const std::vector<Coord2D>& getScatterTargetsVector() const { return m_scatterTargets; }
464466
inline const WeaponBonusSet* getExtraBonus() const { return m_extraBonus; }
@@ -588,6 +590,9 @@ class WeaponTemplate : public MemoryPoolObject
588590

589591
UnsignedInt m_continuousLaserLoopTime; ///< time between shots the continuos laser object is kept alive instead of creating a new one
590592

593+
Real m_laserGroundTargetHeight; ///< when targeting the ground with a laser weapon, aim this much above
594+
Real m_laserGroundUnitTargetHeight; ///< when targeting ground units with a laser weapon, aim this much above
595+
591596
Bool m_scatterTargetAligned; ///< if the scatter target pattern is aligned to the shooter
592597
Bool m_scatterTargetRandom; ///< if the scatter target pattern is fired in a random order
593598
Bool m_scatterTargetRandomAngle; ///< if the scatter target pattern is randomly aligned

GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ const char* KindOfMaskType::s_bitNameList[] =
158158
"DEMOTRAP",
159159
"CONSERVATIVE_BUILDING",
160160
"IGNORE_DOCKING_BONES",
161+
"CAN_RETALIATE",
162+
163+
"NO_BATTLE_PLAN",
164+
165+
"ENABLE_INFANTRY_LIGHTING",
166+
"DISABLE_INFANTRY_LIGHTING",
161167

162168
"VTOL",
163169
"LARGE_AIRCRAFT",
@@ -189,6 +195,8 @@ const char* KindOfMaskType::s_bitNameList[] =
189195
"EXTRA14",
190196
"EXTRA15",
191197
"EXTRA16",
198+
"EXTRA17",
199+
"EXTRA18",
192200

193201
NULL
194202
};

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ Bool ActiveBody::shouldRetaliate(Object *obj)
810810
if (obj->isKindOf( KINDOF_IMMOBILE )) {
811811
return false;
812812
}
813-
// Drones never retaliate. [8/25/2003]
814-
if (obj->isKindOf(KINDOF_DRONE)) {
813+
// Drones never retaliate [8/25/2003] except when they do [2025/09/07]
814+
if (obj->isKindOf(KINDOF_DRONE) && !obj->isKindOf(KINDOF_CAN_RETALIATE)) {
815815
return false;
816816
}
817817
// Any unit that isn't idle won't retaliate. [8/25/2003]

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
//-------------------------------------------------------------------------------------------------
4040
ExperienceScalarUpgradeModuleData::ExperienceScalarUpgradeModuleData( void )
4141
{
42+
m_initiallyActive = false;
4243
m_addXPScalar = 0.0f;
4344
m_addXPValueScalar = 0.0f;
4445
}
@@ -52,6 +53,7 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p)
5253

5354
static const FieldParse dataFieldParse[] =
5455
{
56+
{ "StartsActive", INI::parseBool, NULL, offsetof(ExperienceScalarUpgradeModuleData, m_initiallyActive) },
5557
{ "AddXPScalar", INI::parseReal, NULL, offsetof( ExperienceScalarUpgradeModuleData, m_addXPScalar ) },
5658
{ "AddXPValueScalar", INI::parseReal, NULL, offsetof( ExperienceScalarUpgradeModuleData, m_addXPValueScalar ) },
5759
{ 0, 0, 0, 0 }
@@ -65,6 +67,10 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p)
6567
//-------------------------------------------------------------------------------------------------
6668
ExperienceScalarUpgrade::ExperienceScalarUpgrade( Thing *thing, const ModuleData* moduleData ) : UpgradeModule( thing, moduleData )
6769
{
70+
if (getExperienceScalarUpgradeModuleData()->m_initiallyActive)
71+
{
72+
giveSelfUpgrade();
73+
}
6874
}
6975

7076
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] =
249249
{ "VeterancyPreAttackFX", parsePerVetLevelFXList, NULL, offsetof(WeaponTemplate, m_preAttackFXs) },
250250
{ "PreAttackFXDelay", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_preAttackFXDelay) },
251251
{ "ContinuousLaserLoopTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_continuousLaserLoopTime) },
252+
{ "LaserGroundTargetHeight", INI::parseReal, NULL, offsetof(WeaponTemplate, m_laserGroundTargetHeight) },
253+
{ "LaserGroundUnitTargetHeight", INI::parseReal, NULL, offsetof(WeaponTemplate, m_laserGroundUnitTargetHeight) },
252254
{ NULL, NULL, NULL, 0 } // keep this last
253255

254256
};
@@ -341,6 +343,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL)
341343
m_scatterTargetCenteredAtShooter = FALSE;
342344
m_scatterTargetResetTime = 0;
343345
m_preAttackFXDelay = 6; // Non-Zero default! 6 frames = 200ms. This should be a good base value to avoid spamming
346+
m_laserGroundUnitTargetHeight = 10; // Default Height offset
344347
}
345348

346349
//-------------------------------------------------------------------------------------------------
@@ -1066,11 +1069,16 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate
10661069
// Handle Detonation OCL
10671070
Coord3D targetPos; // We need a better position to match the visual laser;
10681071
targetPos.set(&projectileDestination);
1069-
if (victimObj && !victimObj->isKindOf(KINDOF_PROJECTILE) && !victimObj->isAirborneTarget())
1070-
{
1071-
//Targets are positioned on the ground, so raise the beam up so we're not shooting their feet.
1072-
//Projectiles are a different story, target their exact position.
1073-
targetPos.z += 10.0f;
1072+
1073+
if (victimObj) {
1074+
if (!victimObj->isKindOf(KINDOF_PROJECTILE) && !victimObj->isAirborneTarget()) {
1075+
//Targets are positioned on the ground, so raise the beam up so we're not shooting their feet.
1076+
//Projectiles are a different story, target their exact position.
1077+
targetPos.z += m_laserGroundUnitTargetHeight;
1078+
}
1079+
}
1080+
else { // We target the ground
1081+
targetPos.z += m_laserGroundTargetHeight;
10741082
}
10751083

10761084
VeterancyLevel vet = sourceObj->getVeterancyLevel();
@@ -2592,11 +2600,15 @@ ObjectID Weapon::createLaser( const Object *sourceObj, const Object *victimObj,
25922600
if( update )
25932601
{
25942602
Coord3D pos = *victimPos;
2595-
if( victimObj && !victimObj->isKindOf( KINDOF_PROJECTILE ) && !victimObj->isAirborneTarget() )
2596-
{
2597-
//Targets are positioned on the ground, so raise the beam up so we're not shooting their feet.
2598-
//Projectiles are a different story, target their exact position.
2599-
pos.z += 10.0f;
2603+
if( victimObj) {
2604+
if (!victimObj->isKindOf(KINDOF_PROJECTILE) && !victimObj->isAirborneTarget()) {
2605+
//Targets are positioned on the ground, so raise the beam up so we're not shooting their feet.
2606+
//Projectiles are a different story, target their exact position.
2607+
pos.z += getTemplate()->getLaserGroundUnitTargetHeight();
2608+
}
2609+
}
2610+
else { // We target the ground
2611+
pos.z += getTemplate()->getLaserGroundTargetHeight();
26002612
}
26012613
update->initLaser( sourceObj, victimObj, sourceObj->getPosition(), &pos, m_template->getLaserBoneName() );
26022614
}

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I
651651
}
652652
}
653653

654-
if (draw->isKindOf(KINDOF_INFANTRY))
654+
if ((draw->isKindOf(KINDOF_INFANTRY) && !draw->isKindOf(KINDOF_DISABLE_INFANTRY_LIGHTING)) ||
655+
draw->isKindOf(KINDOF_ENABLE_INFANTRY_LIGHTING))
655656
{ //ambient = m_infantryAmbient; //has no effect - see comment on m_infantryAmbient
656657
sceneLights = m_infantryLight;
657658
}

0 commit comments

Comments
 (0)