Added "Real Time Mode" (by borys762 and The_Bob)

- To look for code changes search for "The_Bob" comments
- There are 2 new entries in the ja2_options.ini in the [JA2 Tactical Settings] section: ALLOW_REAL_TIME_SNEAK, QUIET_REAL_TIME_SNEAK

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2921 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-06-02 10:25:42 +00:00
parent 2f36054c50
commit afaba958c5
4 changed files with 80 additions and 3 deletions
+7
View File
@@ -678,6 +678,13 @@ void LoadGameExternalOptions()
gGameExternalOptions.fEnableArmorCoverage = iniReader.ReadBoolean("JA2 Tactical Settings", "ENABLE_ARMOR_COVERAGE", FALSE); // ShadoWarrior for Captain J's armor coverage
// The_Bob - real time sneaking code 01/06/09
// Suport disabling real time sneaking via external .ini file
gGameExternalOptions.fAllowRealTimeSneak = iniReader.ReadBoolean("JA2 Real Time Sneaking Settings","ALLOW_REAL_TIME_SNEAK", FALSE);
// Silence the RT sneaking messages
gGameExternalOptions.fQuietRealTimeSneak = iniReader.ReadBoolean("JA2 Real Time Sneaking Settings","QUIET_REAL_TIME_SNEAK", FALSE);
//################# Rain Settings ##################
// Rain settings
+4
View File
@@ -629,6 +629,10 @@ BOOLEAN gbBulletTracer;
// HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainers will rest if no trainees available. 3 = Trainees will rest if no trainers available (not recommended). 1 = Both. 0 = Neither.
UINT8 ubSmartTrainingRest;
// The_Bob - real time sneaking code 01/06/09
// Suport disabling/silencing real time sneaking via external .ini file
BOOLEAN fAllowRealTimeSneak;
BOOLEAN fQuietRealTimeSneak;
} GAME_EXTERNAL_OPTIONS;
//This structure will contain general Ja2 settings NOT individual game settings.
+48
View File
@@ -246,6 +246,8 @@ UINT8 gubCheatLevel = STARTING_CHEAT_LEVEL;
extern BOOLEAN CompatibleAmmoForGun( OBJECTTYPE *pTryObject, OBJECTTYPE *pTestObject );
extern void DetermineWhichAssignmentMenusCanBeShown( void );
extern void DetermineWhichMilitiaControlMenusCanBeShown( void ); //lalien
// The_Bob - real time sneaking, 01-06-09
extern BOOLEAN WeSeeNoOne(void); // Needed to control entering turn-based with ctrl-x
void GetTBMouseButtonInput( UINT32 *puiNewEvent )
{
@@ -2363,7 +2365,53 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
}
else if ( fCtrl ) // The_Bob - real time sneaking, 01-06-09
{ // ctrl-x: enter turn based while sneaking - check if RT sneak is on, iw we're not already in combat and if we actually see any enemies
if (gGameExternalOptions.fAllowRealTimeSneak)
{
BOOLEAN fSneakingInRealTime = true;
if( gTacticalStatus.uiFlags & INCOMBAT )
{ // Don't allow this in combat
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"In combat already !");
fSneakingInRealTime = false;
}
if( WeSeeNoOne() )
{ // Don't allow this if no enemies are seen - we have the forced turn mode for that
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"No enemies in sight !");
fSneakingInRealTime = false;
}
if (fSneakingInRealTime)
EnterCombatMode(OUR_TEAM);
}
}
break;
// The_Bob - real time sneaking, 01-06-09
case 'X': // shift-ctrl-x: toggle real time sneaking
if ( fCtrl )
{
if (gGameExternalOptions.fAllowRealTimeSneak)
{
gGameExternalOptions.fAllowRealTimeSneak = false;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Real-time sneaking OFF");
if( !WeSeeNoOne() ) // if we're sneaking up on someone, enter turn-based
EnterCombatMode(OUR_TEAM);
}
else
{
gGameExternalOptions.fAllowRealTimeSneak = true;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Real-time sneaking ON");
}
}
break;
case '/':
+21 -3
View File
@@ -74,6 +74,9 @@ void DecayWatchedLocs( INT8 bTeam );
void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT8 * pPersOL, INT8 * pbPublOL );
// The_Bob - real time sneaking code 01/06/09
extern void CancelItemPointer(void);
extern BOOLEAN NobodyAlerted(void);
//#define TESTOPPLIST
// for ManSeesMan()
@@ -480,9 +483,24 @@ void HandleBestSightingPositionInRealtime( void )
//if (gfHumanSawSomeoneInRealtime)
{
if (gubBestToMakeSighting[ 1 ] == NOBODY)
{
// award turn
EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam );
{ // The_Bob - real time sneaking code 01/06/09
// if real time sneaking conditions are met...
if (gGameExternalOptions.fAllowRealTimeSneak && MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == OUR_TEAM && NobodyAlerted() )
{
// get rid of the item under cursor (we gotta react FAST)
CancelItemPointer();
// select (and center screen on) the merc who saw the enemy
if (gusSelectedSoldier != (UINT16)MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID)
SelectSoldier (MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID, false, true);
// if not quiet, emit a message warning the player
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Enemy spotted! (ctrl-x to enter turn based)");
return; // and do nothing
}
else
// otherwise, simply award the turn to the team that saw the enemy first
EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam );
}
else
{