mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Play sound when dragging something (Sounds\Misc\DragBody1.ogg .. DragBodyN.ogg).
Mercs always make movement noise when dragging. Stop dragging if another merc starts dragging this merc/body. Stop dragging if dragged merc gets up from collapsed state. Stop dragging when changing stance/cowering under suppression. Fixed grenade pin sound for signal smoke. CalcBestShot: if new opponent is dying and best opponent is ok, ignore new opponent. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8759 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2760,6 +2760,9 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
PROFILLUA_ubDirectiono = pSoldier->ubDirection;
|
PROFILLUA_ubDirectiono = pSoldier->ubDirection;
|
||||||
PROFILLUA_bTeam = pSoldier->bTeam;
|
PROFILLUA_bTeam = pSoldier->bTeam;
|
||||||
|
|
||||||
|
// sevenfm: reached new spot, enabled dragging sound
|
||||||
|
pSoldier->usSoldierFlagMask2 &= ~SOLDIER_DRAG_SOUND;
|
||||||
|
|
||||||
// ATE; Handle bad guys, as they fade, to cancel it if
|
// ATE; Handle bad guys, as they fade, to cancel it if
|
||||||
// too long...
|
// too long...
|
||||||
// ONLY if fading IN!
|
// ONLY if fading IN!
|
||||||
@@ -8825,6 +8828,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
|||||||
pSoldier->bScopeMode = USE_BEST_SCOPE;
|
pSoldier->bScopeMode = USE_BEST_SCOPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sevenfm: stop dragging when changing stance/cowering under suppression
|
||||||
|
pSoldier->CancelDrag();
|
||||||
|
|
||||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: change stance"));
|
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: change stance"));
|
||||||
pSoldier->ChangeSoldierStance( ubNewStance );
|
pSoldier->ChangeSoldierStance( ubNewStance );
|
||||||
|
|
||||||
|
|||||||
@@ -3037,7 +3037,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
|
|||||||
else if (Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SMOKE ||
|
else if (Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SMOKE ||
|
||||||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_TEARGAS ||
|
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_TEARGAS ||
|
||||||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_MUSTGAS ||
|
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_MUSTGAS ||
|
||||||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SMOKE)
|
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE)
|
||||||
{
|
{
|
||||||
if (fDelay)
|
if (fDelay)
|
||||||
sprintf(zFilename, "sounds\\grenade\\grenade_gas_delay.ogg");
|
sprintf(zFilename, "sounds\\grenade\\grenade_gas_delay.ogg");
|
||||||
@@ -9967,6 +9967,17 @@ void SOLDIERTYPE::BeginSoldierGetup( void )
|
|||||||
{
|
{
|
||||||
// get up you hoser!
|
// get up you hoser!
|
||||||
|
|
||||||
|
// sevenfm: if someone is dragging this soldier, cancel drag
|
||||||
|
SOLDIERTYPE *pSoldier;
|
||||||
|
for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
|
||||||
|
{
|
||||||
|
pSoldier = MercPtrs[uiLoop];
|
||||||
|
if (pSoldier && pSoldier->usDragPersonID == this->ubID)
|
||||||
|
{
|
||||||
|
pSoldier->CancelDrag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->bCollapsed = FALSE;
|
this->bCollapsed = FALSE;
|
||||||
this->bTurnsCollapsed = 0;
|
this->bTurnsCollapsed = 0;
|
||||||
|
|
||||||
@@ -11451,7 +11462,7 @@ InternalpSoldier->GivingSoldierCancelServices(, FALSE );
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
INT16 gsDragSoundNum = -1;
|
||||||
|
|
||||||
void SOLDIERTYPE::MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange )
|
void SOLDIERTYPE::MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange )
|
||||||
{
|
{
|
||||||
@@ -11577,6 +11588,33 @@ void SOLDIERTYPE::MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckR
|
|||||||
// Flugente: drag people
|
// Flugente: drag people
|
||||||
if ( currentlydragging )
|
if ( currentlydragging )
|
||||||
{
|
{
|
||||||
|
// sevenfm: play sound while dragging
|
||||||
|
if (!(this->usSoldierFlagMask2 & SOLDIER_DRAG_SOUND))
|
||||||
|
{
|
||||||
|
CHAR8 zFilename[512];
|
||||||
|
// prepare drag sound
|
||||||
|
if (gsDragSoundNum < 0)
|
||||||
|
{
|
||||||
|
gsDragSoundNum = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
gsDragSoundNum++;
|
||||||
|
sprintf(zFilename, "Sounds\\Misc\\DragBody%d.ogg", gsDragSoundNum);
|
||||||
|
} while (FileExists(zFilename));
|
||||||
|
gsDragSoundNum--;
|
||||||
|
}
|
||||||
|
if (gsDragSoundNum > 0)
|
||||||
|
{
|
||||||
|
sprintf(zFilename, "Sounds\\Misc\\DragBody%d.ogg", Random(gsDragSoundNum) + 1);
|
||||||
|
if (FileExists(zFilename))
|
||||||
|
{
|
||||||
|
PlayJA2SampleFromFile(zFilename, RATE_11025, SoundVolume(MIDVOLUME, this->sGridNo), 1, SoundDir(this->sGridNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->usSoldierFlagMask2 |= SOLDIER_DRAG_SOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( this->usDragPersonID != NOBODY )
|
if ( this->usDragPersonID != NOBODY )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE* pSoldier = MercPtrs[this->usDragPersonID];
|
SOLDIERTYPE* pSoldier = MercPtrs[this->usDragPersonID];
|
||||||
@@ -20096,6 +20134,17 @@ void SOLDIERTYPE::SetDragOrderPerson( UINT16 usID )
|
|||||||
{
|
{
|
||||||
if ( CanDragPerson( usID ) )
|
if ( CanDragPerson( usID ) )
|
||||||
{
|
{
|
||||||
|
// sevenfm: if someone is dragging this soldier, cancel drag
|
||||||
|
SOLDIERTYPE *pSoldier;
|
||||||
|
for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
|
||||||
|
{
|
||||||
|
pSoldier = MercPtrs[uiLoop];
|
||||||
|
if (pSoldier && pSoldier->usDragPersonID == usID)
|
||||||
|
{
|
||||||
|
pSoldier->CancelDrag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CancelDrag();
|
CancelDrag();
|
||||||
|
|
||||||
this->usDragPersonID = usID;
|
this->usDragPersonID = usID;
|
||||||
@@ -20106,6 +20155,17 @@ void SOLDIERTYPE::SetDragOrderCorpse( UINT32 usID )
|
|||||||
{
|
{
|
||||||
if ( CanDragCorpse( usID ) )
|
if ( CanDragCorpse( usID ) )
|
||||||
{
|
{
|
||||||
|
// sevenfm: if someone is dragging this corpse, cancel drag
|
||||||
|
SOLDIERTYPE *pSoldier;
|
||||||
|
for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
|
||||||
|
{
|
||||||
|
pSoldier = MercPtrs[uiLoop];
|
||||||
|
if (pSoldier && pSoldier->sDragCorpseID == usID)
|
||||||
|
{
|
||||||
|
pSoldier->CancelDrag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CancelDrag();
|
CancelDrag();
|
||||||
|
|
||||||
this->sDragCorpseID = usID;
|
this->sDragCorpseID = usID;
|
||||||
|
|||||||
@@ -424,6 +424,8 @@ enum
|
|||||||
#define SOLDIER_MERC_POW_LOCATIONKNOWN 0x00020000 // we are a POW, but the player has discovered our location
|
#define SOLDIER_MERC_POW_LOCATIONKNOWN 0x00020000 // we are a POW, but the player has discovered our location
|
||||||
#define SOLDIER_SURGERY_BOOSTED 0x00040000 // we are a boosted performing surgery (e.g. by using up a blood bag)
|
#define SOLDIER_SURGERY_BOOSTED 0x00040000 // we are a boosted performing surgery (e.g. by using up a blood bag)
|
||||||
|
|
||||||
|
#define SOLDIER_DRAG_SOUND 0x00080000 // played sound when started dragging
|
||||||
|
|
||||||
#define SOLDIER_INTERROGATE_ALL 0x000001F8 // all interrogation flags
|
#define SOLDIER_INTERROGATE_ALL 0x000001F8 // all interrogation flags
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -5497,6 +5497,12 @@ UINT8 MovementNoise(SOLDIERTYPE *pSoldier)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sevenfm: if dragging something, add dragging sound volume
|
||||||
|
if(pSoldier->IsDraggingSomeone())
|
||||||
|
{
|
||||||
|
sVolume = max(sVolume, MAX_MOVEMENT_NOISE / 2 + Random(MAX_MOVEMENT_NOISE) + bGroundVolumeModifier);
|
||||||
|
}
|
||||||
|
|
||||||
sVolume = max(0, sVolume);
|
sVolume = max(0, sVolume);
|
||||||
sVolume = min(255, sVolume);
|
sVolume = min(255, sVolume);
|
||||||
|
|
||||||
|
|||||||
@@ -712,10 +712,15 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
|||||||
continue; // next opponent
|
continue; // next opponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//dnl ch62 180813 ignore firing into dying targets
|
|
||||||
// sevenfm: disabled because of problems with AI
|
// sevenfm: if new opponent is dying and best opponent is ok, ignore new opponent
|
||||||
//if((pOpponent->bCollapsed || pOpponent->bBreathCollapsed) && pOpponent->stats.bLife < OKLIFE/* && !(pSoldier->aiData.bAttitude == AGGRESSIVE && Random(100) < 20)*/)
|
if (pBestShot->ubOpponent != NOBODY &&
|
||||||
//continue;
|
Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE &&
|
||||||
|
pOpponent->stats.bLife < OKLIFE)
|
||||||
|
{
|
||||||
|
//DebugShot(pSoldier, String("new opponent is dying, best opponent is ok - skip"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// OOOF! That was a lot of work! But we've got a new best target!
|
// OOOF! That was a lot of work! But we've got a new best target!
|
||||||
pBestShot->ubPossible = TRUE;
|
pBestShot->ubPossible = TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user