mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Improved Auto Fast Forward (by Sevenfm)
- New options in ja2_options.ini AUTO_FAST_FORWARD_ENEMIES: 0 - default behavior 1 - auto fast forward only enemies that are not seen by player's team 2 - auto fast forward only invisible enemies 3 - auto fast forward all enemies AUTO_FAST_FORWARD_MILITIA: 0 - default behavior 1 - auto fast forward only militia that does not see enemies 2 - auto fast forward militia always Note: only movement is accelerated, most of specific actions like shooting and tossing grenades are performed at normal speed git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6693 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2126,6 +2126,10 @@ void LoadGameExternalOptions()
|
|||||||
gGameExternalOptions.iFastForwardPeriod = (FLOAT)iniReader.ReadDouble("Clock Settings","FAST_FORWARD_PERIOD", 500, 1, 10000);
|
gGameExternalOptions.iFastForwardPeriod = (FLOAT)iniReader.ReadDouble("Clock Settings","FAST_FORWARD_PERIOD", 500, 1, 10000);
|
||||||
gGameExternalOptions.fClockSpeedPercent = (FLOAT)iniReader.ReadDouble("Clock Settings","CLOCK_SPEED_PERCENT", 150, 100, 300);
|
gGameExternalOptions.fClockSpeedPercent = (FLOAT)iniReader.ReadDouble("Clock Settings","CLOCK_SPEED_PERCENT", 150, 100, 300);
|
||||||
gGameExternalOptions.iNotifyFrequency = iniReader.ReadInteger("Clock Settings","UPDATE_FREQUENCY", 16000, 1000, 20000);
|
gGameExternalOptions.iNotifyFrequency = iniReader.ReadInteger("Clock Settings","UPDATE_FREQUENCY", 16000, 1000, 20000);
|
||||||
|
|
||||||
|
// sevenfm: improved auto fast forwarding
|
||||||
|
gGameExternalOptions.ubAutoFastForwardEnemies = iniReader.ReadInteger("Clock Settings","AUTO_FAST_FORWARD_ENEMIES", 0, 0, 3);
|
||||||
|
gGameExternalOptions.ubAutoFastForwardMilitia = iniReader.ReadInteger("Clock Settings", "AUTO_FAST_FORWARD_MILITIA", 0, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1251,6 +1251,10 @@ typedef struct
|
|||||||
// Frequency that the screen is updated
|
// Frequency that the screen is updated
|
||||||
FLOAT fClockSpeedPercent;
|
FLOAT fClockSpeedPercent;
|
||||||
|
|
||||||
|
// sevenfm: improved auto fast forwarding
|
||||||
|
UINT8 ubAutoFastForwardEnemies;
|
||||||
|
UINT8 ubAutoFastForwardMilitia;
|
||||||
|
|
||||||
// Flugente: Weapon Overheating
|
// Flugente: Weapon Overheating
|
||||||
BOOLEAN fWeaponOverheating; // Should weapons overheat, thus increasing the chance of malfunction?
|
BOOLEAN fWeaponOverheating; // Should weapons overheat, thus increasing the chance of malfunction?
|
||||||
BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed?
|
BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed?
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ extern void AdjustNoAPToFinishMove( SOLDIERTYPE *pSoldier, BOOLEAN fSet );
|
|||||||
void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier);
|
void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier);
|
||||||
void HandleAITacticalTraversal( SOLDIERTYPE * pSoldier );
|
void HandleAITacticalTraversal( SOLDIERTYPE * pSoldier );
|
||||||
|
|
||||||
|
void UpdateFastForwardMode( SOLDIERTYPE* pSoldier );
|
||||||
|
|
||||||
extern UINT8 gubElementsOnExplosionQueue;
|
extern UINT8 gubElementsOnExplosionQueue;
|
||||||
|
|
||||||
extern BOOLEAN gfWaitingForTriggerTimer;
|
extern BOOLEAN gfWaitingForTriggerTimer;
|
||||||
@@ -1321,6 +1323,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((pSoldier->aiData.bAction != AI_ACTION_NONE) && pSoldier->aiData.bActionInProgress)
|
if ((pSoldier->aiData.bAction != AI_ACTION_NONE) && pSoldier->aiData.bActionInProgress)
|
||||||
{
|
{
|
||||||
// if action should remain in progress
|
// if action should remain in progress
|
||||||
@@ -1638,6 +1641,8 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
|||||||
// relying on a stored path from there is a bad idea.
|
// relying on a stored path from there is a bad idea.
|
||||||
pSoldier->pathing.usPathDataSize = pSoldier->pathing.usPathIndex = pSoldier->pathing.bPathStored = 0;
|
pSoldier->pathing.usPathDataSize = pSoldier->pathing.usPathIndex = pSoldier->pathing.bPathStored = 0;
|
||||||
|
|
||||||
|
UpdateFastForwardMode( pSoldier );
|
||||||
|
|
||||||
switch (pSoldier->aiData.bAction)
|
switch (pSoldier->aiData.bAction)
|
||||||
{
|
{
|
||||||
case AI_ACTION_NONE: // maintain current position & facing
|
case AI_ACTION_NONE: // maintain current position & facing
|
||||||
@@ -2593,3 +2598,90 @@ void HandleAITacticalTraversal( SOLDIERTYPE * pSoldier )
|
|||||||
CheckForEndOfBattle( TRUE );
|
CheckForEndOfBattle( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateFastForwardMode( SOLDIERTYPE* pSoldier )
|
||||||
|
{
|
||||||
|
BOOLEAN action = FALSE;
|
||||||
|
BOOLEAN forward = FALSE;
|
||||||
|
BOOLEAN found = FALSE;
|
||||||
|
UINT16 cnt;
|
||||||
|
SOLDIERTYPE * ps;
|
||||||
|
|
||||||
|
if( ( gGameExternalOptions.ubAutoFastForwardEnemies == 0 && gGameExternalOptions.ubAutoFastForwardMilitia == 0 ) ||
|
||||||
|
!gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] ||
|
||||||
|
is_networked ||
|
||||||
|
!( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) ||
|
||||||
|
pSoldier->bTeam == OUR_TEAM )
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch ( pSoldier->aiData.bAction )
|
||||||
|
{
|
||||||
|
case AI_ACTION_TOSS_PROJECTILE:
|
||||||
|
case AI_ACTION_KNIFE_MOVE:
|
||||||
|
case AI_ACTION_FIRE_GUN:
|
||||||
|
case AI_ACTION_THROW_KNIFE:
|
||||||
|
case AI_ACTION_PULL_TRIGGER:
|
||||||
|
case AI_ACTION_USE_DETONATOR:
|
||||||
|
case AI_ACTION_OPEN_OR_CLOSE_DOOR:
|
||||||
|
case AI_ACTION_LOWER_GUN:
|
||||||
|
case AI_ACTION_RAISE_GUN:
|
||||||
|
case AI_ACTION_CLIMB_ROOF:
|
||||||
|
case AI_ACTION_STEAL_MOVE:
|
||||||
|
case AI_ACTION_JUMP_WINDOW:
|
||||||
|
case AI_ACTION_USE_SKILL:
|
||||||
|
action = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pSoldier->bTeam == MILITIA_TEAM )
|
||||||
|
{
|
||||||
|
switch( gGameExternalOptions.ubAutoFastForwardMilitia )
|
||||||
|
{
|
||||||
|
case 0: // default mode
|
||||||
|
forward = gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE];
|
||||||
|
break;
|
||||||
|
case 1: // auto fast forward this militiaman if he does not see opponents
|
||||||
|
if( pSoldier->aiData.bOppCnt == 0 )
|
||||||
|
forward = TRUE && !action;
|
||||||
|
break;
|
||||||
|
case 2: // auto fast forward all militia
|
||||||
|
forward = TRUE && !action;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch ( gGameExternalOptions.ubAutoFastForwardEnemies )
|
||||||
|
{
|
||||||
|
case 0: // default mode
|
||||||
|
forward = gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE];
|
||||||
|
break;
|
||||||
|
case 1: // auto fast forward enemy soldier only if player team does not see him
|
||||||
|
for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ )
|
||||||
|
{
|
||||||
|
ps = MercPtrs[ cnt ];
|
||||||
|
found= FALSE;
|
||||||
|
if (ps->bActive && ps->bInSector && ps->stats.bLife >= OKLIFE)
|
||||||
|
{
|
||||||
|
if (ps->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY)
|
||||||
|
{
|
||||||
|
found= TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forward = !found && !action;
|
||||||
|
break;
|
||||||
|
case 2: // auto fast forward only invisible enemies
|
||||||
|
if( pSoldier->bVisible == -1 )
|
||||||
|
forward = TRUE && !action;
|
||||||
|
break;
|
||||||
|
case 3: // always auto fast forward movements
|
||||||
|
forward = TRUE && !action;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( IsFastForwardMode() != forward )
|
||||||
|
SetFastForwardMode( forward );
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user