Fixed buffer overrun for LUA strings

Made direction variables more consistent as unsigned chars.  Several function prototypes updated for this.
Many memory leaks plugged:  External options, video overlays, laptop file lists, tactical message queue, strategic pathing, autobandage, merc hiring, detailed placements, crate in Drassen, tactical placement
New functions and attributes for soldiers in LUA (still for debugging at best): Soldier.APs (current APs), Soldier.changestance (changes stance, uses game heights)
File catalog ignores .SVN directories (game load speedup)
Fix CTD in mouse regions
JA2 window now refuses to move to negative coords
Checks to prevent DirectX-related infinite loops due to minimizing and task switching
Invading enemies should now appear on the borders even when reinforcements disabled in .ini
Suppression should no longer work on mercs in medium water
Infant/Young creatures use restored spit instead of Molotov
Creatures begin with their 'guns' (spit) 'locked and loaded' (cartridge in chamber)
Further fix to AXP and AlaarDB's weapon ready check:  Now 'firing' is always counted as 'ready'.
Prevent mercs from falling and flying back through obstacles
Check whether battle group is even set before testing its location for battle setup
Burst spread locations now limited to 6, the limit within the soldier struct
Extra burst spread locations zeroed out so that they aren't used unless necessary
Spread code now only shoots at locations in the spread, and will shoot at all 6
Only mercs in the sector where autobandage happens will be made to stand up after it's done
Throwing a grenade at the tail of the plane in Drassen should not result in a CTD
Reset attack busy count when loading a new sector


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1347 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-09-11 11:19:03 +00:00
parent 63a7b27b29
commit ffc70e9723
81 changed files with 972 additions and 679 deletions
+16 -16
View File
@@ -1101,7 +1101,7 @@ void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook)
{
#ifdef TESTAI
DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3,
String("FREEUPNPCFROMTURNING: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->bDirection) );
String("FREEUPNPCFROMTURNING: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->ubDirection) );
#endif
@@ -1160,7 +1160,7 @@ void ActionDone(SOLDIERTYPE *pSoldier)
{
#ifdef TESTAI
DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3,
String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->bDirection) );
String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->ubDirection) );
#endif
}
@@ -1177,7 +1177,7 @@ void ActionDone(SOLDIERTYPE *pSoldier)
if ( !pSoldier->fNoAPToFinishMove )
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
AdjustNoAPToFinishMove( pSoldier, FALSE );
}
@@ -1276,9 +1276,9 @@ void NPCDoesAct(SOLDIERTYPE *pSoldier)
// CJC Feb 18 99: make sure that soldier is not in the middle of a turn due to visual crap to make enemies
// face and point their guns at us
if ( pSoldier->bDesiredDirection != pSoldier->bDirection )
if ( pSoldier->bDesiredDirection != pSoldier->ubDirection )
{
pSoldier->bDesiredDirection = pSoldier->bDirection;
pSoldier->bDesiredDirection = pSoldier->ubDirection;
}
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"NPCDoesAct done");
@@ -1421,16 +1421,16 @@ NameMessage(pSoldier,"will now be freed up from turning...",2000);
// force him to face in the right direction (as long as it's legal)
if ((pSoldier->bDesiredDirection >= 1) && (pSoldier->bDesiredDirection <= 8))
pSoldier->bDirection = pSoldier->bDesiredDirection;
pSoldier->ubDirection = pSoldier->bDesiredDirection;
else
pSoldier->bDesiredDirection = pSoldier->bDirection;
pSoldier->bDesiredDirection = pSoldier->ubDirection;
// free up ONLY players from whom we haven't received an AI_ACTION_DONE yet
// we can all agree the action is DONE and we can continue...
// (otherwise they'll be calling FreeUp... twice and get REAL screwed up)
NetSend.msgType = NET_FREE_UP_TURN;
NetSend.ubID = pSoldier->ubID;
NetSend.misc_UCHAR = pSoldier->bDirection;
NetSend.misc_UCHAR = pSoldier->ubDirection;
NetSend.answer = pSoldier->bDesiredDirection;
for (cnt = 0; cnt < MAXPLAYERS; cnt++)
@@ -2416,7 +2416,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
case AI_ACTION_PULL_TRIGGER: // activate an adjacent panic trigger
// turn to face trigger first
if ( FindStructure( (INT16)(pSoldier->sGridNo + DirectionInc( NORTH )), STRUCTURE_SWITCH ) )
if ( FindStructure( pSoldier->sGridNo + DirectionInc( NORTH ), STRUCTURE_SWITCH ) )
{
SendSoldierSetDesiredDirectionEvent( pSoldier, NORTH );
}
@@ -2553,17 +2553,17 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
case AI_ACTION_LOCK_DOOR:
{
STRUCTURE * pStructure;
INT8 bDirection;
UINT8 ubDirection;
INT16 sDoorGridNo;
bDirection = (INT8) GetDirectionFromGridNo( pSoldier->usActionData, pSoldier );
if (bDirection == EAST || bDirection == SOUTH)
ubDirection = GetDirectionFromGridNo( (INT16)pSoldier->usActionData, pSoldier );
if (ubDirection == EAST || ubDirection == SOUTH)
{
sDoorGridNo = pSoldier->sGridNo;
}
else
{
sDoorGridNo = pSoldier->sGridNo + DirectionInc( bDirection );
sDoorGridNo = pSoldier->sGridNo + DirectionInc( ubDirection );
}
pStructure = FindStructure( sDoorGridNo, STRUCTURE_ANYDOOR );
@@ -2582,14 +2582,14 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
EndAIGuysTurn( pSoldier );
}
StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, bDirection );
InteractWithInteractiveObject( pSoldier, pStructure, bDirection );
StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, ubDirection );
InteractWithInteractiveObject( pSoldier, pStructure, ubDirection );
}
break;
case AI_ACTION_LOWER_GUN:
// for now, just do "action done"
InternalSoldierReadyWeapon(pSoldier,pSoldier->bDirection,TRUE);
InternalSoldierReadyWeapon(pSoldier,pSoldier->ubDirection,TRUE);
HandleSight(pSoldier, SIGHT_LOOK );
ActionDone( pSoldier );
break;