Walkman: bonus 20% to morale when in head slot.

Update soldier morale every turn.
Update soldier morale when changing inventory.
Improved code for 'l' hotkey.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8783 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-04-10 21:20:05 +00:00
parent 4e34605f86
commit 3eb699c45f
7 changed files with 25 additions and 42 deletions
+3
View File
@@ -9881,6 +9881,9 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason )
} }
} }
} }
// sevenfm: update morale, as we could add/remove walkman
RefreshSoldierMorale(pSoldier);
} }
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN)
{ {
+3
View File
@@ -4005,6 +4005,9 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
// Flugente: we have to recheck our flashlights, as we changed items // Flugente: we have to recheck our flashlights, as we changed items
//gpSMCurrentMerc->usSoldierFlagMask |= SOLDIER_REDOFLASHLIGHT; //gpSMCurrentMerc->usSoldierFlagMask |= SOLDIER_REDOFLASHLIGHT;
gpSMCurrentMerc->HandleFlashLights(); gpSMCurrentMerc->HandleFlashLights();
// sevenfm: update morale, as we could add/remove walkman
RefreshSoldierMorale(gpSMCurrentMerc);
} }
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN)
{ {
+6 -8
View File
@@ -12254,19 +12254,17 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
return( FoundKit ); return( FoundKit );
} }
INT8 FindWalkman( SOLDIERTYPE * pSoldier ) INT8 FindWalkman(SOLDIERTYPE * pSoldier)
{ {
for (INT8 bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; ++bLoop) // sevenfm: walkman only works from head slot
for (INT8 bLoop = HEAD1POS; bLoop <= HEAD2POS; bLoop++)
{ {
if (pSoldier->inv[bLoop].exists() ) if (pSoldier->inv[bLoop].exists() && Item[pSoldier->inv[bLoop].usItem].walkman)
{ {
if (Item[pSoldier->inv[bLoop].usItem].walkman ) return(bLoop);
{
return( bLoop );
}
} }
} }
return( NO_SLOT ); return(NO_SLOT);
} }
INT8 FindTrigger( SOLDIERTYPE * pSoldier ) INT8 FindTrigger( SOLDIERTYPE * pSoldier )
+9
View File
@@ -391,6 +391,15 @@ void RefreshSoldierMorale( SOLDIERTYPE * pSoldier )
// Flugente: drug system has been redone // Flugente: drug system has been redone
iActualMorale += pSoldier->newdrugs.size[DRUG_EFFECT_MORALE]; iActualMorale += pSoldier->newdrugs.size[DRUG_EFFECT_MORALE];
// sevenfm: bonus 20% to morale when using walkman
if (FindWalkman(pSoldier) != NO_SLOT && pSoldier->bDeafenedCounter == 0)
{
if (pSoldier->ubProfile != NO_PROFILE && gMercProfiles[pSoldier->ubProfile].bDisability == DEAF)
iActualMorale += iActualMorale / 10;
else
iActualMorale += iActualMorale / 5;
}
iActualMorale = __min( 100, iActualMorale ); iActualMorale = __min( 100, iActualMorale );
iActualMorale = __max( 0, iActualMorale ); iActualMorale = __max( 0, iActualMorale );
+3
View File
@@ -7875,6 +7875,9 @@ void SOLDIERTYPE::EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCou
HandleEndTurnDrugAdjustments_New( this ); HandleEndTurnDrugAdjustments_New( this );
} }
// sevenfm: update morale
RefreshSoldierMorale(this);
// ATE: Don't bleed if in AUTO BANDAGE! // ATE: Don't bleed if in AUTO BANDAGE!
if ( !gTacticalStatus.fAutoBandageMode ) if ( !gTacticalStatus.fAutoBandageMode )
{ {
+1 -32
View File
@@ -3840,7 +3840,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break; break;
#endif #endif
} }
if (fAlt ) else if (fAlt )
{ {
// used for quickloading // used for quickloading
} }
@@ -3849,37 +3849,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
// used for loading game // used for loading game
} }
else else
/*
if( fAlt )
{
if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
LeaveTacticalScreen( GAME_SCREEN );
DoQuickLoad();
}
}
else if( fCtrl )
{
if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
gfSaveGame = FALSE;
gfCameDirectlyFromGame = TRUE;
guiPreviousOptionScreen = GAME_SCREEN;
LeaveTacticalScreen( SAVE_LOAD_SCREEN );
}
*//*
if ( INFORMATION_CHEAT_LEVEL( ) )
{
*puiNewEvent = I_LEVELNODEDEBUG;
CountLevelNodes();
}
*//*
}
else*/
{ {
// nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel
if ( ( gpItemPointer == NULL ) && if ( ( gpItemPointer == NULL ) &&
-2
View File
@@ -2960,8 +2960,6 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot)
{ {
INT16 ubMinAPcost; INT16 ubMinAPcost;
pBestShot->ubPossible = FALSE; pBestShot->ubPossible = FALSE;
pBestShot->bWeaponIn = NO_SLOT;
pBestShot->bWeaponIn = FindAIUsableObjClass(pSoldier, IC_GUN); pBestShot->bWeaponIn = FindAIUsableObjClass(pSoldier, IC_GUN);
// if the soldier does have a gun // if the soldier does have a gun