mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
-added some limited auto-aim to spread fire to make it actually useful
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@420 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-2
@@ -23,12 +23,12 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
//RELEASE BUILD VERSION
|
//RELEASE BUILD VERSION
|
||||||
INT16 zVersionLabel[256] = { L"Release v1.13.413" };
|
INT16 zVersionLabel[256] = { L"Release v1.13.420" };
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
INT8 czVersionNumber[16] = { "Build 06.08.09" };
|
INT8 czVersionNumber[16] = { "Build 06.08.10" };
|
||||||
INT16 zTrackingNumber[16] = { L"Z" };
|
INT16 zTrackingNumber[16] = { L"Z" };
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ void ResetBurstLocations( )
|
|||||||
gbNumBurstLocations = 0;
|
gbNumBurstLocations = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccumulateBurstLocation( INT16 sGridNo )
|
|
||||||
|
void InternalAccumulateBurstLocation( INT16 sGridNo )
|
||||||
{
|
{
|
||||||
INT32 cnt;
|
INT32 cnt;
|
||||||
|
|
||||||
if ( gbNumBurstLocations < MAX_BURST_LOCATIONS )
|
if ( gbNumBurstLocations < MAX_BURST_LOCATIONS )
|
||||||
{
|
{
|
||||||
// Check if it already exists!
|
// Check if it already exists!
|
||||||
@@ -54,6 +54,68 @@ void AccumulateBurstLocation( INT16 sGridNo )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Madd: to add a bit more usefulness to spread fire, I'm making it so that
|
||||||
|
//it will automatically latch onto enemies within iSearchRange tiles of the mouse drag.
|
||||||
|
void AccumulateBurstLocation( INT16 sGridNo )
|
||||||
|
{
|
||||||
|
SOLDIERTYPE* pTarget;
|
||||||
|
int iSearchRange = 2; // number of tiles beside the mouse drag to look at
|
||||||
|
INT16 sMaxLeft, sMaxRight, sMaxUp, sMaxDown, sXOffset, sYOffset, sAdjacentGridNo;
|
||||||
|
BOOLEAN foundTarget = FALSE;
|
||||||
|
|
||||||
|
//first see if we can find a guy standing right on the spot
|
||||||
|
pTarget = SimpleFindSoldier(sGridNo,0);
|
||||||
|
if (!pTarget)
|
||||||
|
pTarget = SimpleFindSoldier(sGridNo, 1); //try on a roof
|
||||||
|
|
||||||
|
if (pTarget)
|
||||||
|
{
|
||||||
|
InternalAccumulateBurstLocation(sGridNo);
|
||||||
|
foundTarget = TRUE;
|
||||||
|
}
|
||||||
|
//let's now look around this square - maybe there are some adjacent enemies we can latch onto
|
||||||
|
|
||||||
|
// stay away from the edges
|
||||||
|
|
||||||
|
// determine maximum horizontal limits
|
||||||
|
sMaxLeft = min( iSearchRange, (sGridNo % MAXCOL));
|
||||||
|
sMaxRight = min( iSearchRange, MAXCOL - ((sGridNo % MAXCOL) + 1));
|
||||||
|
|
||||||
|
// determine maximum vertical limits
|
||||||
|
sMaxUp = min( iSearchRange, (sGridNo / MAXROW));
|
||||||
|
sMaxDown = min( iSearchRange, MAXROW - ((sGridNo / MAXROW) + 1));
|
||||||
|
|
||||||
|
// reset the "reachable" flags in the region we're looking at
|
||||||
|
for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++)
|
||||||
|
{
|
||||||
|
for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++)
|
||||||
|
{
|
||||||
|
sAdjacentGridNo = sGridNo + sXOffset + (MAXCOL * sYOffset);
|
||||||
|
if ( !(sAdjacentGridNo >=0 && sAdjacentGridNo < WORLD_MAX) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pTarget = SimpleFindSoldier(sAdjacentGridNo,0); // look for a guy in that gridno
|
||||||
|
|
||||||
|
if (!pTarget)
|
||||||
|
pTarget = SimpleFindSoldier(sAdjacentGridNo, 1); //try on a roof
|
||||||
|
|
||||||
|
if (pTarget)
|
||||||
|
{
|
||||||
|
InternalAccumulateBurstLocation(sAdjacentGridNo); //there's somebody there! let's latch onto him
|
||||||
|
foundTarget = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( !foundTarget )
|
||||||
|
{
|
||||||
|
//didn't find anyone nearby, but we should target this space anyway to prevent players from abusing this feature
|
||||||
|
InternalAccumulateBurstLocation(sGridNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||||
|
|||||||
Reference in New Issue
Block a user