Skip to content

Commit 3c085e5

Browse files
committed
Some 'fixes' in scripts. More scripts. Displayed counters now show in their respective player's color. They also don't draw outside of the screen anymor - at least the first 128 or so. Enabling/Disabling scripts is now updated to take the team's m_genericScritpsToRun instead of the teamPrototype's.
1 parent c6d002c commit 3c085e5

15 files changed

Lines changed: 272 additions & 143 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ friend class Drawable; // for selection/deselection transactions
417417
virtual void hideObjectSuperweaponDisplayByScript(const Object *obj);
418418
virtual void showObjectSuperweaponDisplayByScript(const Object *obj);
419419

420-
void addNamedTimer( const AsciiString& timerName, const UnicodeString& text, Bool isCountdown );
420+
void addNamedTimer( const AsciiString& timerName, const UnicodeString& text, Bool isCountdown, Color color );
421421
void removeNamedTimer( const AsciiString& timerName );
422422
void showNamedTimerDisplay( Bool show );
423423

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class AISideInfo : public MemoryPoolObject
122122
TSkillSet m_skillSet6;
123123
TSkillSet m_skillSet7;
124124
AsciiString m_baseDefenseStructure1;
125-
std::vector<AsciiString> m_baseDefenseStructures; // @-TanSo-: why not be able to let the user of the World Builder specify more than one base defense structure?
125+
std::vector<AsciiString> m_baseDefenseStructures; // @-TanSo-: why not be able to let the user in the World Builder specify more than one base defense structure?
126126
AISideInfo *m_next;
127127
};
128128
EMPTY_DTOR(AISideInfo)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,12 @@ class ScriptActions : public ScriptActionsInterface
473473
void doTeamAttackMoveSeenType(const AsciiString& teamName, const AsciiString& objectType);
474474
void doTeamAttackMoveSeenArea(const AsciiString& teamName, const AsciiString& pTriggerParm);
475475
void doTeamAttackMoveSeenTypeArea(const AsciiString& teamName, const AsciiString& objectType, const AsciiString& pTriggerParm);
476+
void doTeamAttackMovePath(const AsciiString& teamName, const AsciiString& waypointPath);
476477

477478
void doTeamEvacuateDestroyedPercent(const AsciiString& teamName, Real value);
478479

479480

480-
// @-TanSo-: 73 additions
481+
// @-TanSo-: 74 additions
481482
//-------------------------------------------------------------------------------------------------
482483
//----------------------------- @CLP_AI SCRIPT ACTION ADDITIONS END -------------------------------
483484
//-------------------------------------------------------------------------------------------------

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ class ScriptConditions : public ScriptConditionsInterface
254254
Bool evaluateTeamSingleBelowHealth(Parameter* pTeamParm, Real value);
255255
Bool evaluateTeamBelowHealth(Parameter* pTeamParm, Real value);
256256

257-
// @-TanSo-: 49 additions, 1 helper method
257+
Bool evaluateTeamSeen(Parameter* pTeamParm);
258+
259+
// @-TanSo-: 50 additions, 1 helper method
258260
//-------------------------------------------------------------------------------------------------
259261
//---------------------------- @CLP_AI SCRIPT CONDITION ADDITIONS END -----------------------------
260262
//-------------------------------------------------------------------------------------------------

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class.
659659
TEAM_ATTACKMOVE_SEEN_TYPE, ///< Set a team to attack move towards units of a type the player sees.
660660
TEAM_ATTACKMOVE_SEEN_AREA, ///< Set a team to attack move towards units in an area the player sees.
661661
TEAM_ATTACKMOVE_SEEN_TYPE_AREA, ///< Set a team to attack move towards units of a type in an area the player sees.
662+
TEAM_ATTACKMOVE_PATH, ///< Set a team to attack move towards the beginning of a waypoint path.
662663
//-------------------------------------------------------------------------------------------------
663664
//--------------------------- @CLP_AI SCRIPT ACTIONS ADDITIONS END --------------------------------
664665
//-------------------------------------------------------------------------------------------------
@@ -1181,6 +1182,7 @@ class Condition : public MemoryPoolObject // This is the conditional class.
11811182
TEAM_BELOW_HEALTH, // True if the entire team drops below <real> & health.
11821183

11831184
TEAM_IDLE_FRAMES, // True if a team has been idling for at least the past <int> frames.
1185+
TEAM_SEEN, // True if at least one member of a team has been seen by enemy players.
11841186

11851187
//-------------------------------------------------------------------------------------------------
11861188
//---------------------------- @CLP_AI SCRIPT CONDITION ADDITIONS END -----------------------------

GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4714,6 +4714,9 @@ void Player::updateLastFrameSeen()
47144714
if (!them || them->isEffectivelyDead())
47154715
continue;
47164716

4717+
if (them->getStatusBits().test(OBJECT_STATUS_STEALTHED) && !them->getStatusBits().test(OBJECT_STATUS_DETECTED) && !them->getStatusBits().test(OBJECT_STATUS_DISGUISED))
4718+
continue;
4719+
47174720
them->m_seenByEnemy = true;
47184721
them->m_lastSeenFrame = TheGameLogic->getFrame();
47194722
}

GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,7 +2629,7 @@ void Team::xfer( Xfer *xfer )
26292629
{
26302630

26312631
// version
2632-
XferVersion currentVersion = 1;
2632+
XferVersion currentVersion = 2;
26332633
XferVersion version = currentVersion;
26342634
xfer->xferVersion( &version, currentVersion );
26352635

@@ -2752,6 +2752,17 @@ void Team::xfer( Xfer *xfer )
27522752
// player relations
27532753
xfer->xferSnapshot( m_playerRelations );
27542754

2755+
if (version >= 2)
2756+
{
2757+
// owned units
2758+
xfer->xferInt(&m_ownedUnits);
2759+
// max health
2760+
xfer->xferReal(&m_maxHealth);
2761+
// ghost health
2762+
xfer->xferReal(&m_ghostHealth);
2763+
// idle frames
2764+
xfer->xferInt(&m_idleFrames);
2765+
}
27552766
}
27562767

27572768
// ------------------------------------------------------------------------------------------------
@@ -2881,7 +2892,7 @@ void Team::updateHealth()
28812892
m_maxHealth += iter.cur()->getBodyModule()->getMaxHealth();
28822893
}
28832894
// Our team grew. Flush.
2884-
if (prevUnits > m_ownedUnits)
2895+
if (prevUnits < m_ownedUnits)
28852896
{
28862897
m_ghostHealth = 0.0f;
28872898
return;

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,12 @@ void InGameUI::xfer( Xfer *xfer )
413413
{
414414
Int timerCount = m_namedTimers.size();
415415
xfer->xferInt( &timerCount );
416-
for( NamedTimerMapIt timerIter = m_namedTimers.begin(); timerIter != m_namedTimers.end(); ++timerIter )
416+
for (NamedTimerMapIt timerIter = m_namedTimers.begin(); timerIter != m_namedTimers.end(); ++timerIter)
417417
{
418-
xfer->xferAsciiString( &(timerIter->second->m_timerName) );
419-
xfer->xferUnicodeString( &(timerIter->second->timerText) );
420-
xfer->xferBool( &(timerIter->second->isCountdown) );
418+
xfer->xferAsciiString(&(timerIter->second->m_timerName));
419+
xfer->xferUnicodeString(&(timerIter->second->timerText));
420+
xfer->xferBool(&(timerIter->second->isCountdown));
421+
xfer->xferColor(&(timerIter->second->color));
421422
}
422423
}
423424
else // iz a Load
@@ -429,11 +430,13 @@ void InGameUI::xfer( Xfer *xfer )
429430
AsciiString timerName;
430431
UnicodeString timerText;
431432
Bool isCountdown;
433+
Color color;
432434
xfer->xferAsciiString( &timerName );
433435
xfer->xferUnicodeString( &timerText );
434436
xfer->xferBool( &isCountdown );
437+
xfer->xferColor( &color );
435438

436-
addNamedTimer( timerName, timerText, isCountdown );
439+
addNamedTimer( timerName, timerText, isCountdown, color );
437440
}
438441
}
439442
}
@@ -760,11 +763,11 @@ Bool InGameUI::getSuperweaponDisplayEnabledByScript() const
760763

761764
// ------------------------------------------------------------------------------------------------
762765
// ------------------------------------------------------------------------------------------------
763-
void InGameUI::addNamedTimer( const AsciiString& timerName, const UnicodeString& text, Bool isCountdown )
766+
void InGameUI::addNamedTimer( const AsciiString& timerName, const UnicodeString& text, Bool isCountdown, Color color)
764767
{
765768
NamedTimerInfo *info = newInstance( NamedTimerInfo );
766769
info->m_timerName = timerName;
767-
info->color = m_namedTimerNormalColor;
770+
info->color = color;
768771
info->timerText = text;
769772
info->displayString = TheDisplayStringManager->newDisplayString();
770773
info->displayString->reset();
@@ -4060,7 +4063,7 @@ void InGameUI::postDraw()
40604063
}
40614064
}
40624065
}
4063-
4066+
Int timerCount = 0;
40644067
// draw named timers
40654068
if (TheGameLogic->getFrame() > 0 && m_showNamedTimers)
40664069
{
@@ -4144,8 +4147,15 @@ void InGameUI::postDraw()
41444147

41454148
// increment text spot to next location
41464149
startY -= info->displayString->getFont()->height;
4150+
4151+
timerCount++;
4152+
if (timerCount % 24 == 0) //@-TanSo-: when having too many counters on display, anything above the screen will obviously not be shown anymore.
4153+
{
4154+
startX -= 300;
4155+
startY += info->displayString->getFont()->height * 24;
4156+
}
41474157
}
4148-
}
4158+
}
41494159
}
41504160

41514161
// draw RMB scroll anchor

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /*
220220
{ "SkillSet3", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet3 ) },
221221
{ "SkillSet4", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet4 ) },
222222
{ "SkillSet5", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet5 ) },
223+
{ "SkillSet6", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet6 ) },
224+
{ "SkillSet7", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet7 ) },
223225
{ nullptr, nullptr, nullptr, 0 }
224226
};
225227

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4100,7 +4100,7 @@ void Object::xfer( Xfer *xfer )
41004100
{
41014101

41024102
// version
4103-
const XferVersion currentVersion = 9;
4103+
const XferVersion currentVersion = 10;
41044104
XferVersion version = currentVersion;
41054105
xfer->xferVersion( &version, currentVersion );
41064106

@@ -4503,6 +4503,14 @@ void Object::xfer( Xfer *xfer )
45034503
else
45044504
m_isReceivingDifficultyBonus = FALSE;
45054505

4506+
if (version >= 10)
4507+
{
4508+
xfer->xferBool(&m_seenByEnemy);
4509+
4510+
xfer->xferInt(&m_lastSeenFrame);
4511+
4512+
xfer->xferBool(&m_isBeingCaptured);
4513+
}
45064514
}
45074515

45084516
//-------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)