mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Merge branch 'master' into decideaction
This commit is contained in:
@@ -460,7 +460,7 @@ void AutoBandage( BOOLEAN fStart )
|
||||
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier )
|
||||
{
|
||||
// 0verhaul: Make sure the merc is also in the sector before making him stand up!
|
||||
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||
if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
|
||||
{
|
||||
ActionDone( pSoldier );
|
||||
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
||||
@@ -483,12 +483,16 @@ void AutoBandage( BOOLEAN fStart )
|
||||
ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||
for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop)
|
||||
{
|
||||
ActionDone( MercPtrs[ ubLoop ] );
|
||||
|
||||
// If anyone is still doing aid animation, stop!
|
||||
if ( MercPtrs[ ubLoop ]->usAnimState == GIVING_AID || MercPtrs[ ubLoop ]->usAnimState == GIVING_AID_PRN )
|
||||
pSoldier = MercPtrs[ubLoop];
|
||||
if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
|
||||
{
|
||||
MercPtrs[ ubLoop ]->SoldierGotoStationaryStance( );
|
||||
ActionDone(pSoldier);
|
||||
|
||||
// If anyone is still doing aid animation, stop!
|
||||
if (pSoldier->usAnimState == GIVING_AID || pSoldier->usAnimState == GIVING_AID_PRN)
|
||||
{
|
||||
pSoldier->SoldierGotoStationaryStance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1717,10 +1717,10 @@ BOOLEAN TrackerTileHasAdjTile( const INT32& ubX, const INT32& ubY, const INT32&
|
||||
void CalculateFortify( )
|
||||
{
|
||||
// simply get all fortified gridnos and colour them
|
||||
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > vec = GetAllForticationGridNo( );
|
||||
auto vec = GetAllForticationGridNo();
|
||||
|
||||
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator itend = vec.end( );
|
||||
for ( std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator it = vec.begin( ); it != itend; ++it )
|
||||
auto itend = vec.end();
|
||||
for (auto it = vec.begin(); it != itend; ++it)
|
||||
{
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToXY( (*it).first, &sX, &sY );
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "vsurface.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "sysutil.h"
|
||||
#include "container.h"
|
||||
#include "wcheck.h"
|
||||
#include "video.h"
|
||||
#include "vobject_blitters.h"
|
||||
|
||||
@@ -8165,7 +8165,7 @@ void CorrectDragStructData( INT32 sGridNo, INT8 sLevel, UINT8 ausHitpoints, UINT
|
||||
if ( pStruct->ubHitPoints < pStruct->pDBStructureRef->pDBStructure->ubHitPoints
|
||||
|| pStruct->ubDecalFlag & STRUCTURE_DECALFLAG_BLOOD )
|
||||
{
|
||||
gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_STRUCTURE_DAMAGED;
|
||||
gpWorldLevelData[sGridNo].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED;
|
||||
|
||||
//SetRenderFlags( RENDER_FLAG_FULL );
|
||||
}
|
||||
@@ -8713,9 +8713,9 @@ void AddFortificationPlanNode( INT32 sGridNo, INT8 sLevel, INT16 sFortificationS
|
||||
UpdateFortificationPossibleAmount();
|
||||
}
|
||||
|
||||
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > GetAllForticationGridNo( )
|
||||
GetAllForticationGridNoResult GetAllForticationGridNo()
|
||||
{
|
||||
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > gridnovector;
|
||||
GetAllForticationGridNoResult gridnovector;
|
||||
|
||||
if ( !gWorldSectorX || !gWorldSectorY )
|
||||
return gridnovector;
|
||||
|
||||
@@ -320,7 +320,8 @@ void AddFortificationPlanNode( INT32 sGridNo, INT8 sLevel, INT16 sFortificationS
|
||||
void LoadSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
|
||||
void SaveSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
|
||||
|
||||
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > GetAllForticationGridNo( );
|
||||
using GetAllForticationGridNoResult = std::vector< std::pair<INT32, std::pair<UINT8, INT8> > >;
|
||||
GetAllForticationGridNoResult GetAllForticationGridNo();
|
||||
|
||||
INT32 GetFirstObjectInSectorPosition( UINT16 ausItem );
|
||||
|
||||
@@ -334,4 +335,4 @@ BOOLEAN SpendMoney( SOLDIERTYPE *pSoldier, UINT32 aAmount ); // character spen
|
||||
// Flugente: intel
|
||||
void TakePhoto( SOLDIERTYPE* pSoldier, INT32 sGridNo, INT8 bLevel );
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2246,29 +2246,45 @@ void ChooseBombsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bBombClas
|
||||
void ChooseLBEsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bLBEClass )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseLBEsForSoldierCreateStruct");
|
||||
//UINT16 i;
|
||||
//INVTYPE *pItem;
|
||||
//UINT16 usRandom;
|
||||
UINT16 usItem = 0;
|
||||
|
||||
// CHRISL: If we're using the old inventory system, just return
|
||||
if((UsingNewInventorySystem() == false))
|
||||
return;
|
||||
|
||||
usItem = PickARandomItem( LBE, pp->ubSoldierClass, bLBEClass, FALSE );
|
||||
UINT16 usItem = PickARandomItem( LBE, pp->ubSoldierClass, bLBEClass, FALSE );
|
||||
if ( usItem > 0 )
|
||||
{
|
||||
CreateItem( usItem, (INT8)(80 + Random( 21 )), &gTempObject );
|
||||
gTempObject.fFlags |= OBJECT_UNDROPPABLE;
|
||||
// put backpacks into the backpack slot for LOBOT
|
||||
if ((UsingNewInventorySystem()) && (Item[usItem].usItemClass & IC_LBEGEAR) && (LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass == BACKPACK))
|
||||
|
||||
auto isLBEgear = Item[usItem].usItemClass & IC_LBEGEAR;
|
||||
if (isLBEgear)
|
||||
{
|
||||
pp->Inv[BPACKPOCKPOS] = gTempObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaceObjectInSoldierCreateStruct( pp, &gTempObject );
|
||||
// put backpacks into the backpack slot for LOBOT
|
||||
auto lbeClass = LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass;
|
||||
if (lbeClass == BACKPACK && !pp->Inv[BPACKPOCKPOS].exists())
|
||||
{
|
||||
pp->Inv[BPACKPOCKPOS] = gTempObject;
|
||||
return;
|
||||
}
|
||||
// same for pistol holster
|
||||
if (lbeClass == THIGH_PACK)
|
||||
{
|
||||
if (!pp->Inv[LTHIGHPOCKPOS].exists())
|
||||
{
|
||||
pp->Inv[LTHIGHPOCKPOS] = gTempObject;
|
||||
return;
|
||||
}
|
||||
if (!pp->Inv[RTHIGHPOCKPOS].exists())
|
||||
{
|
||||
pp->Inv[RTHIGHPOCKPOS] = gTempObject;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't find a specific pocket, just stuff it somewhere
|
||||
PlaceObjectInSoldierCreateStruct( pp, &gTempObject );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-14
@@ -1038,27 +1038,28 @@ UINT8 SpawnAirDropElite( INT32 sGridNo )
|
||||
|
||||
// Flugente hack
|
||||
pSoldier = TacticalCreateEliteEnemy( );
|
||||
if ( pSoldier == nullptr)
|
||||
{
|
||||
return NOBODY;
|
||||
}
|
||||
|
||||
//Add soldier strategic info, so it doesn't break the counters!
|
||||
if ( pSoldier )
|
||||
if ( !gbWorldSectorZ )
|
||||
{
|
||||
if ( !gbWorldSectorZ )
|
||||
SECTORINFO *pSector = &SectorInfo[SECTOR( gWorldSectorX, gWorldSectorY )];
|
||||
switch ( pSoldier->ubSoldierClass )
|
||||
{
|
||||
SECTORINFO *pSector = &SectorInfo[SECTOR( gWorldSectorX, gWorldSectorY )];
|
||||
switch ( pSoldier->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: pSector->ubNumAdmins++; pSector->ubAdminsInBattle++; break;
|
||||
case SOLDIER_CLASS_ARMY: pSector->ubNumTroops++; pSector->ubTroopsInBattle++; break;
|
||||
case SOLDIER_CLASS_ELITE: pSector->ubNumElites++; pSector->ubElitesInBattle++; break;
|
||||
}
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: pSector->ubNumAdmins++; pSector->ubAdminsInBattle++; break;
|
||||
case SOLDIER_CLASS_ARMY: pSector->ubNumTroops++; pSector->ubTroopsInBattle++; break;
|
||||
case SOLDIER_CLASS_ELITE: pSector->ubNumElites++; pSector->ubElitesInBattle++; break;
|
||||
}
|
||||
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CHOPPER;
|
||||
pSoldier->usStrategicInsertionData = sGridNo; // required, otherwise soldiers will spawn in map before jumping out of the heli
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
//AllTeamsLookForAll( NO_INTERRUPTS );
|
||||
}
|
||||
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CHOPPER;
|
||||
pSoldier->usStrategicInsertionData = sGridNo; // required, otherwise soldiers will spawn in map before jumping out of the heli
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
//AllTeamsLookForAll( NO_INTERRUPTS );
|
||||
|
||||
return pSoldier->ubID;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "DynamicDialogue.h"// added by Flugente
|
||||
#include "Dialogue Control.h" // added by Flugente
|
||||
#include "connect.h"
|
||||
#include "Map Information.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "Soldier Control.h"
|
||||
@@ -534,16 +535,23 @@ void MercArrivesCallback( UINT8 ubSoldierID )
|
||||
#ifdef JA2UB
|
||||
if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == gGameExternalOptions.ubDefaultArrivalSectorX && pSoldier->sSectorY == gGameExternalOptions.ubDefaultArrivalSectorY && gGameUBOptions.InGameHeli == TRUE )
|
||||
#else
|
||||
if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == gGameExternalOptions.ubDefaultArrivalSectorX && pSoldier->sSectorY == gGameExternalOptions.ubDefaultArrivalSectorY )
|
||||
if (pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER )
|
||||
#endif
|
||||
{
|
||||
gfTacticalDoHeliRun = TRUE;
|
||||
SetHelicopterDroppoint(gGameExternalOptions.iInitialMercArrivalLocation);
|
||||
if (gfFirstHeliRun)
|
||||
{
|
||||
SetHelicopterDroppoint(gGameExternalOptions.iInitialMercArrivalLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetHelicopterDroppoint(gMapInformation.sCenterGridNo);
|
||||
}
|
||||
|
||||
// OK, If we are in mapscreen, get out...
|
||||
if ( guiCurrentScreen == MAP_SCREEN )
|
||||
{
|
||||
// ATE: Make sure the current one is selected!
|
||||
// ATE: Make sure the current one is selected!
|
||||
ChangeSelectedMapSector( gWorldSectorX, gWorldSectorY, 0 );
|
||||
|
||||
RequestTriggerExitFromMapscreen( MAP_EXIT_TO_TACTICAL );
|
||||
@@ -554,17 +562,14 @@ void MercArrivesCallback( UINT8 ubSoldierID )
|
||||
|
||||
UpdateMercInSector( pSoldier, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
|
||||
}
|
||||
// Strategic map arrival to a sector that's not loaded
|
||||
else
|
||||
{
|
||||
// OK, otherwise, set them in north area, so once we load again, they are here.
|
||||
#ifdef JA2UB
|
||||
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO;
|
||||
#else
|
||||
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation;
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -5081,11 +5081,17 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe
|
||||
INT16 sDesiredLevel;
|
||||
BOOLEAN fOKCheckStruct;
|
||||
|
||||
// sevenfm: allow civilians and NPCs with profile to go off screen
|
||||
if (!GridNoOnVisibleWorldTile(sGridNo) && (pCurrSoldier->bTeam != CIV_TEAM || pCurrSoldier->ubProfile == NO_PROFILE))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
// Allow civilians and NPCs with profile to go off screen, and also enemies if tactical retreat is enabled
|
||||
auto destinationOffscreen = !(GridNoOnVisibleWorldTile(sGridNo));
|
||||
auto hasProfile = pCurrSoldier->ubProfile != NO_PROFILE;
|
||||
auto isCivilian = pCurrSoldier->bTeam == CIV_TEAM;
|
||||
auto isEnemy = pCurrSoldier->bTeam == ENEMY_TEAM;
|
||||
auto retreatAllowed = gGameExternalOptions.fAITacticalRetreat == true;
|
||||
|
||||
if (destinationOffscreen && !(isCivilian || hasProfile || (isEnemy && retreatAllowed)))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
|
||||
{
|
||||
|
||||
+19
-20
@@ -18,7 +18,6 @@
|
||||
#include "Animation Cache.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Animation Control.h"
|
||||
#include "container.h"
|
||||
#include "interface.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -462,7 +461,7 @@ static auto canJumpFences(SOLDIERTYPE* pSoldier) -> bool {
|
||||
//ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off,
|
||||
//but a safer path, usually farther away from an enemy or following behind some cover.
|
||||
//however it has not been tested and it may need some work, I haven't touched it in a while
|
||||
//#define ASTAR_USING_EXTRACOVER
|
||||
#define ASTAR_USING_EXTRACOVER
|
||||
|
||||
using namespace std;
|
||||
using namespace ASTAR;
|
||||
@@ -1165,7 +1164,7 @@ void AStarPathfinder::ExecuteAStarLogic()
|
||||
#ifdef ASTAR_USING_EXTRACOVER
|
||||
//check if we will run out of AP while entering this node or before
|
||||
//if we run out, the merc will stop at the parent node for a turn and be vulnerable
|
||||
if (mercsMaxAPs && APCost > mercsMaxAPs)
|
||||
if (gfTurnBasedAI && mercsMaxAPs && AStarG > mercsMaxAPs)
|
||||
{
|
||||
|
||||
extraGCoverCost = GetExtraGCover(ParentNode);
|
||||
@@ -1175,7 +1174,7 @@ void AStarPathfinder::ExecuteAStarLogic()
|
||||
//use the stance and cover to see how much we really want to stop at the parent node
|
||||
//as opposed to an equal path with different cover
|
||||
//because other nodes further on the path will stop here too, add this value to the F cost
|
||||
extraGCoverCost = CalcGCover(ParentNodeIndex, APCost);
|
||||
extraGCoverCost = CalcGCover(ParentNode, AStarG);
|
||||
|
||||
//remember, we have run out of points to *enter* this node, so we are stuck at the *parent* node
|
||||
//cache the cost to stay at the parent node
|
||||
@@ -1513,9 +1512,9 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
INT32 iMyThreatValue;
|
||||
INT16 sThreatLoc;
|
||||
UINT32 uiThreatCnt = 0;
|
||||
INT16 * pusLastLoc;
|
||||
INT8 * pbPersOL;
|
||||
INT8 * pbPublOL;
|
||||
INT32* pusLastLoc;
|
||||
INT8 * pbPersOL;
|
||||
INT8 * pbPublOL;
|
||||
|
||||
//although we have run out of APs to get here, it could just mean we have some APs but not enough to enter
|
||||
int APLeft = this->mercsMaxAPs - APCost;
|
||||
@@ -1524,7 +1523,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]);
|
||||
|
||||
// hang a pointer into personal opplist
|
||||
pbPersOL = &(pSoldier->bOppList[0]);
|
||||
pbPersOL = &(pSoldier->aiData.bOppList[0]);
|
||||
// hang a pointer into public opplist
|
||||
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]);
|
||||
|
||||
@@ -1536,7 +1535,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
SOLDIERTYPE* pOpponent = MercSlots[ uiLoop ];
|
||||
|
||||
// if this merc is inactive, at base, on assignment, dead, unconscious
|
||||
if (!pOpponent || pOpponent->bLife < OKLIFE) {
|
||||
if (!pOpponent || pOpponent->stats.bLife < OKLIFE) {
|
||||
continue; // next merc
|
||||
}
|
||||
|
||||
@@ -1545,7 +1544,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
continue; // next merc
|
||||
}
|
||||
|
||||
pbPersOL = pSoldier->bOppList + pOpponent->ubID;
|
||||
pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID;
|
||||
pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID;
|
||||
pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID;
|
||||
|
||||
@@ -1555,7 +1554,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
}
|
||||
|
||||
// Special stuff for Carmen the bounty hunter
|
||||
if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) {
|
||||
if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) {
|
||||
continue; // next opponent
|
||||
}
|
||||
|
||||
@@ -1600,7 +1599,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
||||
Threats[uiThreatCnt].iOrigRange = iThreatRange;
|
||||
|
||||
// calculate how many APs he will have at the start of the next turn
|
||||
Threats[uiThreatCnt].iAPs = CalcActionPoints(pOpponent);
|
||||
Threats[uiThreatCnt].iAPs = pOpponent->CalcActionPoints();
|
||||
|
||||
if (iThreatRange < iClosestThreatRange) {
|
||||
iClosestThreatRange = iThreatRange;
|
||||
@@ -1642,7 +1641,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
||||
INT32 myThreatsiValue, INT32 myThreatsiAPs, INT32 myThreatsiCertainty)
|
||||
{
|
||||
SOLDIERTYPE* pMe = this->pSoldier;
|
||||
INT32 morale = pSoldier->bAIMorale;
|
||||
INT32 morale = pSoldier->aiData.bAIMorale;
|
||||
|
||||
INT32 iRange = myThreatsiOrigRange;
|
||||
// all 32-bit integers for max. speed
|
||||
@@ -1691,7 +1690,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
||||
else
|
||||
{
|
||||
// optimistically assume we'll be behind the best cover available at this spot
|
||||
bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft );
|
||||
bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft );
|
||||
}
|
||||
|
||||
// normally, that will be the cover I'll use, unless worst case over-rides it
|
||||
@@ -1710,7 +1709,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
||||
}
|
||||
|
||||
// calculate where my cover is worst if opponent moves just 1 tile over
|
||||
bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft);
|
||||
bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft);
|
||||
|
||||
// if he can actually improve his CTGT by moving to a nearby gridno
|
||||
if (bHisBestCTGT > bHisActualCTGT)
|
||||
@@ -1739,7 +1738,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
||||
|
||||
// let's not assume anything about the stance the enemy might take, so take an average
|
||||
// value... no cover give a higher value than partial cover
|
||||
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->bLevel, iMyAPsLeft );
|
||||
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft );
|
||||
|
||||
// since NPCs are too dumb to shoot "blind", ie. at opponents that they
|
||||
// themselves can't see (mercs can, using another as a spotter!), if the
|
||||
@@ -1769,14 +1768,14 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
||||
|
||||
// try to account for who outnumbers who: the side with the advantage thus
|
||||
// (hopefully) values offense more, while those in trouble will play defense
|
||||
if (pHim->bOppCnt > 1)
|
||||
if (pHim->aiData.bOppCnt > 1)
|
||||
{
|
||||
HisPosValue /= pHim->bOppCnt;
|
||||
HisPosValue /= pHim->aiData.bOppCnt;
|
||||
}
|
||||
|
||||
if (pMe->bOppCnt > 1)
|
||||
if (pMe->aiData.bOppCnt > 1)
|
||||
{
|
||||
MyPosValue /= pMe->bOppCnt;
|
||||
MyPosValue /= pMe->aiData.bOppCnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -93,6 +93,9 @@ INT32 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT32 sSweetGridNo, INT8 u
|
||||
soldier.pathing.bLevel = 0;
|
||||
soldier.bTeam = 1;
|
||||
soldier.sGridNo = sSweetGridNo;
|
||||
soldier.sDragCorpseID = pSoldier->sDragCorpseID;
|
||||
soldier.sDragGridNo = pSoldier->sDragGridNo;
|
||||
soldier.usDragPersonID = pSoldier->usDragPersonID;
|
||||
|
||||
sTop = ubRadius;
|
||||
sBottom = -ubRadius;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "Animation Cache.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Animation Control.h"
|
||||
#include "container.h"
|
||||
#define _USE_MATH_DEFINES // for C
|
||||
#include <math.h>
|
||||
#include "pathai.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Animation Cache.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Animation Control.h"
|
||||
#include "container.h"
|
||||
#include "pathai.h"
|
||||
#include "Random.h"
|
||||
#include "worldman.h"
|
||||
|
||||
@@ -1027,6 +1027,7 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( )
|
||||
// handle all reachable before save
|
||||
HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
UpdateWorldItems(gWorldSectorX, gWorldSectorY, gbWorldSectorZ, guiNumWorldItems, gWorldItems);
|
||||
PruneWorldItems();
|
||||
|
||||
std::vector<ROTTING_CORPSE_DEFINITION> corpsedefvector;
|
||||
|
||||
@@ -3169,7 +3170,6 @@ void LoadWorldItemsFromTempFiles(INT16 sMapX, INT16 sMapY, INT8 bMapZ)
|
||||
|
||||
void SaveWorldItemsToTempFiles()
|
||||
{
|
||||
PruneWorldItems();
|
||||
for (size_t i = 0; i < gAllWorldItems.sectors.size(); i++)
|
||||
{
|
||||
const auto x = gAllWorldItems.sectors[i].x;
|
||||
|
||||
@@ -8309,7 +8309,7 @@ void HandleTBLevelUp(void)
|
||||
|
||||
void HandleTBBackpacks(void)
|
||||
{
|
||||
if (UsingNewInventorySystem)
|
||||
if (UsingNewInventorySystem())
|
||||
{
|
||||
bool backpackDropped = false;
|
||||
SOLDIERTYPE* pTeamSoldier;
|
||||
|
||||
@@ -136,7 +136,7 @@ void PruneWorldItems(void)
|
||||
for (size_t i = 0; i < gAllWorldItems.Items.size(); i++)
|
||||
{
|
||||
std::vector<WORLDITEM>& items = gAllWorldItems.Items[i];
|
||||
for (INT32 j = items.size()-1; j > 0; j--)
|
||||
for (INT32 j = items.size()-1; j >= 0; j--)
|
||||
{
|
||||
if (items[j].fExists == false)
|
||||
{
|
||||
@@ -149,6 +149,11 @@ void PruneWorldItems(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto x = gAllWorldItems.sectors[i].x;
|
||||
auto y = gAllWorldItems.sectors[i].y;
|
||||
auto z = gAllWorldItems.sectors[i].z;
|
||||
ReSetSectorFlag(x, y, z, SF_ITEM_TEMP_FILE_EXISTS);
|
||||
|
||||
gAllWorldItems.sectors.erase(gAllWorldItems.sectors.begin() + i);
|
||||
gAllWorldItems.NumItems.erase(gAllWorldItems.NumItems.begin() + i);
|
||||
gAllWorldItems.Items.erase(gAllWorldItems.Items.begin() + i);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "renderworld.h"
|
||||
#include "vsurface.h"
|
||||
#include "sysutil.h"
|
||||
#include "container.h"
|
||||
#include "wcheck.h"
|
||||
#include "video.h"
|
||||
#include "vobject_blitters.h"
|
||||
|
||||
Reference in New Issue
Block a user