mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Fix (by Sevenfm) - noise volume was capped so less important noises could be stored in the AI noise memory
New feature - mercs can now also open doors from the side instead of the front git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8630 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-2
@@ -55,8 +55,8 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CHAR8 czVersionNumber[16] = { "Build 18.16.10" }; //YY.MM.DD
|
CHAR8 czVersionNumber[16] = { "Build 18.30.10" }; //YY.MM.DD
|
||||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||||
CHAR16 zRevisionNumber[16] = { L"Revision 8629" };
|
CHAR16 zRevisionNumber[16] = { L"Revision 8630" };
|
||||||
|
|
||||||
// SAVE_GAME_VERSION is defined in header, change it there
|
// SAVE_GAME_VERSION is defined in header, change it there
|
||||||
|
|||||||
+44
-1
@@ -97,6 +97,7 @@
|
|||||||
#include "Options Screen.h"
|
#include "Options Screen.h"
|
||||||
#include "SaveLoadScreen.h"
|
#include "SaveLoadScreen.h"
|
||||||
#include "Map Screen Interface.h" // added by Flugente for SquadNames
|
#include "Map Screen Interface.h" // added by Flugente for SquadNames
|
||||||
|
#include "Keys.h" // added by silversurfer for door handling from the side
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// SANDRO - In this file, all APBPConstants[AP_CROUCH] and APBPConstants[AP_PRONE] were changed to GetAPsCrouch() and GetAPsProne()
|
// SANDRO - In this file, all APBPConstants[AP_CROUCH] and APBPConstants[AP_PRONE] were changed to GetAPsCrouch() and GetAPsProne()
|
||||||
@@ -2181,8 +2182,50 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent )
|
|||||||
// Set dest gridno
|
// Set dest gridno
|
||||||
sDestGridNo = sActionGridNo;
|
sDestGridNo = sActionGridNo;
|
||||||
|
|
||||||
|
// silversurfer: we allow opening unlocked doors from the side so our mercs are not turned into Swiss cheese, hopefully...
|
||||||
|
bool bSideOpenDoor = false;
|
||||||
|
|
||||||
|
// sliding doors have only one action tile so if we want to be able to open them from both ends we need to allow 2 tiles max distance
|
||||||
|
if ( pStructure->fFlags & STRUCTURE_ANYDOOR && PythSpacesAway( pSoldier->sGridNo, sDestGridNo ) <= 2 )
|
||||||
|
{
|
||||||
|
DOOR *pDoor = FindDoorInfoAtGridNo( FindDoorAtGridNoOrAdjacent( sIntTileGridNo ) );
|
||||||
|
|
||||||
|
// Simple doors without properties will not be found by FindDoorInfoAtGridNo. We only allow those and unlocked doors to be opened from the side.
|
||||||
|
if ( !pDoor || (pDoor && !pDoor->fLocked) )
|
||||||
|
{
|
||||||
|
//make sure the merc is actually at the wall and next to the door
|
||||||
|
switch( pStructure->ubWallOrientation )
|
||||||
|
{
|
||||||
|
// orientation NW - SE
|
||||||
|
case INSIDE_TOP_LEFT:
|
||||||
|
if ( (sDestGridNo - pSoldier->sGridNo == 1) || (pSoldier->sGridNo - sDestGridNo == 1) ||
|
||||||
|
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == 2) )
|
||||||
|
bSideOpenDoor = true;
|
||||||
|
break;
|
||||||
|
// orientation SW - NE
|
||||||
|
case INSIDE_TOP_RIGHT:
|
||||||
|
if ( (sDestGridNo - pSoldier->sGridNo == WORLD_COLS) || (pSoldier->sGridNo - sDestGridNo == WORLD_COLS) ||
|
||||||
|
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == WORLD_COLS *2) )
|
||||||
|
bSideOpenDoor = true;
|
||||||
|
break;
|
||||||
|
// orientation NW - SE
|
||||||
|
case OUTSIDE_TOP_LEFT:
|
||||||
|
if ( (sDestGridNo - pSoldier->sGridNo == 1) || (pSoldier->sGridNo - sDestGridNo == 1) ||
|
||||||
|
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == 2) )
|
||||||
|
bSideOpenDoor = true;
|
||||||
|
break;
|
||||||
|
// orientation SW - NE
|
||||||
|
case OUTSIDE_TOP_RIGHT:
|
||||||
|
if ( (sDestGridNo - pSoldier->sGridNo == WORLD_COLS) || (pSoldier->sGridNo - sDestGridNo == WORLD_COLS) ||
|
||||||
|
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == WORLD_COLS *2) )
|
||||||
|
bSideOpenDoor = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if we are at this location
|
// check if we are at this location
|
||||||
if ( pSoldier->sGridNo == sDestGridNo )
|
if ( pSoldier->sGridNo == sDestGridNo || bSideOpenDoor )
|
||||||
{
|
{
|
||||||
StartInteractiveObject( sIntTileGridNo, pStructure->usStructureID, pSoldier, ubDirection );
|
StartInteractiveObject( sIntTileGridNo, pStructure->usStructureID, pSoldier, ubDirection );
|
||||||
InteractWithInteractiveObject( pSoldier, pStructure, ubDirection );
|
InteractWithInteractiveObject( pSoldier, pStructure, ubDirection );
|
||||||
|
|||||||
+30
-20
@@ -6412,6 +6412,9 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
}
|
}
|
||||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "%d hears noise from %d (%d/%d) volume %d", pSoldier->ubID, ubNoiseMaker, sGridNo, bLevel, ubVolume ) );
|
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "%d hears noise from %d (%d/%d) volume %d", pSoldier->ubID, ubNoiseMaker, sGridNo, bLevel, ubVolume ) );
|
||||||
|
|
||||||
|
// sevenfm: scale ubVolume to remember noise
|
||||||
|
UINT8 ubVolumeScaled = (UINT8)sqrt((float)ubVolume);
|
||||||
|
|
||||||
// "Turn head" towards the source of the noise and try to see what's there
|
// "Turn head" towards the source of the noise and try to see what's there
|
||||||
|
|
||||||
// don't use DistanceVisible here, but use maximum visibility distance
|
// don't use DistanceVisible here, but use maximum visibility distance
|
||||||
@@ -6527,6 +6530,16 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// sevenfm: remember noise even for seen opponents
|
||||||
|
if( pSoldier->flags.uiStatusFlags & SOLDIER_PC && ubVolumeScaled > pSoldier->aiData.ubNoiseVolume )
|
||||||
|
{
|
||||||
|
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
||||||
|
pSoldier->aiData.sNoiseGridno = sGridNo;
|
||||||
|
pSoldier->bNoiseLevel = bLevel;
|
||||||
|
|
||||||
|
// no matter how loud noise was, don't remember it for more than 12 turns!
|
||||||
|
pSoldier->aiData.ubNoiseVolume = min(ubVolumeScaled, MAX_MISC_NOISE_DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else // noise maker still can't be seen
|
else // noise maker still can't be seen
|
||||||
@@ -6552,21 +6565,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
// ubnoisemaker, leaving the 'seen' flag FALSE. See ProcessNoise().
|
// ubnoisemaker, leaving the 'seen' flag FALSE. See ProcessNoise().
|
||||||
|
|
||||||
// CJC: set the noise gridno for the soldier, if appropriate - this is what is looked at by the AI!
|
// CJC: set the noise gridno for the soldier, if appropriate - this is what is looked at by the AI!
|
||||||
if (ubVolume >= pSoldier->aiData.ubNoiseVolume)
|
if (ubVolumeScaled >= pSoldier->aiData.ubNoiseVolume)
|
||||||
{
|
{
|
||||||
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
||||||
pSoldier->aiData.sNoiseGridno = sGridNo;
|
pSoldier->aiData.sNoiseGridno = sGridNo;
|
||||||
pSoldier->bNoiseLevel = bLevel;
|
pSoldier->bNoiseLevel = bLevel;
|
||||||
|
|
||||||
// no matter how loud noise was, don't remember it for than 12 turns!
|
// no matter how loud noise was, don't remember it for more than 12 turns!
|
||||||
if (ubVolume < MAX_MISC_NOISE_DURATION)
|
pSoldier->aiData.ubNoiseVolume = min(ubVolumeScaled, MAX_MISC_NOISE_DURATION);
|
||||||
{
|
|
||||||
pSoldier->aiData.ubNoiseVolume = ubVolume;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetNewSituation( pSoldier ); // force a fresh AI decision to be made
|
SetNewSituation( pSoldier ); // force a fresh AI decision to be made
|
||||||
}
|
}
|
||||||
@@ -6667,21 +6673,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
{
|
{
|
||||||
// check if the effective volume of this new noise is greater than or at
|
// check if the effective volume of this new noise is greater than or at
|
||||||
// least equal to the volume of the currently noticed noise stored
|
// least equal to the volume of the currently noticed noise stored
|
||||||
if (ubVolume >= pSoldier->aiData.ubNoiseVolume)
|
if (ubVolumeScaled >= pSoldier->aiData.ubNoiseVolume)
|
||||||
{
|
{
|
||||||
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
||||||
pSoldier->aiData.sNoiseGridno = sGridNo;
|
pSoldier->aiData.sNoiseGridno = sGridNo;
|
||||||
pSoldier->bNoiseLevel = bLevel;
|
pSoldier->bNoiseLevel = bLevel;
|
||||||
|
|
||||||
// no matter how loud noise was, don't remember it for than 12 turns!
|
// no matter how loud noise was, don't remember it for more than 12 turns!
|
||||||
if (ubVolume < MAX_MISC_NOISE_DURATION)
|
pSoldier->aiData.ubNoiseVolume = min(ubVolumeScaled, MAX_MISC_NOISE_DURATION);
|
||||||
{
|
|
||||||
pSoldier->aiData.ubNoiseVolume = ubVolume;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetNewSituation( pSoldier ); // force a fresh AI decision to be made
|
SetNewSituation( pSoldier ); // force a fresh AI decision to be made
|
||||||
}
|
}
|
||||||
@@ -6690,6 +6689,17 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
// if listener sees the source of the noise, AND it's either a grenade,
|
// if listener sees the source of the noise, AND it's either a grenade,
|
||||||
// or it's a rock that he watched land (didn't need to turn)
|
// or it's a rock that he watched land (didn't need to turn)
|
||||||
{
|
{
|
||||||
|
// sevenfm: allow player mercs to hear all noises
|
||||||
|
if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC && ubVolumeScaled > pSoldier->aiData.ubNoiseVolume)
|
||||||
|
{
|
||||||
|
// yes it is, so remember this noise INSTEAD (old noise is forgotten)
|
||||||
|
pSoldier->aiData.sNoiseGridno = sGridNo;
|
||||||
|
pSoldier->bNoiseLevel = bLevel;
|
||||||
|
|
||||||
|
// no matter how loud noise was, don't remember it for more than 12 turns!
|
||||||
|
pSoldier->aiData.ubNoiseVolume = min(ubVolumeScaled, MAX_MISC_NOISE_DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
SetNewSituation( pSoldier ); // re-evaluate situation
|
SetNewSituation( pSoldier ); // re-evaluate situation
|
||||||
|
|
||||||
// if status is only GREEN or YELLOW
|
// if status is only GREEN or YELLOW
|
||||||
|
|||||||
Reference in New Issue
Block a user