Merged from revision: 6792

Fixes (by Buggler)
- draw NCTH cursor indicator after health bar indicator due to potential overlap (thanks to Sevenfm)
- removed IMPROVED_BOMB_PLANTING option, enabled by default
- removed AIMED_BURST_ALTERNATE_KEY option, enabled by default. Alternate Aiming Hotkey reassigned to ',' (comma) for increasing aim
- streamlined burst & auto mode right click aim mechanism

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6793 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-01-20 08:49:56 +00:00
parent 056e5e31c5
commit d643847f42
7 changed files with 165 additions and 97 deletions
+1 -5
View File
@@ -1377,12 +1377,11 @@ void LoadGameExternalOptions()
// New setting to change stamina
gGameExternalOptions.uStaminaHit = iniReader.ReadInteger("Tactical Interface Settings", "STAMINA_HIT", 10000);
// Alternative system for aiming - progressive method depending on marksmash of Merc
// Alternative system for aiming - progressive method depending on marksmanship of Merc
gGameExternalOptions.bAltAimEnabled = iniReader.ReadBoolean("Tactical Interface Settings","ALT_AIMING_ENABLED",FALSE);
// Use aimed burst
gGameExternalOptions.bAimedBurstEnabled = iniReader.ReadBoolean("Tactical Interface Settings","USE_AIMED_BURST",FALSE);
gGameExternalOptions.bAimedBurstAlternateKey = iniReader.ReadBoolean("Tactical Interface Settings","AIMED_BURST_ALTERNATE_KEY",FALSE);
// Penalty for aimed burst
gGameExternalOptions.uAimedBurstPenalty = iniReader.ReadInteger("Tactical Interface Settings","AIMING_BURST_PENALTY",2, 0, 10);
@@ -1408,9 +1407,6 @@ void LoadGameExternalOptions()
// <GasCan>, <Marbles> and <Alcohol> add special bonuses to explosion
gGameExternalOptions.bAllowSpecialExplosiveAttachments = iniReader.ReadBoolean("Tactical Interface Settings","ALLOW_SPECIAL_EXPLOSIVE_ATTACHMENTS",FALSE);
// Automatically take new mine from inventory, use last tripwire network settings
gGameExternalOptions.bImprovedBombPlanting = iniReader.ReadBoolean("Tactical Interface Settings","IMPROVED_BOMB_PLANTING",FALSE);
// Chance to Say Annoying Phrase (you can just turn of it by button in game)
gGameExternalOptions.iChanceSayAnnoyingPhrase = iniReader.ReadInteger("Tactical Interface Settings","CHANCE_SAY_ANNOYING_PHRASE",100);
+3 -5
View File
@@ -794,16 +794,14 @@ typedef struct
//enable ext mouse key
BOOLEAN bAltAimEnabled;
BOOLEAN bAimedBurstEnabled;
BOOLEAN bAimedBurstAlternateKey; // Flugente: some users cannot use the mousewheel and are thus unable to aim auto-only weapons. This solves this by allowing to aim via a key command
INT16 uAimedBurstPenalty;
BOOLEAN bWeSeeWhatMilitiaSeesAndViceVersa;
BOOLEAN bAllowWearSuppressor;
BOOLEAN bLazyCivilians;
BOOLEAN bNeutralCiviliansAvoidPlayerMines; //sevenfm: Neutral civilians can detect mines with MAPELEMENT_PLAYER_MINE_PRESENT flag set
BOOLEAN bAddSmokeAfterExplosion;
BOOLEAN bAllowExplosiveAttachments;
BOOLEAN bAllowSpecialExplosiveAttachments;
BOOLEAN bImprovedBombPlanting;
BOOLEAN bAddSmokeAfterExplosion;
BOOLEAN bAllowExplosiveAttachments;
BOOLEAN bAllowSpecialExplosiveAttachments;
INT16 iChanceSayAnnoyingPhrase;
BOOLEAN bNewTacticalAIBehavior;
FLOAT uShotHeadPenalty;
+3
View File
@@ -130,4 +130,7 @@
#define ENTER 13
#define SPACE 32
#define COMMA 188
#define FULLSTOP 190
#endif
+2 -3
View File
@@ -4896,7 +4896,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo )
wcscpy( gzUserDefinedButton[15], L"4-D" );
// sevenfm: if SHIFT is pressed - plant tripwire with last network settings
if( gGameExternalOptions.bImprovedBombPlanting && _KeyDown( SHIFT ) && gubLastTripwire > 0 )
if( _KeyDown( SHIFT ) && gubLastTripwire > 0 )
BombMessageBoxCallBack(gubLastTripwire);
else
DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_TRIPWIRE_NETWORK ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS, BombMessageBoxCallBack, NULL );
@@ -6985,8 +6985,7 @@ void ExtendedBoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
void HandleTakeNewBombFromIventory(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj)
{
if(gGameExternalOptions.bImprovedBombPlanting &&
!( (gTacticalStatus.uiFlags & TURNBASED ) && (gTacticalStatus.uiFlags & INCOMBAT) ) &&
if( !( (gTacticalStatus.uiFlags & TURNBASED ) && (gTacticalStatus.uiFlags & INCOMBAT) ) &&
!pSoldier->inv[HANDPOS].exists() && _KeyDown( SHIFT ))
{
pSoldier->TakeNewBombFromIventory(pObj->usItem);
+8 -8
View File
@@ -714,14 +714,6 @@ void RenderTopmostTacticalInterface( )
RenderAccumulatedBurstLocations( );
// HEADROCK HAM 4: The NCTH indicator is now drawn to the FRAMEBUFFER instead of the MOUSEBUFFER. This is
// due to size constraints related to drawing directly on the cursor. This indicator follows the mouse, and
// is a mouse-cursor in everything but name. See the function itself for more details.
if (UsingNewCTHSystem() == true && gfUICtHBar)
{
DrawCTHIndicator();
}
// Loop through all mercs and make go
for ( cnt = 0; cnt < guiNumMercSlots; cnt++ )
{
@@ -752,6 +744,14 @@ void RenderTopmostTacticalInterface( )
DrawSelectedUIAboveGuy((UINT16)gsSelectedGuy );
}
// HEADROCK HAM 4: The NCTH indicator is now drawn to the FRAMEBUFFER instead of the MOUSEBUFFER. This is
// due to size constraints related to drawing directly on the cursor. This indicator follows the mouse, and
// is a mouse-cursor in everything but name. See the function itself for more details.
if (UsingNewCTHSystem() == true && gfUICtHBar)
{
DrawCTHIndicator();
}
// FOR THE MOST PART, DISABLE INTERFACE STUFF WHEN IT'S ENEMY'S TURN
if ( gTacticalStatus.ubCurrentTeam == gbPlayerNum )
{
+38 -35
View File
@@ -3869,18 +3869,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
else
{
// Flugente: alternate for people without mousewheel who want to aim auto-only weapons
if ( gGameExternalOptions.bAimedBurstEnabled && gGameExternalOptions.bAimedBurstAlternateKey && gCurrentUIMode == CONFIRM_ACTION_MODE )
{
SOLDIERTYPE * pSoldier;
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
{
HandleWheelAdjustCursor( pSoldier, usMapPos, 1,brstmode );
}
}
// nothing in hand and the Options Screen button for whichever panel we're in must be enabled
else if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons &&
if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons &&
( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ OPTIONS_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) )
{
if( !fDisableMapInterfaceDueToBattle )
@@ -4224,8 +4214,43 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
//else if( gusSelectedSoldier != NOBODY )
break;
case 'z':
if( fCtrl && fAlt )
{
if ( INFORMATION_CHEAT_LEVEL( ) )
{
ToggleZBuffer();
}
}
else if ( fAlt )
{
HandleTBToggleStealthAll();
}
else if ( fCtrl )
{
// used for "lock" / "unlock" the mouse cursor in windowed mode
}
else
{
HandleTBToggleStealth();
}
break;
case ',':
// Flugente: alternate for people without mousewheel to aim auto-only weapons
if ( gGameExternalOptions.bAimedBurstEnabled && gCurrentUIMode == CONFIRM_ACTION_MODE )
{
SOLDIERTYPE * pSoldier;
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
{
HandleRightClickAdjustCursor( pSoldier, usMapPos );
}
}
break;
// added by Flugente
case '.':
case '.':
if ( fCtrl && fAlt ) //jikuja: Create item by reusing old entered number
{
if ( CHEATER_CHEAT_LEVEL( ) )
@@ -4257,28 +4282,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break;
case 'z':
if( fCtrl && fAlt )
{
if ( INFORMATION_CHEAT_LEVEL( ) )
{
ToggleZBuffer();
}
}
else if ( fAlt )
{
HandleTBToggleStealthAll();
}
else if ( fCtrl )
{
// used for "lock" / "unlock" the mouse cursor in windowed mode
}
else
{
HandleTBToggleStealth();
}
break;
case '-':
case '_':
//if the display cover or line of sight is being displayed
@@ -6580,7 +6583,7 @@ void QueryTBWheel( UINT32 *puiNewEvent )
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
{
if( gGameExternalOptions.bAimedBurstEnabled )
HandleWheelAdjustCursor( pSoldier, usMapPos, -gViewportRegion.WheelState,brstmode );
HandleWheelAdjustCursor( pSoldier, usMapPos, -gViewportRegion.WheelState, brstmode );
else
HandleWheelAdjustCursorWOAB( pSoldier, usMapPos, -gViewportRegion.WheelState);
}
+110 -41
View File
@@ -2416,65 +2416,132 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos )
case TARGETCURS:
// CHECK IF GUY HAS IN HAND A WEAPON
if ( pSoldier->bDoBurst && !pSoldier->bDoAutofire)
if ( pSoldier->bDoBurst && !pSoldier->bDoAutofire && !gGameExternalOptions.bAimedBurstEnabled)
{
// Do nothing!
// Do nothing for aimed burst deactivated
// pSoldier->aiData.bShownAimTime = REFINE_AIM_BURST;
}
else if(pSoldier->bDoAutofire)
{
INT16 sCurAPCosts;
UINT16 usShotsLeft = pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft;
if (pSoldier->IsValidSecondHandBurst())
// aiming in auto mode using hotkey for mousewheel not working
if( gfKeyState[ COMMA ] && gGameExternalOptions.bAimedBurstEnabled )
{
usShotsLeft = min( (pSoldier->inv[ SECONDHANDPOS ][0]->data.gun.ubGunShotsLeft), usShotsLeft );
}
sGridNo = usMapPos;
bTargetLevel = (INT8)gsInterfaceLevel;
if(pSoldier->flags.autofireLastStep)
{
pSoldier->bDoAutofire = 1; //reset the bullet counter
pSoldier->flags.autofireLastStep = FALSE;
return;
}
if(usShotsLeft > pSoldier->bDoAutofire )
{
//Calculate how many bullets we need to fire to add at least one more AP
sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && usShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
// Look for a target here...
if ( gfUIFullTargetFound )
{
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
// Get target soldier, if one exists
pTSoldier = MercPtrs[ gusUIFullTargetID ];
sGridNo = pTSoldier->sGridNo;
bTargetLevel = pSoldier->pathing.bLevel;
if ( !HandleCheckForBadChangeToGetThrough( pSoldier, pTSoldier, sGridNo , bTargetLevel ) )
{
return;
}
}
//we've stepped over the border and used up one more ap, now let's make sure that it is spent to maximize the bullets
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + 1 );
sCurAPCosts = sAPCosts;
do
if ( bFutureAim <= maxAimLevels )
{
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && usShotsLeft >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim ) );
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
if(!EnoughPoints( pSoldier, sAPCosts, 0, FALSE )) //We've not enough points to fire those bullets
{
pSoldier->flags.autofireLastStep = TRUE;
pSoldier->bDoAutofire--;
// Determine if we can afford!
if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) )
{
pSoldier->aiData.bShownAimTime+= 1;
if ( pSoldier->aiData.bShownAimTime > maxAimLevels )
{
pSoldier->aiData.bShownAimTime = maxAimLevels;
}
}
// Else - goto first level!
else
{
if ( !gfDisplayFullCountRing )
{
gfDisplayFullCountRing = TRUE;
}
else
{
pSoldier->aiData.bShownAimTime = REFINE_AIM_1;
gfDisplayFullCountRing = FALSE;
}
}
}
else
pSoldier->flags.autofireLastStep = FALSE; //both last step conditions are false
{
if ( !gfDisplayFullCountRing )
{
gfDisplayFullCountRing = TRUE;
}
else
{
pSoldier->aiData.bShownAimTime = REFINE_AIM_1;
gfDisplayFullCountRing = FALSE;
}
}
}
// adjust number of bullets in auto mode
else
{
pSoldier->flags.autofireLastStep = TRUE;
INT16 sCurAPCosts;
UINT16 usShotsLeft = pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft;
if (pSoldier->IsValidSecondHandBurst())
{
usShotsLeft = min( (pSoldier->inv[ SECONDHANDPOS ][0]->data.gun.ubGunShotsLeft), usShotsLeft );
}
if(pSoldier->flags.autofireLastStep)
{
pSoldier->bDoAutofire = 1; //reset the bullet counter
pSoldier->flags.autofireLastStep = FALSE;
return;
}
if(usShotsLeft > pSoldier->bDoAutofire )
{
//Calculate how many bullets we need to fire to add at least one more AP
sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && usShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
{
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
}
//we've stepped over the border and used up one more ap, now let's make sure that it is spent to maximize the bullets
sCurAPCosts = sAPCosts;
do
{
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && usShotsLeft >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
if(!EnoughPoints( pSoldier, sAPCosts, 0, FALSE )) //We've not enough points to fire those bullets
{
pSoldier->flags.autofireLastStep = TRUE;
pSoldier->bDoAutofire--;
}
else
pSoldier->flags.autofireLastStep = FALSE; //both last step conditions are false
}
else
{
pSoldier->flags.autofireLastStep = TRUE;
}
}
}
// single fire mode
else
{
sGridNo = usMapPos;
@@ -3672,7 +3739,8 @@ void HandleWheelAdjustCursorWOAB( SOLDIERTYPE *pSoldier, INT32 sMapPos, INT32 sD
case PUNCHCURS:
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + (sDelta*REFINE_PUNCH_2) );
if(bFutureAim<0) return;
if(bFutureAim<0)
return;
if ( bFutureAim <= REFINE_PUNCH_2 )
{
sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(bFutureAim / 2) );
@@ -3698,7 +3766,8 @@ if(bFutureAim<0) return;
case KNIFECURS:
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + (sDelta*REFINE_KNIFE_2) );
if(bFutureAim<0) return;
if(bFutureAim<0)
return;
if ( bFutureAim <= REFINE_KNIFE_2 )
{
sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(bFutureAim / 2) );