mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
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:
@@ -528,7 +528,7 @@ void AddMercToWorld( INT32 iMapIndex )
|
|||||||
gTempBasicPlacement.bAttitude = gbDefaultAttitude;
|
gTempBasicPlacement.bAttitude = gbDefaultAttitude;
|
||||||
gTempBasicPlacement.bRelativeAttributeLevel = gbDefaultRelativeAttributeLevel;
|
gTempBasicPlacement.bRelativeAttributeLevel = gbDefaultRelativeAttributeLevel;
|
||||||
gTempBasicPlacement.bRelativeEquipmentLevel = gbDefaultRelativeEquipmentLevel;
|
gTempBasicPlacement.bRelativeEquipmentLevel = gbDefaultRelativeEquipmentLevel;
|
||||||
gTempBasicPlacement.bDirection = gbDefaultDirection;
|
gTempBasicPlacement.ubDirection = gbDefaultDirection;
|
||||||
|
|
||||||
//Generate detailed placement information given the temp placement information.
|
//Generate detailed placement information given the temp placement information.
|
||||||
CreateDetailedPlacementGivenBasicPlacementInfo( &gTempDetailedPlacement, &gTempBasicPlacement );
|
CreateDetailedPlacementGivenBasicPlacementInfo( &gTempDetailedPlacement, &gTempBasicPlacement );
|
||||||
@@ -645,7 +645,7 @@ void ResetAllMercPositions()
|
|||||||
// EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) );
|
// EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) );
|
||||||
// if( gpSelected->pBasicPlacement->fOnRoof )
|
// if( gpSelected->pBasicPlacement->fOnRoof )
|
||||||
// SetSoldierHeight( gpSelected->pSoldier, 58.0 );
|
// SetSoldierHeight( gpSelected->pSoldier, 58.0 );
|
||||||
// SetMercDirection( gpSelected->pBasicPlacement->bDirection );
|
// SetMercDirection( gpSelected->pBasicPlacement->ubDirection );
|
||||||
//}
|
//}
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1451,7 @@ void SetMercDirection( INT8 bDirection )
|
|||||||
ClickEditorButton( FIRST_MERCS_DIRECTION_BUTTON + bDirection );
|
ClickEditorButton( FIRST_MERCS_DIRECTION_BUTTON + bDirection );
|
||||||
|
|
||||||
gbDefaultDirection = bDirection;
|
gbDefaultDirection = bDirection;
|
||||||
gpSelected->pBasicPlacement->bDirection = bDirection;
|
gpSelected->pBasicPlacement->ubDirection = bDirection;
|
||||||
|
|
||||||
// ATE: Changed these to call functions....
|
// ATE: Changed these to call functions....
|
||||||
EVENT_SetSoldierDirection( gpSelected->pSoldier, bDirection );
|
EVENT_SetSoldierDirection( gpSelected->pSoldier, bDirection );
|
||||||
@@ -1676,7 +1676,7 @@ void IndicateSelectedMerc( INT16 sID )
|
|||||||
//assigns the soldier with the same orders/attitude.
|
//assigns the soldier with the same orders/attitude.
|
||||||
SetMercOrders( gpSelected->pSoldier->bOrders );
|
SetMercOrders( gpSelected->pSoldier->bOrders );
|
||||||
SetMercAttitude( gpSelected->pSoldier->bAttitude );
|
SetMercAttitude( gpSelected->pSoldier->bAttitude );
|
||||||
SetMercDirection( gpSelected->pSoldier->bDirection );
|
SetMercDirection( gpSelected->pSoldier->ubDirection );
|
||||||
if( gpSelected->pBasicPlacement->fPriorityExistance )
|
if( gpSelected->pBasicPlacement->fPriorityExistance )
|
||||||
ClickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX );
|
ClickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -708,6 +708,11 @@ void LoadGameExternalOptions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FreeGameExternalOptions()
|
||||||
|
{
|
||||||
|
MemFree( gGameExternalOptions.iaIMPSlots);
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN GetCDLocation( )
|
BOOLEAN GetCDLocation( )
|
||||||
{
|
{
|
||||||
UINT32 uiStrngLength = 0;
|
UINT32 uiStrngLength = 0;
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ BOOLEAN SaveGameSettings();
|
|||||||
BOOLEAN LoadGameSettings();
|
BOOLEAN LoadGameSettings();
|
||||||
// Snap: Read options from an INI file in the default of custom Data directory
|
// Snap: Read options from an INI file in the default of custom Data directory
|
||||||
void LoadGameExternalOptions();
|
void LoadGameExternalOptions();
|
||||||
|
void FreeGameExternalOptions();
|
||||||
|
|
||||||
void InitGameOptions();
|
void InitGameOptions();
|
||||||
|
|
||||||
|
|||||||
@@ -1292,6 +1292,7 @@ void ClearFileStringList( void )
|
|||||||
{
|
{
|
||||||
pDeleteFileString = pFileString;
|
pDeleteFileString = pFileString;
|
||||||
pFileString = pFileString -> Next;
|
pFileString = pFileString -> Next;
|
||||||
|
MemFree( pDeleteFileString->pString);
|
||||||
MemFree( pDeleteFileString );
|
MemFree( pDeleteFileString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ void TFileCat::TraverseDir(std::string dir, int depth)
|
|||||||
using std::string;
|
using std::string;
|
||||||
static string dot( ".");
|
static string dot( ".");
|
||||||
static string dotdot( "..");
|
static string dotdot( "..");
|
||||||
|
static string svn( ".svn");
|
||||||
|
|
||||||
if (!dir.empty()) dir += '\\';
|
if (!dir.empty()) dir += '\\';
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ void TFileCat::TraverseDir(std::string dir, int depth)
|
|||||||
unsigned attrib;
|
unsigned attrib;
|
||||||
|
|
||||||
while ( readDir.NextFile(fileName, attrib) ) {
|
while ( readDir.NextFile(fileName, attrib) ) {
|
||||||
if (dot == fileName || dotdot == fileName) continue;
|
if (dot == fileName || dotdot == fileName || svn == fileName) continue;
|
||||||
|
|
||||||
string fullPath = dir + fileName;
|
string fullPath = dir + fileName;
|
||||||
|
|
||||||
|
|||||||
@@ -622,7 +622,8 @@ void MSYS_UpdateMouseRegion(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay;
|
if (MSYS_CurrRegion)
|
||||||
|
MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay;
|
||||||
|
|
||||||
// Force a callbacks to happen on previous region to indicate that
|
// Force a callbacks to happen on previous region to indicate that
|
||||||
// the mouse has left the old region
|
// the mouse has left the old region
|
||||||
|
|||||||
@@ -133,7 +133,8 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
|||||||
FreeConsole();
|
FreeConsole();
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
BOOL visible = IsWindowVisible(hWindow);
|
||||||
|
|
||||||
if(gfIgnoreMessages)
|
if(gfIgnoreMessages)
|
||||||
return(DefWindowProc(hWindow, Message, wParam, lParam));
|
return(DefWindowProc(hWindow, Message, wParam, lParam));
|
||||||
|
|
||||||
@@ -159,11 +160,29 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
|||||||
#ifdef JA2
|
#ifdef JA2
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
// if( 1==iScreenMode )
|
// if( 1==iScreenMode )
|
||||||
// {
|
{
|
||||||
GetClientRect(hWindow, &rcWindow);
|
GetClientRect(hWindow, &rcWindow);
|
||||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
|
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
|
||||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
|
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
|
||||||
// }
|
int xPos = (int)(short) LOWORD(lParam);
|
||||||
|
int yPos = (int)(short) HIWORD(lParam);
|
||||||
|
BOOL needchange = FALSE;
|
||||||
|
if (xPos < 0)
|
||||||
|
{
|
||||||
|
xPos = 0;
|
||||||
|
needchange = TRUE;
|
||||||
|
}
|
||||||
|
if (yPos < 0)
|
||||||
|
{
|
||||||
|
yPos = 0;
|
||||||
|
needchange = TRUE;
|
||||||
|
}
|
||||||
|
if (needchange)
|
||||||
|
{
|
||||||
|
SetWindowPos( hWindow, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_GETMINMAXINFO:
|
case WM_GETMINMAXINFO:
|
||||||
{
|
{
|
||||||
@@ -792,7 +811,10 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
|||||||
//end rain
|
//end rain
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
_CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
// Use this one ONLY if you're having memory corruption issues that can be repeated in a short time
|
||||||
|
// Otherwise it will just run out of memory.
|
||||||
|
//_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF);
|
||||||
|
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_1024_DF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghInstance = hInstance;
|
ghInstance = hInstance;
|
||||||
|
|||||||
@@ -1083,6 +1083,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1124,6 +1130,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1166,6 +1178,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1207,6 +1225,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1249,6 +1273,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1294,6 +1324,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1338,6 +1374,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, sScrollXIncrement, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1385,6 +1427,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, 0, gsVIEWPORT_WINDOW_START_Y, pSource, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -1456,6 +1504,12 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, StripRegions[ cnt ].left, StripRegions[ cnt ].top, gpFrameBuffer, (LPRECT)&( StripRegions[ cnt ] ), DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(pDest, StripRegions[ cnt ].left, StripRegions[ cnt ].top, gpFrameBuffer, (LPRECT)&( StripRegions[ cnt ] ), DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ void RenderMovingGroupsAndMercs()
|
|||||||
UINT8 ubNumTroops, ubNumAdmins, ubNumElites;
|
UINT8 ubNumTroops, ubNumAdmins, ubNumElites;
|
||||||
float ratio;
|
float ratio;
|
||||||
INT32 minX, maxX, minY, maxY;
|
INT32 minX, maxX, minY, maxY;
|
||||||
INT32 iSector = 0;
|
//INT32 iSector = 0;
|
||||||
UINT8 ubIconType;
|
UINT8 ubIconType;
|
||||||
UINT8 ubIconColor;
|
UINT8 ubIconColor;
|
||||||
UINT8 ubFontColor;
|
UINT8 ubFontColor;
|
||||||
@@ -577,7 +577,7 @@ void RenderMovingGroupsAndMercs()
|
|||||||
|
|
||||||
if( pGroup->fPlayer )
|
if( pGroup->fPlayer )
|
||||||
{
|
{
|
||||||
ubIconType = ( pGroup->uiTraverseTime ) ? ICON_TYPE_ASSAULT : ICON_TYPE_STOPPED;
|
ubIconType = (UINT8) (( pGroup->uiTraverseTime ) ? ICON_TYPE_ASSAULT : ICON_TYPE_STOPPED);
|
||||||
ubIconColor = ICON_COLOR_GREEN;
|
ubIconColor = ICON_COLOR_GREEN;
|
||||||
ubFontColor = FONT_YELLOW;
|
ubFontColor = FONT_YELLOW;
|
||||||
}
|
}
|
||||||
@@ -1447,16 +1447,16 @@ void ExtractAndUpdatePopulations()
|
|||||||
//CIniReader iniReader("..\\Ja2_Options.ini");
|
//CIniReader iniReader("..\\Ja2_Options.ini");
|
||||||
//INT32 iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20);
|
//INT32 iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20);
|
||||||
|
|
||||||
gsAINumAdmins = min( GetNumericStrictValueFromField( 0 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
gsAINumAdmins = (INT16) min( GetNumericStrictValueFromField( 0 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
||||||
SetInputFieldStringWithNumericStrictValue( 0, gsAINumAdmins );
|
SetInputFieldStringWithNumericStrictValue( 0, gsAINumAdmins );
|
||||||
|
|
||||||
gsAINumTroops = min( GetNumericStrictValueFromField( 1 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
gsAINumTroops = (INT16) min( GetNumericStrictValueFromField( 1 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
||||||
SetInputFieldStringWithNumericStrictValue( 1, gsAINumTroops );
|
SetInputFieldStringWithNumericStrictValue( 1, gsAINumTroops );
|
||||||
|
|
||||||
gsAINumElites = min( GetNumericStrictValueFromField( 2 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
gsAINumElites = (INT16) min( GetNumericStrictValueFromField( 2 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
||||||
SetInputFieldStringWithNumericStrictValue( 2, gsAINumElites );
|
SetInputFieldStringWithNumericStrictValue( 2, gsAINumElites );
|
||||||
|
|
||||||
gsAINumCreatures = min( GetNumericStrictValueFromField( 3 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
gsAINumCreatures = (INT16) min( GetNumericStrictValueFromField( 3 ), gGameExternalOptions.iMaxEnemyGroupSize );
|
||||||
SetInputFieldStringWithNumericStrictValue( 3, gsAINumCreatures );
|
SetInputFieldStringWithNumericStrictValue( 3, gsAINumCreatures );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1866,7 +1866,7 @@ void BlitGroupIcon( UINT8 ubIconType, UINT8 ubIconColor, UINT32 uiX, UINT32 uiY,
|
|||||||
Assert( ubIconType < NUM_ICON_TYPES );
|
Assert( ubIconType < NUM_ICON_TYPES );
|
||||||
Assert( ubIconColor < NUM_ICON_COLORS );
|
Assert( ubIconColor < NUM_ICON_COLORS );
|
||||||
|
|
||||||
ubObjectIndex = ( ubIconType * NUM_ICON_COLORS ) + ubIconColor;
|
ubObjectIndex = (UINT8)( ubIconType * NUM_ICON_COLORS ) + ubIconColor;
|
||||||
BltVideoObject( FRAME_BUFFER, hVObject, ubObjectIndex, uiX, uiY, VO_BLT_SRCTRANSPARENCY, NULL );
|
BltVideoObject( FRAME_BUFFER, hVObject, ubObjectIndex, uiX, uiY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -917,8 +917,8 @@ BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier )
|
|||||||
// check that character is alive, oklife, has repair skill, and equipment, etc.
|
// check that character is alive, oklife, has repair skill, and equipment, etc.
|
||||||
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
|
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bPocket = 0;
|
//INT8 bPocket = 0;
|
||||||
BOOLEAN fToolKitFound = FALSE;
|
//BOOLEAN fToolKitFound = FALSE;
|
||||||
|
|
||||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||||
{
|
{
|
||||||
@@ -1565,8 +1565,8 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
|
BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT32 cnt = 0;
|
//INT32 cnt = 0;
|
||||||
SOLDIERTYPE *pTeamSoldier = NULL;
|
//SOLDIERTYPE *pTeamSoldier = NULL;
|
||||||
|
|
||||||
// can character train at all
|
// can character train at all
|
||||||
if( CanCharacterPractise( pSoldier ) == FALSE )
|
if( CanCharacterPractise( pSoldier ) == FALSE )
|
||||||
@@ -1588,7 +1588,7 @@ BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier )
|
BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT32 iCounter = 0;
|
//INT32 iCounter = 0;
|
||||||
|
|
||||||
// can character train at all
|
// can character train at all
|
||||||
if( CanCharacterPractise( pSoldier ) == FALSE )
|
if( CanCharacterPractise( pSoldier ) == FALSE )
|
||||||
@@ -2047,8 +2047,8 @@ UINT8 FindNumberInSectorWithAssignment( INT16 sX, INT16 sY, INT8 bAssignment )
|
|||||||
{
|
{
|
||||||
// run thought list of characters find number with this assignment
|
// run thought list of characters find number with this assignment
|
||||||
SOLDIERTYPE *pSoldier, *pTeamSoldier;
|
SOLDIERTYPE *pSoldier, *pTeamSoldier;
|
||||||
INT32 cnt=0;
|
INT32 cnt=0;
|
||||||
INT32 iCounter=0;
|
//INT32 iCounter=0;
|
||||||
INT8 bNumberOfPeople = 0;
|
INT8 bNumberOfPeople = 0;
|
||||||
|
|
||||||
// set psoldier as first in merc ptrs
|
// set psoldier as first in merc ptrs
|
||||||
@@ -2137,11 +2137,11 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate effective doctoring rate (adjusted for drugs, alcohol, etc.)
|
// calculate effective doctoring rate (adjusted for drugs, alcohol, etc.)
|
||||||
usHealPts = ( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor;
|
usHealPts = (UINT16) (( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
|
||||||
|
|
||||||
// calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
|
// calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
|
||||||
// and equipment was not a hindrance
|
// and equipment was not a hindrance
|
||||||
*pusMaxPts = ( pDoctor -> bMedical * (( pDoctor -> bDexterity + pDoctor -> bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor;
|
*pusMaxPts = (UINT16) (( pDoctor -> bMedical * (( pDoctor -> bDexterity + pDoctor -> bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
|
||||||
|
|
||||||
// adjust for fatigue
|
// adjust for fatigue
|
||||||
ReducePointsForFatigue( pDoctor, &usHealPts );
|
ReducePointsForFatigue( pDoctor, &usHealPts );
|
||||||
@@ -2196,11 +2196,11 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate effective repair rate (adjusted for drugs, alcohol, etc.)
|
// calculate effective repair rate (adjusted for drugs, alcohol, etc.)
|
||||||
usRepairPts = (EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay );
|
usRepairPts = (UINT16) ((EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
|
||||||
|
|
||||||
// calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
|
// calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
|
||||||
// and equipment was not a hindrance
|
// and equipment was not a hindrance
|
||||||
*pusMaxPts = ( pSoldier -> bMechanical * pSoldier -> bDexterity * (100 + ( 5 * pSoldier->bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay );
|
*pusMaxPts = (UINT16) (( pSoldier -> bMechanical * pSoldier -> bDexterity * (100 + ( 5 * pSoldier->bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
|
||||||
|
|
||||||
|
|
||||||
// adjust for fatigue
|
// adjust for fatigue
|
||||||
@@ -2275,7 +2275,7 @@ void HandleDoctorsInSector( INT16 sX, INT16 sY, INT8 bZ )
|
|||||||
{
|
{
|
||||||
SOLDIERTYPE *pSoldier, *pTeamSoldier;
|
SOLDIERTYPE *pSoldier, *pTeamSoldier;
|
||||||
INT32 cnt=0;
|
INT32 cnt=0;
|
||||||
INT32 iCounter=0;
|
//INT32 iCounter=0;
|
||||||
|
|
||||||
// set psoldier as first in merc ptrs
|
// set psoldier as first in merc ptrs
|
||||||
pSoldier = MercPtrs[0];
|
pSoldier = MercPtrs[0];
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ void ShutdownStrategicLayer()
|
|||||||
TrashUndergroundSectorInfo();
|
TrashUndergroundSectorInfo();
|
||||||
DeleteCreatureDirectives();
|
DeleteCreatureDirectives();
|
||||||
KillStrategicAI();
|
KillStrategicAI();
|
||||||
|
ClearTacticalMessageQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN InitNewGame( BOOLEAN fReset )
|
BOOLEAN InitNewGame( BOOLEAN fReset )
|
||||||
|
|||||||
@@ -2055,6 +2055,7 @@ void PlotPathForHelicopter( INT16 sX, INT16 sY )
|
|||||||
void PlotATemporaryPathForHelicopter( INT16 sX, INT16 sY )
|
void PlotATemporaryPathForHelicopter( INT16 sX, INT16 sY )
|
||||||
{
|
{
|
||||||
// clear old temp path
|
// clear old temp path
|
||||||
|
pTempHelicopterPath = MoveToBeginningOfPathList( pTempHelicopterPath);
|
||||||
pTempHelicopterPath = ClearStrategicPathList( pTempHelicopterPath, 0 );
|
pTempHelicopterPath = ClearStrategicPathList( pTempHelicopterPath, 0 );
|
||||||
|
|
||||||
// is cursor allowed here?..if not..don't build temp path
|
// is cursor allowed here?..if not..don't build temp path
|
||||||
|
|||||||
@@ -1263,7 +1263,7 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier )
|
|||||||
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
|
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
|
||||||
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
|
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
|
||||||
|
|
||||||
Corpse.bDirection = pSoldier->bDirection;
|
Corpse.bDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
// Set time of death
|
// Set time of death
|
||||||
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
|
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
|
||||||
|
|||||||
+54
-44
@@ -443,54 +443,58 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
if( gbWorldSectorZ > 0 )
|
if( gbWorldSectorZ > 0 )
|
||||||
return PrepareEnemyForUndergroundBattle();
|
return PrepareEnemyForUndergroundBattle();
|
||||||
|
|
||||||
// Reinforcement groups? Bring it on! That is, if this is an enemy invasion.
|
// Add the invading group
|
||||||
if( gGameExternalOptions.gfAllowReinforcements &&
|
if (gpBattleGroup && !gpBattleGroup->fPlayer )
|
||||||
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) &&
|
|
||||||
gpBattleGroup && !gpBattleGroup->fPlayer )
|
|
||||||
{
|
{
|
||||||
UINT16 pusMoveDir[4][3];
|
|
||||||
UINT8 ubDirNumber = 0, ubIndex;
|
|
||||||
GROUP *pGroup;
|
|
||||||
SECTORINFO *pThisSector;
|
|
||||||
|
|
||||||
//The enemy has instigated the battle which means they are the ones entering the conflict.
|
//The enemy has instigated the battle which means they are the ones entering the conflict.
|
||||||
//The player was actually in the sector first, and the enemy doesn't use reinforced placements
|
//The player was actually in the sector first, and the enemy doesn't use reinforced placements
|
||||||
HandleArrivalOfReinforcements( gpBattleGroup );
|
HandleArrivalOfReinforcements( gpBattleGroup );
|
||||||
|
|
||||||
// They arrived in multiple groups, so here they come
|
// Reinforcement groups? Bring it on!
|
||||||
pThisSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
if( gGameExternalOptions.gfAllowReinforcements &&
|
||||||
|
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) )
|
||||||
GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir,
|
|
||||||
( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
|
|
||||||
|
|
||||||
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
|
||||||
{
|
{
|
||||||
while ( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
UINT16 pusMoveDir[4][3];
|
||||||
|
UINT8 ubDirNumber = 0, ubIndex;
|
||||||
|
GROUP *pGroup;
|
||||||
|
SECTORINFO *pThisSector;
|
||||||
|
|
||||||
|
// They arrived in multiple groups, so here they come
|
||||||
|
pThisSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||||
|
|
||||||
|
GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir,
|
||||||
|
( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
|
||||||
|
|
||||||
|
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||||
{
|
{
|
||||||
pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
|
while ( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||||
|
{
|
||||||
|
pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
|
||||||
|
|
||||||
pGroup->ubPrevX = pGroup->ubSectorX;
|
pGroup->ubPrevX = pGroup->ubSectorX;
|
||||||
pGroup->ubPrevY = pGroup->ubSectorY;
|
pGroup->ubPrevY = pGroup->ubSectorY;
|
||||||
|
|
||||||
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)gWorldSectorX;
|
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)gWorldSectorX;
|
||||||
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)gWorldSectorY;
|
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)gWorldSectorY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//It is now possible that other enemy groups have also arrived. Add them in the same manner.
|
//It is now possible that other enemy groups have also arrived. Add them in the same manner.
|
||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup != gpBattleGroup && !pGroup->fPlayer && !pGroup->fVehicle &&
|
if( pGroup != gpBattleGroup && !pGroup->fPlayer && !pGroup->fVehicle &&
|
||||||
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
|
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
|
||||||
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
|
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
|
||||||
!pGroup->pEnemyGroup->ubAdminsInBattle &&
|
!pGroup->pEnemyGroup->ubAdminsInBattle &&
|
||||||
!pGroup->pEnemyGroup->ubTroopsInBattle &&
|
!pGroup->pEnemyGroup->ubTroopsInBattle &&
|
||||||
!pGroup->pEnemyGroup->ubElitesInBattle )
|
!pGroup->pEnemyGroup->ubElitesInBattle )
|
||||||
{
|
{
|
||||||
HandleArrivalOfReinforcements( pGroup );
|
HandleArrivalOfReinforcements( pGroup );
|
||||||
|
}
|
||||||
|
pGroup = pGroup->next;
|
||||||
}
|
}
|
||||||
pGroup = pGroup->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateEnemiesHaveWeapons();
|
ValidateEnemiesHaveWeapons();
|
||||||
@@ -670,24 +674,29 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup && sNumSlots )
|
while( pGroup && sNumSlots )
|
||||||
{
|
{
|
||||||
i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
if( !pGroup->fPlayer && !pGroup->fVehicle &&
|
||||||
pSoldier = &Menptr[ i ];
|
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
|
||||||
{
|
{
|
||||||
num = pGroup->ubGroupSize;
|
|
||||||
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
|
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
|
||||||
ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
|
ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||||
ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
|
ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
|
||||||
while( num && sNumSlots && i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID )
|
num = ubNumAdmins + ubNumTroops + ubNumElites;
|
||||||
|
|
||||||
|
for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
||||||
|
i<= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID && num;
|
||||||
|
i++)
|
||||||
{
|
{
|
||||||
while( !pSoldier->bActive || pSoldier->ubGroupID )
|
// At this point we should not have added more soldiers than are in slots
|
||||||
|
Assert( sNumSlots);
|
||||||
|
|
||||||
|
pSoldier = &Menptr[ i ];
|
||||||
|
|
||||||
|
// Skip inactive and already grouped soldiers
|
||||||
|
if (!pSoldier->bActive || pSoldier->ubGroupID)
|
||||||
{
|
{
|
||||||
pSoldier = &Menptr[ ++i ];
|
continue;
|
||||||
if( i > gTacticalStatus.Team[ ENEMY_TEAM ].bLastID )
|
|
||||||
{
|
|
||||||
AssertMsg( 0, "Failed to assign battle counters for enemies properly. Please send save. KM:0." );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pSoldier->ubSoldierClass )
|
switch( pSoldier->ubSoldierClass )
|
||||||
{
|
{
|
||||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||||
@@ -718,8 +727,9 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pSoldier = &Menptr[ ++i ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert( ubNumElites + ubNumTroops + ubNumAdmins + num == 0);
|
||||||
}
|
}
|
||||||
pGroup = pGroup->next;
|
pGroup = pGroup->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1552,7 +1552,7 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY )
|
|||||||
SET_PALETTEREP_ID ( Corpse.PantsPal, "GREENPANTS" );
|
SET_PALETTEREP_ID ( Corpse.PantsPal, "GREENPANTS" );
|
||||||
|
|
||||||
|
|
||||||
Corpse.bDirection = (INT8)Random(8);
|
Corpse.ubDirection = (UINT8)Random(8);
|
||||||
|
|
||||||
// Set time of death
|
// Set time of death
|
||||||
// Make sure they will be rotting!
|
// Make sure they will be rotting!
|
||||||
|
|||||||
@@ -495,7 +495,9 @@ PathStPtr BuildAStrategicPath(PathStPtr pPath , INT16 iStartSectorNum, INT16 iEn
|
|||||||
INT32 iOldDelta = 0;
|
INT32 iOldDelta = 0;
|
||||||
iCurrentSectorNum=iStartSectorNum;
|
iCurrentSectorNum=iStartSectorNum;
|
||||||
|
|
||||||
|
if(iEndSectorNum < MAP_WORLD_X-1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (pNode==NULL)
|
if (pNode==NULL)
|
||||||
{
|
{
|
||||||
// start new path list
|
// start new path list
|
||||||
@@ -513,9 +515,6 @@ PathStPtr BuildAStrategicPath(PathStPtr pPath , INT16 iStartSectorNum, INT16 iEn
|
|||||||
pHeadOfPathList = pNode;
|
pHeadOfPathList = pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iEndSectorNum < MAP_WORLD_X-1)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
iPathLength=((INT32)FindStratPath(((INT16)iStartSectorNum),((INT16)iEndSectorNum), sMvtGroupNumber, fTacticalTraversal ));
|
iPathLength=((INT32)FindStratPath(((INT16)iStartSectorNum),((INT16)iEndSectorNum), sMvtGroupNumber, fTacticalTraversal ));
|
||||||
while(iPathLength > iCount)
|
while(iPathLength > iCount)
|
||||||
{
|
{
|
||||||
@@ -885,6 +884,7 @@ PathStPtr ClearStrategicPathList( PathStPtr pHeadOfPath, INT16 sMvtGroup )
|
|||||||
|
|
||||||
// move to next node
|
// move to next node
|
||||||
pNode = pNode -> pNext;
|
pNode = pNode -> pNext;
|
||||||
|
pNode->pPrev = NULL;
|
||||||
|
|
||||||
// delete delete node
|
// delete delete node
|
||||||
MemFree( pDeleteNode );
|
MemFree( pDeleteNode );
|
||||||
|
|||||||
@@ -7510,6 +7510,7 @@ void CheckToSeeIfMouseHasLeftMapRegionDuringPathPlotting( )
|
|||||||
// clear the temp path
|
// clear the temp path
|
||||||
if( pTempCharacterPath )
|
if( pTempCharacterPath )
|
||||||
{
|
{
|
||||||
|
pTempCharacterPath = MoveToBeginningOfPathList( pTempCharacterPath);
|
||||||
pTempCharacterPath = ClearStrategicPathList( pTempCharacterPath, 0 );
|
pTempCharacterPath = ClearStrategicPathList( pTempCharacterPath, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,7 +456,8 @@ void AutoBandage( BOOLEAN fStart )
|
|||||||
cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
||||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++)
|
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++)
|
||||||
{
|
{
|
||||||
if ( pSoldier->bActive )
|
// 0verhaul: Make sure the merc is also in the sector before making him stand up!
|
||||||
|
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||||
{
|
{
|
||||||
ActionDone( pSoldier );
|
ActionDone( pSoldier );
|
||||||
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
||||||
@@ -523,7 +524,12 @@ void AutoBandage( BOOLEAN fStart )
|
|||||||
DoScreenIndependantMessageBox(pDoctorWarningString[ 1 ], MSG_BOX_FLAG_OK, NULL );
|
DoScreenIndependantMessageBox(pDoctorWarningString[ 1 ], MSG_BOX_FLAG_OK, NULL );
|
||||||
gfAutoBandageFailed = FALSE;
|
gfAutoBandageFailed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Memory cleanup!
|
||||||
|
MemFree( sAutoBandageString);
|
||||||
|
sAutoBandageString = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
guiAutoBandageSeconds = 0;
|
guiAutoBandageSeconds = 0;
|
||||||
|
|
||||||
ResetAllMercSpeeds( );
|
ResetAllMercSpeeds( );
|
||||||
|
|||||||
+1
-1
@@ -133,7 +133,7 @@ void BoxingPlayerDisqualified( SOLDIERTYPE * pOffender, INT8 bReason )
|
|||||||
{
|
{
|
||||||
if (bReason == BOXER_OUT_OF_RING || bReason == NON_BOXER_IN_RING)
|
if (bReason == BOXER_OUT_OF_RING || bReason == NON_BOXER_IN_RING)
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pOffender, pOffender->sGridNo, pOffender->bDirection );
|
EVENT_StopMerc( pOffender, pOffender->sGridNo, pOffender->ubDirection );
|
||||||
}
|
}
|
||||||
SetBoxingState( DISQUALIFIED );
|
SetBoxingState( DISQUALIFIED );
|
||||||
TriggerNPCRecord( DARREN, 21 );
|
TriggerNPCRecord( DARREN, 21 );
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT
|
|||||||
{
|
{
|
||||||
// gTacticalStatus.ubAttackBusyCount++;
|
// gTacticalStatus.ubAttackBusyCount++;
|
||||||
DebugAttackBusy( "Killing off a queen ally.\n");
|
DebugAttackBusy( "Killing off a queen ally.\n");
|
||||||
EVENT_SoldierGotHit( pTeamSoldier, 0, 10000, 0, pTeamSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE );
|
EVENT_SoldierGotHit( pTeamSoldier, 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile()
|
|||||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||||
|
|
||||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||||
@@ -332,7 +332,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile()
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
@@ -519,7 +519,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
|||||||
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
||||||
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
||||||
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
||||||
curr->pDetailedPlacement->bDirection = pSoldier->bDirection;
|
curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
//we don't want the player to think that all the enemies start in the exact position when we
|
//we don't want the player to think that all the enemies start in the exact position when we
|
||||||
//left the map, so randomize the start locations either current position or original position.
|
//left the map, so randomize the start locations either current position or original position.
|
||||||
@@ -729,7 +729,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
@@ -1016,7 +1016,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile()
|
|||||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||||
|
|
||||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||||
@@ -1059,7 +1059,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile()
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
@@ -1376,7 +1376,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile()
|
|||||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||||
|
|
||||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||||
@@ -1419,7 +1419,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile()
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
@@ -1614,7 +1614,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
|
|||||||
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
||||||
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
||||||
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
||||||
curr->pDetailedPlacement->bDirection = pSoldier->bDirection;
|
curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
//we don't want the player to think that all the enemies start in the exact position when we
|
//we don't want the player to think that all the enemies start in the exact position when we
|
||||||
//left the map, so randomize the start locations either current position or original position.
|
//left the map, so randomize the start locations either current position or original position.
|
||||||
@@ -1807,7 +1807,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
@@ -2073,7 +2073,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile(
|
|||||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||||
|
|
||||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||||
@@ -2116,7 +2116,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile(
|
|||||||
curr->pDetailedPlacement->sSectorX * 7 -
|
curr->pDetailedPlacement->sSectorX * 7 -
|
||||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||||
curr->pDetailedPlacement->bTeam * 7 +
|
curr->pDetailedPlacement->bTeam * 7 +
|
||||||
curr->pDetailedPlacement->bDirection * 5 +
|
curr->pDetailedPlacement->ubDirection * 5 +
|
||||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||||
3;
|
3;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U
|
|||||||
if ( pDoorStatus && (pDoorStatus->ubFlags & DOOR_BUSY) )
|
if ( pDoorStatus && (pDoorStatus->ubFlags & DOOR_BUSY) )
|
||||||
{
|
{
|
||||||
// Send this guy into stationary stance....
|
// Send this guy into stationary stance....
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
if ( pSoldier->bTeam == gbPlayerNum )
|
if ( pSoldier->bTeam == gbPlayerNum )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2152,7 +2152,7 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV
|
|||||||
// IF SO, DONT'T ADD!
|
// IF SO, DONT'T ADD!
|
||||||
bTerrainID = GetTerrainType( *psGridNo );
|
bTerrainID = GetTerrainType( *psGridNo );
|
||||||
|
|
||||||
if ( bTerrainID == DEEP_WATER || bTerrainID == LOW_WATER || bTerrainID == MED_WATER )
|
if ( TERRAIN_IS_WATER( bTerrainID) )
|
||||||
{
|
{
|
||||||
// if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS )
|
// if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS )
|
||||||
if ( Item[ pObject->usItem ].sinks )
|
if ( Item[ pObject->usItem ].sinks )
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
|||||||
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
||||||
|
|
||||||
// Set direction
|
// Set direction
|
||||||
pPlanSoldier->bDirection = bDirection;
|
pPlanSoldier->ubDirection = bDirection;
|
||||||
pPlanSoldier->bDesiredDirection = bDirection;
|
pPlanSoldier->bDesiredDirection = bDirection;
|
||||||
|
|
||||||
// Set walking animation
|
// Set walking animation
|
||||||
@@ -194,7 +194,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
|||||||
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
||||||
|
|
||||||
// Set direction
|
// Set direction
|
||||||
pPlanSoldier->bDirection = bDirection;
|
pPlanSoldier->ubDirection = bDirection;
|
||||||
pPlanSoldier->bDesiredDirection = bDirection;
|
pPlanSoldier->bDesiredDirection = bDirection;
|
||||||
|
|
||||||
// Set walking animation
|
// Set walking animation
|
||||||
@@ -220,7 +220,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
|||||||
bDirection = (INT8)GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier );
|
bDirection = (INT8)GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier );
|
||||||
|
|
||||||
// Set direction
|
// Set direction
|
||||||
gpUIPlannedSoldier->bDirection = bDirection;
|
gpUIPlannedSoldier->ubDirection = bDirection;
|
||||||
gpUIPlannedSoldier->bDesiredDirection = bDirection;
|
gpUIPlannedSoldier->bDesiredDirection = bDirection;
|
||||||
|
|
||||||
// Set to shooting animation
|
// Set to shooting animation
|
||||||
|
|||||||
+11
-12
@@ -85,6 +85,7 @@
|
|||||||
#include "qarray.h"
|
#include "qarray.h"
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
#include "Map Information.h"
|
#include "Map Information.h"
|
||||||
|
#include "Soldier Control.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -246,8 +247,6 @@ void SetUIbasedOnStance( SOLDIERTYPE *pSoldier, INT8 bNewStance );
|
|||||||
INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags );
|
INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags );
|
||||||
INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles );
|
INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles );
|
||||||
|
|
||||||
extern void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
|
||||||
|
|
||||||
extern BOOLEAN gfExitDebugScreen;
|
extern BOOLEAN gfExitDebugScreen;
|
||||||
extern INT8 gCurDebugPage;
|
extern INT8 gCurDebugPage;
|
||||||
extern BOOLEAN gfGetNewPathThroughPeople;
|
extern BOOLEAN gfGetNewPathThroughPeople;
|
||||||
@@ -1238,7 +1237,7 @@ UINT32 UIHandleTestHit( UI_EVENT *pUIEvent )
|
|||||||
|
|
||||||
// gTacticalStatus.ubAttackBusyCount++;
|
// gTacticalStatus.ubAttackBusyCount++;
|
||||||
DebugAttackBusy( "Testing a hit.\n" );
|
DebugAttackBusy( "Testing a hit.\n" );
|
||||||
EVENT_SoldierGotHit( pSoldier, 1, bDamage, 10, pSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE );
|
EVENT_SoldierGotHit( pSoldier, 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE );
|
||||||
// callahan update end - put everything as it was
|
// callahan update end - put everything as it was
|
||||||
}
|
}
|
||||||
return( GAME_SCREEN );
|
return( GAME_SCREEN );
|
||||||
@@ -2136,7 +2135,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent )
|
|||||||
// IF we are on a basic level...(temp)
|
// IF we are on a basic level...(temp)
|
||||||
if ( pSoldier->bLevel == 0 )
|
if ( pSoldier->bLevel == 0 )
|
||||||
{
|
{
|
||||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||||
{
|
{
|
||||||
ubNearHeigherLevel = TRUE;
|
ubNearHeigherLevel = TRUE;
|
||||||
}
|
}
|
||||||
@@ -2145,7 +2144,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent )
|
|||||||
// IF we are higher...
|
// IF we are higher...
|
||||||
if ( pSoldier->bLevel > 0 )
|
if ( pSoldier->bLevel > 0 )
|
||||||
{
|
{
|
||||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||||
{
|
{
|
||||||
ubNearLowerLevel = TRUE;
|
ubNearLowerLevel = TRUE;
|
||||||
}
|
}
|
||||||
@@ -3000,7 +2999,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU
|
|||||||
if ( pSoldier->bLevel == 0 )
|
if ( pSoldier->bLevel == 0 )
|
||||||
{
|
{
|
||||||
// See if we are not in a building!
|
// See if we are not in a building!
|
||||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||||
{
|
{
|
||||||
*pfGoUp = TRUE;
|
*pfGoUp = TRUE;
|
||||||
}
|
}
|
||||||
@@ -3009,7 +3008,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU
|
|||||||
// IF we are higher...
|
// IF we are higher...
|
||||||
if ( pSoldier->bLevel > 0 )
|
if ( pSoldier->bLevel > 0 )
|
||||||
{
|
{
|
||||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||||
{
|
{
|
||||||
*pfGoDown = TRUE;
|
*pfGoDown = TRUE;
|
||||||
}
|
}
|
||||||
@@ -4571,7 +4570,7 @@ UINT32 UIHandleLCOnTerrain( UI_EVENT *pUIEvent )
|
|||||||
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
||||||
|
|
||||||
// Set # of APs
|
// Set # of APs
|
||||||
if ( sFacingDir != pSoldier->bDirection )
|
if ( sFacingDir != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
gsCurrentActionPoints = GetAPsToLook( pSoldier );
|
gsCurrentActionPoints = GetAPsToLook( pSoldier );
|
||||||
gfUIHandleShowMoveGrid = FALSE;
|
gfUIHandleShowMoveGrid = FALSE;
|
||||||
@@ -4627,7 +4626,7 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos )
|
|||||||
// Get direction from mouse pos
|
// Get direction from mouse pos
|
||||||
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
||||||
|
|
||||||
if ( sFacingDir != pSoldier->bDirection )
|
if ( sFacingDir != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
sAPCost = GetAPsToLook( pSoldier );
|
sAPCost = GetAPsToLook( pSoldier );
|
||||||
|
|
||||||
@@ -5341,7 +5340,7 @@ UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent )
|
|||||||
{
|
{
|
||||||
SOLDIERTYPE *pSoldier;
|
SOLDIERTYPE *pSoldier;
|
||||||
UINT16 usMapPos;
|
UINT16 usMapPos;
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
|
|
||||||
// Here, first get map screen
|
// Here, first get map screen
|
||||||
if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||||
@@ -5366,11 +5365,11 @@ UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent )
|
|||||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||||
|
|
||||||
// Get direction to goto....
|
// Get direction to goto....
|
||||||
bDirection = (INT8)GetDirectionFromGridNo( usMapPos, pSoldier );
|
ubDirection = GetDirectionFromGridNo( usMapPos, pSoldier );
|
||||||
|
|
||||||
|
|
||||||
pSoldier->fDontChargeTurningAPs = TRUE;
|
pSoldier->fDontChargeTurningAPs = TRUE;
|
||||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, bDirection, FALSE, pSoldier->usAnimState );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection);
|
||||||
pSoldier->fTurningUntilDone = TRUE;
|
pSoldier->fTurningUntilDone = TRUE;
|
||||||
// ATE: Reset flag to go back to prone...
|
// ATE: Reset flag to go back to prone...
|
||||||
//pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
|
//pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
|
||||||
|
|||||||
@@ -1775,7 +1775,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
|||||||
// see if we are facing this person
|
// see if we are facing this person
|
||||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(pSoldier2->sGridNo),CenterY(pSoldier2->sGridNo));
|
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(pSoldier2->sGridNo),CenterY(pSoldier2->sGridNo));
|
||||||
// if not already facing in that direction,
|
// if not already facing in that direction,
|
||||||
if (pSoldier->bDirection != ubDesiredMercDir)
|
if (pSoldier->ubDirection != ubDesiredMercDir)
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
||||||
}
|
}
|
||||||
@@ -1961,7 +1961,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
|||||||
pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE );
|
pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE );
|
||||||
if (pSoldier && pSoldier->inv[HANDPOS].usItem != NOTHING)
|
if (pSoldier && pSoldier->inv[HANDPOS].usItem != NOTHING)
|
||||||
{
|
{
|
||||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->bDirection );
|
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection );
|
||||||
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2226,7 +2226,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
|||||||
if (bItemIn != NO_SLOT && bItemIn != HANDPOS)
|
if (bItemIn != NO_SLOT && bItemIn != HANDPOS)
|
||||||
{
|
{
|
||||||
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[bItemIn]) );
|
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[bItemIn]) );
|
||||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->bDirection );
|
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection );
|
||||||
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
||||||
}
|
}
|
||||||
// fall through so that the person faces the nearest merc!
|
// fall through so that the person faces the nearest merc!
|
||||||
@@ -2240,7 +2240,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
|||||||
// see if we are facing this person
|
// see if we are facing this person
|
||||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sGridNo),CenterY(sGridNo));
|
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sGridNo),CenterY(sGridNo));
|
||||||
// if not already facing in that direction,
|
// if not already facing in that direction,
|
||||||
if (pSoldier->bDirection != ubDesiredMercDir)
|
if (pSoldier->ubDirection != ubDesiredMercDir)
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
||||||
}
|
}
|
||||||
@@ -2395,7 +2395,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
|||||||
if (pSoldier)
|
if (pSoldier)
|
||||||
{
|
{
|
||||||
DeleteTalkingMenu();
|
DeleteTalkingMenu();
|
||||||
EVENT_SoldierGotHit( pSoldier, 1, 100, 10, pSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE );
|
EVENT_SoldierGotHit( pSoldier, 1, 100, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -4455,7 +4455,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo )
|
|||||||
bTargetDirection = (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSrcGridNo );
|
bTargetDirection = (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSrcGridNo );
|
||||||
|
|
||||||
// Look 3 directions Clockwise from what we are facing....
|
// Look 3 directions Clockwise from what we are facing....
|
||||||
bDirection = pSoldier->bDirection;
|
bDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
for ( cnt = 0; cnt < 3; cnt++ )
|
for ( cnt = 0; cnt < 3; cnt++ )
|
||||||
{
|
{
|
||||||
@@ -4468,7 +4468,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look 3 directions CounterClockwise from what we are facing....
|
// Look 3 directions CounterClockwise from what we are facing....
|
||||||
bDirection = pSoldier->bDirection;
|
bDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
for ( cnt = 0; cnt < 3; cnt++ )
|
for ( cnt = 0; cnt < 3; cnt++ )
|
||||||
{
|
{
|
||||||
@@ -4826,7 +4826,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow if our soldier is a # of things...
|
// Don't allow if our soldier is a # of things...
|
||||||
if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->bLife < OKLIFE || gpItemPointerSoldier->bOverTerrainType == DEEP_WATER )
|
if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->bLife < OKLIFE || MercInDeepWater( gpItemPointerSoldier) )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -5130,7 +5130,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos )
|
|||||||
ubFacingDirection = (UINT8)GetDirectionFromGridNo( gpItemPointerSoldier->sGridNo, pSoldier );
|
ubFacingDirection = (UINT8)GetDirectionFromGridNo( gpItemPointerSoldier->sGridNo, pSoldier );
|
||||||
|
|
||||||
// Stop merc first....
|
// Stop merc first....
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
// WANNE: Also turn merc if he is crouched and he passes an item
|
// WANNE: Also turn merc if he is crouched and he passes an item
|
||||||
if ( !MercInWater( pSoldier ) )
|
if ( !MercInWater( pSoldier ) )
|
||||||
|
|||||||
@@ -900,7 +900,7 @@ void UpdateSMPanel( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bDirection, &bDirection ) )
|
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) )
|
||||||
{
|
{
|
||||||
EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] );
|
EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] );
|
||||||
}
|
}
|
||||||
@@ -3140,7 +3140,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
BeginSoldierClimbUpRoof( gpSMCurrentMerc );
|
BeginSoldierClimbUpRoof( gpSMCurrentMerc );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bDirection, &bDirection ) )
|
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) )
|
||||||
{
|
{
|
||||||
BeginSoldierClimbFence( gpSMCurrentMerc );
|
BeginSoldierClimbFence( gpSMCurrentMerc );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -586,10 +586,10 @@ typedef enum
|
|||||||
BIG_TEAR_GAS,
|
BIG_TEAR_GAS,
|
||||||
SMALL_CREATURE_GAS,
|
SMALL_CREATURE_GAS,
|
||||||
LARGE_CREATURE_GAS,
|
LARGE_CREATURE_GAS,
|
||||||
VERY_SMALL_CREATURE_GAS,
|
VERY_SMALL_CREATURE_GAS=995, // Renumbered because the original 160 was lost
|
||||||
|
|
||||||
// armor
|
// armor
|
||||||
FLAK_JACKET, //= FIRST_ARMOUR, ( We're out of space! )
|
FLAK_JACKET=161, //= FIRST_ARMOUR, ( We're out of space! )
|
||||||
FLAK_JACKET_18,
|
FLAK_JACKET_18,
|
||||||
FLAK_JACKET_Y,
|
FLAK_JACKET_Y,
|
||||||
KEVLAR_VEST,
|
KEVLAR_VEST,
|
||||||
|
|||||||
+22
-32
@@ -4844,6 +4844,7 @@ BOOLEAN CreateGun( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj )
|
|||||||
{
|
{
|
||||||
pObj->ItemData.Gun.ubGunShotsLeft = GetMagSize(pObj);
|
pObj->ItemData.Gun.ubGunShotsLeft = GetMagSize(pObj);
|
||||||
pObj->ItemData.Gun.ubGunAmmoType = AMMO_MONSTER;
|
pObj->ItemData.Gun.ubGunAmmoType = AMMO_MONSTER;
|
||||||
|
pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // 0verhaul: Monsters don't have to reload!
|
||||||
}
|
}
|
||||||
else if ( EXPLOSIVE_GUN( usItem ) )
|
else if ( EXPLOSIVE_GUN( usItem ) )
|
||||||
{
|
{
|
||||||
@@ -5701,7 +5702,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
INT8 bLoop, bDamage, bDieSize;
|
INT8 bLoop, bDamage, bDieSize;
|
||||||
UINT32 uiRoll;
|
UINT32 uiRoll;
|
||||||
|
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
for ( bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++ )
|
for ( bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++ )
|
||||||
{
|
{
|
||||||
@@ -5733,7 +5734,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
// reduce camouflage by 2% per tile of deep water
|
// reduce camouflage by 2% per tile of deep water
|
||||||
// and 1% for medium water
|
// and 1% for medium water
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 2 );
|
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 2 );
|
||||||
else
|
else
|
||||||
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 1 );
|
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 1 );
|
||||||
@@ -5746,7 +5747,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
// reduce camouflage by 2% per tile of deep water
|
// reduce camouflage by 2% per tile of deep water
|
||||||
// and 1% for medium water
|
// and 1% for medium water
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 2 );
|
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 2 );
|
||||||
else
|
else
|
||||||
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 1 );
|
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 1 );
|
||||||
@@ -5759,7 +5760,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
// reduce camouflage by 2% per tile of deep water
|
// reduce camouflage by 2% per tile of deep water
|
||||||
// and 1% for medium water
|
// and 1% for medium water
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 2 );
|
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 2 );
|
||||||
else
|
else
|
||||||
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 1 );
|
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 1 );
|
||||||
@@ -5772,7 +5773,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
// reduce camouflage by 2% per tile of deep water
|
// reduce camouflage by 2% per tile of deep water
|
||||||
// and 1% for medium water
|
// and 1% for medium water
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 2 );
|
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 2 );
|
||||||
else
|
else
|
||||||
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 1 );
|
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 1 );
|
||||||
@@ -5798,7 +5799,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bMonsterSmell > 0 )
|
if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bMonsterSmell > 0 )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
bDieSize = 10;
|
bDieSize = 10;
|
||||||
}
|
}
|
||||||
@@ -6557,8 +6558,6 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
|||||||
UINT16 usItem;
|
UINT16 usItem;
|
||||||
INVTYPE *pItem;
|
INVTYPE *pItem;
|
||||||
|
|
||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
// Okay, it's time for some optimization here too
|
// Okay, it's time for some optimization here too
|
||||||
@@ -6572,15 +6571,16 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true) )
|
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
bns += BonusReduceMore( pItem->visionrangebonus, pObj->ItemData.Generic.bStatus[0] );
|
bns += BonusReduceMore( pItem->visionrangebonus, pObj->ItemData.Generic.bStatus[0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a readied weapon!
|
||||||
|
// 0verhaul: Moved this bug fix into WeaponReady so that all CTH modifier functions may benefit from this fix
|
||||||
//AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
//AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[HANDPOS]);
|
pObj = &( pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
@@ -6614,8 +6614,6 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
UINT16 usItem;
|
UINT16 usItem;
|
||||||
INVTYPE *pItem;
|
INVTYPE *pItem;
|
||||||
|
|
||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
// More optimization
|
// More optimization
|
||||||
@@ -6629,7 +6627,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
bns += BonusReduceMore(
|
bns += BonusReduceMore(
|
||||||
NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ),
|
NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ),
|
||||||
@@ -6638,7 +6636,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[HANDPOS]);
|
pObj = &( pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
@@ -6660,8 +6658,6 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
UINT16 usItem;
|
UINT16 usItem;
|
||||||
INVTYPE *pItem;
|
INVTYPE *pItem;
|
||||||
|
|
||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
// More optimization
|
// More optimization
|
||||||
@@ -6676,7 +6672,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
bns += BonusReduceMore(
|
bns += BonusReduceMore(
|
||||||
NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ),
|
NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ),
|
||||||
@@ -6685,7 +6681,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[HANDPOS]);
|
pObj = &( pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
@@ -6709,8 +6705,6 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
|
|
||||||
// Snap: Scale the bonus with the light level
|
// Snap: Scale the bonus with the light level
|
||||||
|
|
||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
// More optimization
|
// More optimization
|
||||||
@@ -6725,7 +6719,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
bns += BonusReduceMore( idiv( pItem->dayvisionrangebonus
|
bns += BonusReduceMore( idiv( pItem->dayvisionrangebonus
|
||||||
* (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ),
|
* (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ),
|
||||||
@@ -6734,7 +6728,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[HANDPOS]);
|
pObj = &( pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
@@ -6758,8 +6752,6 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
|||||||
|
|
||||||
// Snap: Scale the bonus with the light level
|
// Snap: Scale the bonus with the light level
|
||||||
|
|
||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
// More optimization
|
// More optimization
|
||||||
@@ -6774,7 +6766,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
bns += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus
|
bns += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus
|
||||||
* (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ),
|
* (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ),
|
||||||
@@ -6783,7 +6775,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[HANDPOS]);
|
pObj = &( pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
@@ -6850,9 +6842,8 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
OBJECTTYPE *pInv = &(pSoldier->inv[HANDPOS]);
|
OBJECTTYPE *pInv = &(pSoldier->inv[HANDPOS]);
|
||||||
usItem = pInv->usItem;
|
usItem = pInv->usItem;
|
||||||
@@ -6877,7 +6868,6 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
|||||||
BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
|
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
|
||||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||||
{
|
{
|
||||||
if ( (i == HANDPOS || i == SECONDHANDPOS) &&
|
if ( (i == HANDPOS || i == SECONDHANDPOS) &&
|
||||||
@@ -6886,7 +6876,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) )
|
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && WeaponReady(pSoldier) ) )
|
||||||
{
|
{
|
||||||
if (Item[pSoldier->inv[i].usItem].thermaloptics)
|
if (Item[pSoldier->inv[i].usItem].thermaloptics)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -6894,7 +6884,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snap: check only attachments on a raised weapon!
|
// Snap: check only attachments on a raised weapon!
|
||||||
if ( usingGunScope == true )
|
if ( WeaponReady(pSoldier) )
|
||||||
{
|
{
|
||||||
for (int i=0; i < MAX_ATTACHMENTS; i++)
|
for (int i=0; i < MAX_ATTACHMENTS; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-8
@@ -1410,12 +1410,12 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p
|
|||||||
// Crow always as prone...
|
// Crow always as prone...
|
||||||
ubHeight = ANIM_PRONE;
|
ubHeight = ANIM_PRONE;
|
||||||
}
|
}
|
||||||
else if (pSoldier->bOverTerrainType == DEEP_WATER)
|
else if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
// treat as prone
|
// treat as prone
|
||||||
ubHeight = ANIM_PRONE;
|
ubHeight = ANIM_PRONE;
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
else if ( MercInShallowWater(pSoldier) )
|
||||||
{
|
{
|
||||||
// treat as crouched
|
// treat as crouched
|
||||||
ubHeight = ANIM_CROUCH;
|
ubHeight = ANIM_CROUCH;
|
||||||
@@ -2020,7 +2020,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
|||||||
if ( (pTarget->ubBodyType >= ADULTFEMALEMONSTER) && (pTarget->ubBodyType <= YAM_MONSTER) )
|
if ( (pTarget->ubBodyType >= ADULTFEMALEMONSTER) && (pTarget->ubBodyType <= YAM_MONSTER) )
|
||||||
{
|
{
|
||||||
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
||||||
if ( ubAttackDirection == pTarget->bDirection || ubAttackDirection == gOneCCDirection[ pTarget->bDirection ] || ubAttackDirection == gOneCDirection[ pTarget->bDirection ] )
|
if ( ubAttackDirection == pTarget->ubDirection || ubAttackDirection == gOneCCDirection[ pTarget->ubDirection ] || ubAttackDirection == gOneCDirection[ pTarget->ubDirection ] )
|
||||||
{
|
{
|
||||||
// may hit weak spot!
|
// may hit weak spot!
|
||||||
if (0) // check fact
|
if (0) // check fact
|
||||||
@@ -2043,7 +2043,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
|||||||
if (ubHitLocation == AIM_SHOT_RANDOM) // i.e. if not set yet
|
if (ubHitLocation == AIM_SHOT_RANDOM) // i.e. if not set yet
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pTarget->bOverTerrainType == DEEP_WATER)
|
if (MercInDeepWater( pTarget) )
|
||||||
{
|
{
|
||||||
// automatic head hit!
|
// automatic head hit!
|
||||||
ubHitLocation = AIM_SHOT_HEAD;
|
ubHitLocation = AIM_SHOT_HEAD;
|
||||||
@@ -2054,7 +2054,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
|||||||
{
|
{
|
||||||
case ANIM_STAND:
|
case ANIM_STAND:
|
||||||
// Fall through to crouch if in shallow or medium water
|
// Fall through to crouch if in shallow or medium water
|
||||||
if ( pTarget->bOverTerrainType != LOW_WATER && pTarget->bOverTerrainType != MED_WATER )
|
if ( !MercInShallowWater( pTarget) )
|
||||||
{
|
{
|
||||||
dZPosRelToMerc = FixedToFloat( pBullet->qCurrZ ) - CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[pBullet->sGridNo].sHeight );
|
dZPosRelToMerc = FixedToFloat( pBullet->qCurrZ ) - CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[pBullet->sGridNo].sHeight );
|
||||||
if ( dZPosRelToMerc > HEIGHT_UNITS )
|
if ( dZPosRelToMerc > HEIGHT_UNITS )
|
||||||
@@ -2110,7 +2110,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
|||||||
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
||||||
ubOppositeDirection = gOppositeDirection[ ubAttackDirection ];
|
ubOppositeDirection = gOppositeDirection[ ubAttackDirection ];
|
||||||
|
|
||||||
if ( ! ( ubOppositeDirection == pTarget->bDirection || ubAttackDirection == gOneCCDirection[ pTarget->bDirection ] || ubAttackDirection == gOneCDirection[ pTarget->bDirection ] ) )
|
if ( ! ( ubOppositeDirection == pTarget->ubDirection || ubAttackDirection == gOneCCDirection[ pTarget->ubDirection ] || ubAttackDirection == gOneCDirection[ pTarget->ubDirection ] ) )
|
||||||
{
|
{
|
||||||
// lucky bastard was facing away!
|
// lucky bastard was facing away!
|
||||||
}
|
}
|
||||||
@@ -4724,7 +4724,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel
|
|||||||
if (iCurrAboveLevelZ < 0)
|
if (iCurrAboveLevelZ < 0)
|
||||||
{
|
{
|
||||||
// ground is in the way!
|
// ground is in the way!
|
||||||
if ( pMapElement->ubTerrainID == DEEP_WATER || pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER )
|
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||||
{
|
{
|
||||||
return ( COLLISION_WATER );
|
return ( COLLISION_WATER );
|
||||||
}
|
}
|
||||||
@@ -4764,7 +4764,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel
|
|||||||
if ( dZ < iLandHeight)
|
if ( dZ < iLandHeight)
|
||||||
{
|
{
|
||||||
// ground is in the way!
|
// ground is in the way!
|
||||||
if ( pMapElement->ubTerrainID == DEEP_WATER || pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER )
|
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||||
{
|
{
|
||||||
return ( COLLISION_WATER );
|
return ( COLLISION_WATER );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BUILD STRUCTURES
|
// BUILD STRUCTURES
|
||||||
memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
// MercCreateStruct has been C++'d
|
||||||
|
//memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
||||||
MercCreateStruct.ubProfile = ubCurrentSoldier;
|
MercCreateStruct.ubProfile = ubCurrentSoldier;
|
||||||
MercCreateStruct.fPlayerMerc = TRUE;
|
MercCreateStruct.fPlayerMerc = TRUE;
|
||||||
MercCreateStruct.sSectorX = pHireMerc->sSectorX;
|
MercCreateStruct.sSectorX = pHireMerc->sSectorX;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void ResetMilitia()
|
|||||||
UINT8 ubNumGreen = 0;
|
UINT8 ubNumGreen = 0;
|
||||||
UINT8 ubNumReg = 0;
|
UINT8 ubNumReg = 0;
|
||||||
UINT8 ubNumVet = 0;
|
UINT8 ubNumVet = 0;
|
||||||
UINT32 cnt;
|
//UINT32 cnt;
|
||||||
|
|
||||||
// if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
// if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||||
// fBattleInProgress = TRUE;
|
// fBattleInProgress = TRUE;
|
||||||
@@ -1096,7 +1096,7 @@ BOOLEAN CheckIfRadioIsEquipped( void )
|
|||||||
//sFacingDir = GetDirectionFromXY( sXPos, sYPos, pTMilitiaSoldier );
|
//sFacingDir = GetDirectionFromXY( sXPos, sYPos, pTMilitiaSoldier );
|
||||||
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, sFacingDir );
|
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, sFacingDir );
|
||||||
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, gOppositeDirection[ sFacingDir ] );
|
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, gOppositeDirection[ sFacingDir ] );
|
||||||
//EVENT_StopMerc( pTMilitiaSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->bDirection );
|
//EVENT_StopMerc( pTMilitiaSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->ubDirection );
|
||||||
|
|
||||||
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_PRONE );
|
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_PRONE );
|
||||||
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_CROUCH );
|
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_CROUCH );
|
||||||
|
|||||||
+22
-22
@@ -2023,13 +2023,13 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
{
|
{
|
||||||
if ( pSoldier2->bActive )
|
if ( pSoldier2->bActive )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pfKeepMoving) = FALSE;
|
(*pfKeepMoving) = FALSE;
|
||||||
@@ -2049,7 +2049,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
if (sMineGridNo != NOWHERE)
|
if (sMineGridNo != NOWHERE)
|
||||||
{
|
{
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
(*pfKeepMoving) = FALSE;
|
(*pfKeepMoving) = FALSE;
|
||||||
|
|
||||||
if (pSoldier->bSide != 0)
|
if (pSoldier->bSide != 0)
|
||||||
@@ -2179,7 +2179,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
{
|
{
|
||||||
if ( pExplosive )
|
if ( pExplosive )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
fDontContinue = TRUE;
|
fDontContinue = TRUE;
|
||||||
|
|
||||||
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
|
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
|
||||||
@@ -2215,7 +2215,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) &&
|
if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) &&
|
||||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||||
{
|
{
|
||||||
// 20% chance of falling over!
|
// 20% chance of falling over!
|
||||||
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
||||||
@@ -2228,7 +2228,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) &&
|
else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) &&
|
||||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||||
{
|
{
|
||||||
// 20% chance of falling over!
|
// 20% chance of falling over!
|
||||||
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
||||||
@@ -2255,7 +2255,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
|||||||
pSoldier->ubNumTilesMovesSinceLastForget = 0;
|
pSoldier->ubNumTilesMovesSinceLastForget = 0;
|
||||||
|
|
||||||
TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT );
|
TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT );
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
if (pSoldier->bActionPoints > 0)
|
if (pSoldier->bActionPoints > 0)
|
||||||
{
|
{
|
||||||
pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1);
|
pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1);
|
||||||
@@ -2373,7 +2373,7 @@ void HandleMaryArrival( SOLDIERTYPE * pSoldier )
|
|||||||
// Mary has arrived
|
// Mary has arrived
|
||||||
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
TriggerNPCRecord( MARY, 13 );
|
TriggerNPCRecord( MARY, 13 );
|
||||||
}
|
}
|
||||||
@@ -2417,12 +2417,12 @@ void HandleJohnArrival( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
// if Mary is alive/dead
|
// if Mary is alive/dead
|
||||||
if ( pSoldier2 )
|
if ( pSoldier2 )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||||
TriggerNPCRecord( JOHN, 13 );
|
TriggerNPCRecord( JOHN, 13 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2519,7 +2519,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
if (SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ) )
|
if (SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ) )
|
||||||
{
|
{
|
||||||
(*pfKeepMoving) = FALSE;
|
(*pfKeepMoving) = FALSE;
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2615,13 +2615,13 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
{
|
{
|
||||||
if ( pSoldier2->bActive )
|
if ( pSoldier2->bActive )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pfKeepMoving) = FALSE;
|
(*pfKeepMoving) = FALSE;
|
||||||
@@ -2641,7 +2641,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
if (sMineGridNo != NOWHERE)
|
if (sMineGridNo != NOWHERE)
|
||||||
{
|
{
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
(*pfKeepMoving) = FALSE;
|
(*pfKeepMoving) = FALSE;
|
||||||
|
|
||||||
gpWorldLevelData[ sMineGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT;
|
gpWorldLevelData[ sMineGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT;
|
||||||
@@ -2668,7 +2668,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
if (PythSpacesAway( pSoldier->sGridNo, 8842 ) < 11)
|
if (PythSpacesAway( pSoldier->sGridNo, 8842 ) < 11)
|
||||||
{
|
{
|
||||||
// Skyrider has arrived!
|
// Skyrider has arrived!
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
SetFactTrue( FACT_SKYRIDER_CLOSE_TO_CHOPPER );
|
SetFactTrue( FACT_SKYRIDER_CLOSE_TO_CHOPPER );
|
||||||
TriggerNPCRecord( SKYRIDER, 15 );
|
TriggerNPCRecord( SKYRIDER, 15 );
|
||||||
SetUpHelicopterForPlayer( 13, MAP_ROW_B );
|
SetUpHelicopterForPlayer( 13, MAP_ROW_B );
|
||||||
@@ -2698,7 +2698,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
|||||||
// if Joey walks near Martha then trigger Martha record 7
|
// if Joey walks near Martha then trigger Martha record 7
|
||||||
if ( CheckFact( FACT_JOEY_NEAR_MARTHA, 0 ) )
|
if ( CheckFact( FACT_JOEY_NEAR_MARTHA, 0 ) )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
TriggerNPCRecord( JOEY, 9 );
|
TriggerNPCRecord( JOEY, 9 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4603,7 +4603,7 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect
|
|||||||
// Set default direction
|
// Set default direction
|
||||||
if (pubDirection)
|
if (pubDirection)
|
||||||
{
|
{
|
||||||
*pubDirection = pSoldier->bDirection;
|
*pubDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK IF WE WANT TO FORCE GRIDNO TO PERSON
|
// CHECK IF WE WANT TO FORCE GRIDNO TO PERSON
|
||||||
@@ -4896,7 +4896,7 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub
|
|||||||
// CHECK IF IT'S THE SAME ONE AS WE'RE ON, IF SO, RETURN THAT!
|
// CHECK IF IT'S THE SAME ONE AS WE'RE ON, IF SO, RETURN THAT!
|
||||||
if ( pSoldier->sGridNo == sGridNo )
|
if ( pSoldier->sGridNo == sGridNo )
|
||||||
{
|
{
|
||||||
*pubDirection = pSoldier->bDirection;
|
*pubDirection = pSoldier->ubDirection;
|
||||||
return( sGridNo );
|
return( sGridNo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5023,7 +5023,7 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub
|
|||||||
{
|
{
|
||||||
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||||
}
|
}
|
||||||
//*pubDirection = pSoldier->bDirection;
|
//*pubDirection = pSoldier->ubDirection;
|
||||||
return( sSpot );
|
return( sSpot );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5417,7 +5417,7 @@ void CommonEnterCombatModeCode( )
|
|||||||
pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_MULTIPLE_CREATURES);
|
pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_MULTIPLE_CREATURES);
|
||||||
|
|
||||||
// Hault!
|
// Hault!
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
// END AI actions
|
// END AI actions
|
||||||
CancelAIAction( pSoldier, TRUE );
|
CancelAIAction( pSoldier, TRUE );
|
||||||
@@ -7053,7 +7053,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: // standing!
|
default: // standing!
|
||||||
if (pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == DEEP_WATER)
|
if ( MercInWater( pSoldier ))
|
||||||
{
|
{
|
||||||
// can't change stance here!
|
// can't change stance here!
|
||||||
break;
|
break;
|
||||||
@@ -7900,7 +7900,7 @@ void CencelAllActionsForTimeCompression( void )
|
|||||||
if ( pSoldier->bInSector )
|
if ( pSoldier->bInSector )
|
||||||
{
|
{
|
||||||
// Hault!
|
// Hault!
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
// END AI actions
|
// END AI actions
|
||||||
CancelAIAction( pSoldier, TRUE );
|
CancelAIAction( pSoldier, TRUE );
|
||||||
|
|||||||
+4
-4
@@ -2384,11 +2384,11 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
|
|||||||
{
|
{
|
||||||
if (fReverse)
|
if (fReverse)
|
||||||
{
|
{
|
||||||
iLastDir = gOppositeDirection[s->bDirection];
|
iLastDir = gOppositeDirection[s->ubDirection];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iLastDir = s->bDirection;
|
iLastDir = s->ubDirection;
|
||||||
}
|
}
|
||||||
// start prev-to-last dir at same as current (could cause a problem)
|
// start prev-to-last dir at same as current (could cause a problem)
|
||||||
iPrevToLastDir = iLastDir;
|
iPrevToLastDir = iLastDir;
|
||||||
@@ -2442,7 +2442,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
|
|||||||
{
|
{
|
||||||
if (trailTreeNdx < 2)
|
if (trailTreeNdx < 2)
|
||||||
{
|
{
|
||||||
iLastDir = s->bDirection;
|
iLastDir = s->ubDirection;
|
||||||
}
|
}
|
||||||
else if ( trailTree[pCurrPtr->sPathNdx].fFlags & STEP_BACKWARDS )
|
else if ( trailTree[pCurrPtr->sPathNdx].fFlags & STEP_BACKWARDS )
|
||||||
{
|
{
|
||||||
@@ -3866,7 +3866,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl
|
|||||||
usMovementModeToUseForAPs = usMovementMode;
|
usMovementModeToUseForAPs = usMovementMode;
|
||||||
|
|
||||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||||
if ( gpWorldLevelData[ sTempGrid ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sTempGrid ].ubTerrainID == MED_WATER || gpWorldLevelData[ sTempGrid ].ubTerrainID == LOW_WATER )
|
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sTempGrid ].ubTerrainID) )
|
||||||
{
|
{
|
||||||
usMovementModeToUseForAPs = WALKING;
|
usMovementModeToUseForAPs = WALKING;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -216,7 +216,7 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT1
|
|||||||
iPoints = iPoints * BreathPointAdjustmentForCarriedWeight( pSoldier ) / 100;
|
iPoints = iPoints * BreathPointAdjustmentForCarriedWeight( pSoldier ) / 100;
|
||||||
|
|
||||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||||
if ( gpWorldLevelData[ sGridno ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sGridno ].ubTerrainID == MED_WATER || gpWorldLevelData[ sGridno ].ubTerrainID == LOW_WATER )
|
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridno ].ubTerrainID) )
|
||||||
{
|
{
|
||||||
usMovementMode = WALKING;
|
usMovementMode = WALKING;
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 u
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||||
if ( gpWorldLevelData[ sGridNo ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == MED_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == LOW_WATER )
|
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridNo ].ubTerrainID) )
|
||||||
{
|
{
|
||||||
usMovementMode = WALKING;
|
usMovementMode = WALKING;
|
||||||
}
|
}
|
||||||
@@ -1257,7 +1257,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo
|
|||||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||||
|
|
||||||
// Is it the same as he's facing?
|
// Is it the same as he's facing?
|
||||||
if ( ubDirection != pSoldier->bDirection )
|
if ( ubDirection != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
fAddingTurningCost = TRUE;
|
fAddingTurningCost = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ UINT8 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost
|
|||||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||||
|
|
||||||
// Is it the same as he's facing?
|
// Is it the same as he's facing?
|
||||||
if ( ubDirection != pSoldier->bDirection )
|
if ( ubDirection != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
bAPCost += AP_LOOK_STANDING;
|
bAPCost += AP_LOOK_STANDING;
|
||||||
}
|
}
|
||||||
@@ -1520,7 +1520,7 @@ INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection )
|
|||||||
// ATE: Check if the new place is watter and we were tying to run....
|
// ATE: Check if the new place is watter and we were tying to run....
|
||||||
bOverTerrainType = GetTerrainType( sGridno );
|
bOverTerrainType = GetTerrainType( sGridno );
|
||||||
|
|
||||||
if ( bOverTerrainType == MED_WATER || bOverTerrainType == DEEP_WATER || bOverTerrainType == LOW_WATER )
|
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||||
{
|
{
|
||||||
usMoveModeToUse = WALKING;
|
usMoveModeToUse = WALKING;
|
||||||
}
|
}
|
||||||
@@ -2222,7 +2222,7 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos
|
|||||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||||
|
|
||||||
// Is it the same as he's facing?
|
// Is it the same as he's facing?
|
||||||
if ( ubDirection != pSoldier->bDirection )
|
if ( ubDirection != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
//Lalien: disabled it again
|
//Lalien: disabled it again
|
||||||
//AXP 25.03.2007: Reenabled look cost
|
//AXP 25.03.2007: Reenabled look cost
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
|||||||
case HUMMER_DEAD:
|
case HUMMER_DEAD:
|
||||||
|
|
||||||
// OK , these have 2 directions....
|
// OK , these have 2 directions....
|
||||||
bDirection = gb2DirectionsFrom8[ pCorpseDef->bDirection ];
|
bDirection = gb2DirectionsFrom8[ pCorpseDef->ubDirection ];
|
||||||
if ( fForImage )
|
if ( fForImage )
|
||||||
{
|
{
|
||||||
bDirection = gOneCDirection[ bDirection ];
|
bDirection = gOneCDirection[ bDirection ];
|
||||||
@@ -427,7 +427,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
|||||||
case FMERC_FALLF:
|
case FMERC_FALLF:
|
||||||
|
|
||||||
// OK , these have 4 directions....
|
// OK , these have 4 directions....
|
||||||
bDirection = gb4DirectionsFrom8[ pCorpseDef->bDirection ];
|
bDirection = gb4DirectionsFrom8[ pCorpseDef->ubDirection ];
|
||||||
|
|
||||||
// if ( fForImage )
|
// if ( fForImage )
|
||||||
// {
|
// {
|
||||||
@@ -438,7 +438,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
// Uses 8
|
// Uses 8
|
||||||
bDirection = pCorpseDef->bDirection;
|
bDirection = pCorpseDef->ubDirection;
|
||||||
|
|
||||||
if ( fForImage )
|
if ( fForImage )
|
||||||
{
|
{
|
||||||
@@ -541,7 +541,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef )
|
|||||||
AniParams.sX = CenterX( pCorpse->def.sGridNo );
|
AniParams.sX = CenterX( pCorpse->def.sGridNo );
|
||||||
AniParams.sY = CenterY( pCorpse->def.sGridNo );
|
AniParams.sY = CenterY( pCorpse->def.sGridNo );
|
||||||
AniParams.sZ = (INT16)pCorpse->def.sHeightAdjustment;
|
AniParams.sZ = (INT16)pCorpse->def.sHeightAdjustment;
|
||||||
AniParams.uiUserData3 = pCorpse->def.bDirection;
|
AniParams.uiUserData3 = pCorpse->def.ubDirection;
|
||||||
|
|
||||||
|
|
||||||
if ( !gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] )
|
if ( !gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] )
|
||||||
@@ -847,7 +847,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
|||||||
// Determine corpse type!
|
// Determine corpse type!
|
||||||
ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ];
|
ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ];
|
||||||
|
|
||||||
Corpse.bDirection = pSoldier->bDirection;
|
Corpse.ubDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
// If we are a vehicle.... only use 1 direction....
|
// If we are a vehicle.... only use 1 direction....
|
||||||
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
||||||
@@ -856,17 +856,17 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
|||||||
|
|
||||||
if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE )
|
if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE )
|
||||||
{
|
{
|
||||||
Corpse.bDirection = 7;
|
Corpse.ubDirection = 7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Corpse.bDirection = gb2DirectionsFrom8[ Corpse.bDirection ];
|
Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD )
|
if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD )
|
||||||
{
|
{
|
||||||
Corpse.bDirection = 7;
|
Corpse.ubDirection = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1077,7 +1077,7 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse )
|
|||||||
MercCreateStruct.sSectorY = gWorldSectorY;
|
MercCreateStruct.sSectorY = gWorldSectorY;
|
||||||
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
||||||
MercCreateStruct.bBodyType = bBodyType;
|
MercCreateStruct.bBodyType = bBodyType;
|
||||||
MercCreateStruct.bDirection = SOUTH;
|
MercCreateStruct.ubDirection = SOUTH;
|
||||||
MercCreateStruct.bTeam = CIV_TEAM;
|
MercCreateStruct.bTeam = CIV_TEAM;
|
||||||
MercCreateStruct.sInsertionGridNo = pCorpse->def.sGridNo;
|
MercCreateStruct.sInsertionGridNo = pCorpse->def.sGridNo;
|
||||||
RandomizeNewSoldierStats( &MercCreateStruct );
|
RandomizeNewSoldierStats( &MercCreateStruct );
|
||||||
@@ -1693,7 +1693,7 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8
|
|||||||
{
|
{
|
||||||
if ( fSetDirection )
|
if ( fSetDirection )
|
||||||
{
|
{
|
||||||
pDef->bDirection = ubBestDirection;
|
pDef->ubDirection = ubBestDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sLowestGridNo;
|
return sLowestGridNo;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ typedef struct
|
|||||||
PaletteRepID VestPal;
|
PaletteRepID VestPal;
|
||||||
PaletteRepID SkinPal;
|
PaletteRepID SkinPal;
|
||||||
|
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
UINT32 uiTimeOfDeath;
|
UINT32 uiTimeOfDeath;
|
||||||
|
|
||||||
UINT16 usFlags;
|
UINT16 usFlags;
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn
|
|||||||
// If we are already at this gridno....
|
// If we are already at this gridno....
|
||||||
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
||||||
{
|
{
|
||||||
*pubDirection = pSoldier->bDirection;
|
*pubDirection = pSoldier->ubDirection;
|
||||||
return( sSweetGridNo );
|
return( sSweetGridNo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP
|
|||||||
// If we are already at this gridno....
|
// If we are already at this gridno....
|
||||||
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
||||||
{
|
{
|
||||||
*pubDirection = pSoldier->bDirection;
|
*pubDirection = pSoldier->ubDirection;
|
||||||
return( sSweetGridNo );
|
return( sSweetGridNo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,7 +1219,7 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
|
|||||||
|
|
||||||
//Add
|
//Add
|
||||||
if(gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
|
if(gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
|
||||||
AddSoldierToSectorGridNo( pSoldier, sGridNo, pSoldier->bDirection, fUseAnimation, usAnimState, usAnimCode );
|
AddSoldierToSectorGridNo( pSoldier, sGridNo, pSoldier->ubDirection, fUseAnimation, usAnimState, usAnimCode );
|
||||||
else
|
else
|
||||||
AddSoldierToSectorGridNo( pSoldier, sGridNo, ubDirection, fUseAnimation, usAnimState, usAnimCode );
|
AddSoldierToSectorGridNo( pSoldier, sGridNo, ubDirection, fUseAnimation, usAnimState, usAnimCode );
|
||||||
|
|
||||||
@@ -1279,7 +1279,7 @@ void InternalSoldierInSectorSleep( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN
|
|||||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||||
|
|
||||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
if ( AM_AN_EPC( pSoldier ) )
|
if ( AM_AN_EPC( pSoldier ) )
|
||||||
{
|
{
|
||||||
@@ -1320,7 +1320,7 @@ void SoldierInSectorIncompaciated( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
|||||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||||
|
|
||||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, STAND_FALLFORWARD_STOP, 1, TRUE );
|
EVENT_InitNewSoldierAnim( pSoldier, STAND_FALLFORWARD_STOP, 1, TRUE );
|
||||||
}
|
}
|
||||||
@@ -1356,7 +1356,7 @@ void SoldierInSectorPatient( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
|||||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||||
|
|
||||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||||
{
|
{
|
||||||
@@ -1391,7 +1391,7 @@ void SoldierInSectorDoctor( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
|||||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||||
|
|
||||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||||
{
|
{
|
||||||
@@ -1426,7 +1426,7 @@ void SoldierInSectorRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
|||||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||||
|
|
||||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||||
{
|
{
|
||||||
|
|||||||
+59
-57
@@ -238,7 +238,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 406:
|
case 406:
|
||||||
|
|
||||||
// Move merc up
|
// Move merc up
|
||||||
if ( pSoldier->bDirection == NORTH )
|
if ( pSoldier->ubDirection == NORTH )
|
||||||
{
|
{
|
||||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->sHeightAdjustment + 2 ) );
|
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->sHeightAdjustment + 2 ) );
|
||||||
}
|
}
|
||||||
@@ -257,14 +257,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
INT16 sXPos, sYPos;
|
INT16 sXPos, sYPos;
|
||||||
|
|
||||||
//usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->bDirection ) );
|
//usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) );
|
||||||
ConvertMapPosToWorldTileCenter( pSoldier->sTempNewGridNo, &sXPos, &sYPos );
|
ConvertMapPosToWorldTileCenter( pSoldier->sTempNewGridNo, &sXPos, &sYPos );
|
||||||
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
||||||
}
|
}
|
||||||
// Move two CC directions
|
// Move two CC directions
|
||||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] );
|
||||||
|
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
// Set desired anim height!
|
// Set desired anim height!
|
||||||
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
||||||
@@ -324,9 +324,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
// CODE: SPECIALMOVE CLIMB DOWN EVENT
|
// CODE: SPECIALMOVE CLIMB DOWN EVENT
|
||||||
// Move two C directions
|
// Move two C directions
|
||||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] );
|
||||||
|
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
// Adjust height
|
// Adjust height
|
||||||
SetSoldierHeight( pSoldier, (FLOAT)gClimbDownRoofStartDist[ pSoldier->ubBodyType ] );
|
SetSoldierHeight( pSoldier, (FLOAT)gClimbDownRoofStartDist[ pSoldier->ubBodyType ] );
|
||||||
// Adjust position
|
// Adjust position
|
||||||
@@ -479,14 +479,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 437:
|
case 437:
|
||||||
|
|
||||||
// CHANGE DIRECTION AND GET-UP
|
// CHANGE DIRECTION AND GET-UP
|
||||||
//sGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->bDirection ) ) );
|
//sGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
//ConvertMapPosToWorldTileCenter( pSoldier->sGridNo, &sXPos, &sYPos );
|
//ConvertMapPosToWorldTileCenter( pSoldier->sGridNo, &sXPos, &sYPos );
|
||||||
//SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
//SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
||||||
|
|
||||||
|
|
||||||
// Reverse direction
|
// Reverse direction
|
||||||
EVENT_SetSoldierDirection( pSoldier, gOppositeDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gOppositeDirection[ pSoldier->ubDirection ] );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
ChangeSoldierState( pSoldier, GETUP_FROM_ROLLOVER, 0 , FALSE );
|
ChangeSoldierState( pSoldier, GETUP_FROM_ROLLOVER, 0 , FALSE );
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
@@ -558,7 +558,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
UINT16 usNewGridNo;
|
UINT16 usNewGridNo;
|
||||||
INT16 sXPos, sYPos;
|
INT16 sXPos, sYPos;
|
||||||
|
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->bDirection ) );
|
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||||
ConvertGridNoToCenterCellXY( usNewGridNo, &sXPos, &sYPos );
|
ConvertGridNoToCenterCellXY( usNewGridNo, &sXPos, &sYPos );
|
||||||
LightSpritePosition( pSoldier->iMuzFlash, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
|
LightSpritePosition( pSoldier->iMuzFlash, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 443:
|
case 443:
|
||||||
|
|
||||||
// MOVE GUY FORWARD FOR FENCE HOP ANIMATION
|
// MOVE GUY FORWARD FOR FENCE HOP ANIMATION
|
||||||
switch( pSoldier->bDirection )
|
switch( pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
case EAST:
|
case EAST:
|
||||||
@@ -606,9 +606,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
sY = CenterY( pSoldier->sForcastGridno );
|
sY = CenterY( pSoldier->sForcastGridno );
|
||||||
|
|
||||||
EVENT_InternalSetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, FALSE, FALSE );
|
EVENT_InternalSetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, FALSE, FALSE );
|
||||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] );
|
||||||
pSoldier->sZLevelOverride = -1;
|
pSoldier->sZLevelOverride = -1;
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
|
|
||||||
if ( gTacticalStatus.bBoxingState == BOXING_WAITING_FOR_PLAYER || gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING )
|
if ( gTacticalStatus.bBoxingState == BOXING_WAITING_FOR_PLAYER || gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING )
|
||||||
@@ -618,7 +618,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
if ( SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ))
|
if ( SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ))
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 445:
|
case 445:
|
||||||
|
|
||||||
// CODE: MOVE GUY FORWARD ONE TILE, BASED ON WHERE WE ARE FACING
|
// CODE: MOVE GUY FORWARD ONE TILE, BASED ON WHERE WE ARE FACING
|
||||||
switch( pSoldier->bDirection )
|
switch( pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
case EAST:
|
case EAST:
|
||||||
@@ -684,14 +684,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
// TRY FORWARDS...
|
// TRY FORWARDS...
|
||||||
// FIRST GRIDNO
|
// FIRST GRIDNO
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->bDirection, FALLFORWARD_HITDEATH_STOP ) )
|
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||||
{
|
{
|
||||||
// SECOND GRIDNO
|
// SECOND GRIDNO
|
||||||
// sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
// sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
// if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->bDirection, FALLFORWARD_HITDEATH_STOP ) )
|
// if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||||
{
|
{
|
||||||
// ALL'S OK HERE...
|
// ALL'S OK HERE...
|
||||||
pSoldier->fTryingToFall = FALSE;
|
pSoldier->fTryingToFall = FALSE;
|
||||||
@@ -704,17 +704,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
// ATE: Added Feb1 - can be either direction....
|
// ATE: Added Feb1 - can be either direction....
|
||||||
if ( pSoldier->fFallClockwise )
|
if ( pSoldier->fFallClockwise )
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDirection( pSoldier, gOneCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gOneCDirection[ pSoldier->ubDirection ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDirection( pSoldier, gOneCCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gOneCCDirection[ pSoldier->ubDirection ] );
|
||||||
}
|
}
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
sLastAniFrame = gusAnimInst[ pSoldier->usAnimState ][ ( pSoldier->usAniCode - 2 ) ];
|
sLastAniFrame = gusAnimInst[ pSoldier->usAnimState ][ ( pSoldier->usAniCode - 2 ) ];
|
||||||
ConvertAniCodeToAniFrame( pSoldier, (INT16)( sLastAniFrame ) );
|
ConvertAniCodeToAniFrame( pSoldier, (INT16)( sLastAniFrame ) );
|
||||||
|
|
||||||
if ( pSoldier->bDirection == pSoldier->bStartFallDir )
|
if ( pSoldier->ubDirection == pSoldier->bStartFallDir )
|
||||||
{
|
{
|
||||||
// GO FORWARD HERE...
|
// GO FORWARD HERE...
|
||||||
pSoldier ->fTryingToFall = FALSE;
|
pSoldier ->fTryingToFall = FALSE;
|
||||||
@@ -852,7 +852,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDirection( pSoldier, (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ) );
|
EVENT_SetSoldierDirection( pSoldier, (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ) );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -869,8 +869,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
//CODE: BEGINHOPFENCE
|
//CODE: BEGINHOPFENCE
|
||||||
// MOVE TWO FACGIN GRIDNOS
|
// MOVE TWO FACGIN GRIDNOS
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
pSoldier->sForcastGridno = sNewGridNo;
|
pSoldier->sForcastGridno = sNewGridNo;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -878,7 +878,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 451:
|
case 451:
|
||||||
|
|
||||||
// CODE: MANAGE START z-buffer override
|
// CODE: MANAGE START z-buffer override
|
||||||
switch( pSoldier->bDirection )
|
switch( pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
case WEST:
|
case WEST:
|
||||||
@@ -891,7 +891,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
case 452:
|
case 452:
|
||||||
|
|
||||||
// CODE: MANAGE END z-buffer override
|
// CODE: MANAGE END z-buffer override
|
||||||
switch( pSoldier->bDirection )
|
switch( pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
case EAST:
|
case EAST:
|
||||||
@@ -919,7 +919,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
// CODE: HANDLE CLIMBING ROOF,
|
// CODE: HANDLE CLIMBING ROOF,
|
||||||
// Move merc up
|
// Move merc up
|
||||||
if ( pSoldier->bDirection == NORTH )
|
if ( pSoldier->ubDirection == NORTH )
|
||||||
{
|
{
|
||||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
||||||
}
|
}
|
||||||
@@ -943,7 +943,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
// CODE: HANDLE CLIMBING ROOF,
|
// CODE: HANDLE CLIMBING ROOF,
|
||||||
// Move merc DOWN
|
// Move merc DOWN
|
||||||
if ( pSoldier->bDirection == NORTH )
|
if ( pSoldier->ubDirection == NORTH )
|
||||||
{
|
{
|
||||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
||||||
}
|
}
|
||||||
@@ -1040,7 +1040,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
INT16 sTempGridNo, sNewX, sNewY;
|
INT16 sTempGridNo, sNewX, sNewY;
|
||||||
|
|
||||||
//Get Next GridNo;
|
//Get Next GridNo;
|
||||||
sTempGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->bDirection ) ) );
|
sTempGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
// Get center XY
|
// Get center XY
|
||||||
ConvertGridNoToCenterCellXY( sTempGridNo, &sNewX, &sNewY );
|
ConvertGridNoToCenterCellXY( sTempGridNo, &sNewX, &sNewY );
|
||||||
@@ -1049,8 +1049,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
EVENT_SetSoldierPosition( pSoldier, sNewX, sNewY );
|
EVENT_SetSoldierPosition( pSoldier, sNewX, sNewY );
|
||||||
|
|
||||||
// Move two CC directions
|
// Move two CC directions
|
||||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->bDirection ] );
|
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
// Set desired anim height!
|
// Set desired anim height!
|
||||||
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
||||||
@@ -1112,7 +1112,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
///CODE: FOR HELIDROP, SET DIRECTION
|
///CODE: FOR HELIDROP, SET DIRECTION
|
||||||
EVENT_SetSoldierDirection( pSoldier, EAST );
|
EVENT_SetSoldierDirection( pSoldier, EAST );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
gfIngagedInDrop = FALSE;
|
gfIngagedInDrop = FALSE;
|
||||||
|
|
||||||
@@ -1267,7 +1267,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
if ( pSoldier->bLife >= OKLIFE )
|
if ( pSoldier->bLife >= OKLIFE )
|
||||||
{
|
{
|
||||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->bDirection, FALSE );
|
InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, FALSE );
|
||||||
}
|
}
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
@@ -1359,7 +1359,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 && pSoldier->bLevel == 0 )
|
if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 && pSoldier->bLevel == 0 )
|
||||||
{
|
{
|
||||||
// Save old direction
|
// Save old direction
|
||||||
pSoldier->uiPendingActionData1 = pSoldier->bDirection;
|
pSoldier->uiPendingActionData1 = pSoldier->ubDirection;
|
||||||
|
|
||||||
// If we got a head shot...more chance of turning...
|
// If we got a head shot...more chance of turning...
|
||||||
if ( pSoldier->ubHitLocation != AIM_SHOT_HEAD )
|
if ( pSoldier->ubHitLocation != AIM_SHOT_HEAD )
|
||||||
@@ -1369,21 +1369,21 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
// 30 % chance to change direction one way
|
// 30 % chance to change direction one way
|
||||||
if ( uiChance < 30 )
|
if ( uiChance < 30 )
|
||||||
{
|
{
|
||||||
bNewDirection = gOneCDirection[ pSoldier->bDirection ];
|
bNewDirection = gOneCDirection[ pSoldier->ubDirection ];
|
||||||
}
|
}
|
||||||
// 30 % chance to change direction the other way
|
// 30 % chance to change direction the other way
|
||||||
else if ( uiChance >= 30 && uiChance < 60 )
|
else if ( uiChance >= 30 && uiChance < 60 )
|
||||||
{
|
{
|
||||||
bNewDirection = gOneCCDirection[ pSoldier->bDirection ];
|
bNewDirection = gOneCCDirection[ pSoldier->ubDirection ];
|
||||||
}
|
}
|
||||||
// 30 % normal....
|
// 30 % normal....
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bNewDirection = pSoldier->bDirection;
|
bNewDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_SetSoldierDirection( pSoldier, bNewDirection );
|
EVENT_SetSoldierDirection( pSoldier, bNewDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1402,13 +1402,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
// Pick evenly between both
|
// Pick evenly between both
|
||||||
if ( Random( 50 ) < 25 )
|
if ( Random( 50 ) < 25 )
|
||||||
{
|
{
|
||||||
bNewDirection = gOneCDirection[ pSoldier->bDirection ];
|
bNewDirection = gOneCDirection[ pSoldier->ubDirection ];
|
||||||
bNewDirection = gOneCDirection[ bNewDirection ];
|
bNewDirection = gOneCDirection[ bNewDirection ];
|
||||||
bNewDirection = gOneCDirection[ bNewDirection ];
|
bNewDirection = gOneCDirection[ bNewDirection ];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bNewDirection = gOneCCDirection[ pSoldier->bDirection ];
|
bNewDirection = gOneCCDirection[ pSoldier->ubDirection ];
|
||||||
bNewDirection = gOneCCDirection[ bNewDirection ];
|
bNewDirection = gOneCCDirection[ bNewDirection ];
|
||||||
bNewDirection = gOneCCDirection[ bNewDirection ];
|
bNewDirection = gOneCCDirection[ bNewDirection ];
|
||||||
}
|
}
|
||||||
@@ -1431,7 +1431,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
//{
|
//{
|
||||||
/// if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
/// if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
||||||
// {
|
// {
|
||||||
/// pSoldier->bDirection = (INT8)pSoldier->uiPendingActionData1;
|
/// pSoldier->ubDirection = (INT8)pSoldier->uiPendingActionData1;
|
||||||
// pSoldier->bDesiredDirection = (INT8)pSoldier->uiPendingActionData1;
|
// pSoldier->bDesiredDirection = (INT8)pSoldier->uiPendingActionData1;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
@@ -1715,7 +1715,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
if ( gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
if ( gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
||||||
{
|
{
|
||||||
// OK, stop merc....
|
// OK, stop merc....
|
||||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||||
|
|
||||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||||
{
|
{
|
||||||
@@ -2620,7 +2620,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Dish out damage!
|
// Dish out damage!
|
||||||
EVENT_SoldierGotHit( MercPtrs[ pSoldier->uiPendingActionData4 ], TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->bDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 );
|
EVENT_SoldierGotHit( MercPtrs[ pSoldier->uiPendingActionData4 ], TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->ubDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2671,7 +2671,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
|||||||
InternalDropBlood( pSoldier->sGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
InternalDropBlood( pSoldier->sGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
||||||
|
|
||||||
// Move forward one gridno....
|
// Move forward one gridno....
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->bDirection ] ) ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ) );
|
||||||
|
|
||||||
InternalDropBlood( sNewGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
InternalDropBlood( sNewGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
||||||
|
|
||||||
@@ -3503,7 +3503,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
|
|||||||
// Randomly fall back or forward, if we are in the standing hit animation
|
// Randomly fall back or forward, if we are in the standing hit animation
|
||||||
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == STANDING_BURST_HIT || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == STANDING_BURST_HIT || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
||||||
{
|
{
|
||||||
INT8 bTestDirection = pSoldier->bDirection;
|
INT8 bTestDirection = pSoldier->ubDirection;
|
||||||
BOOLEAN fForceDirection = FALSE;
|
BOOLEAN fForceDirection = FALSE;
|
||||||
BOOLEAN fDoFallback = FALSE;
|
BOOLEAN fDoFallback = FALSE;
|
||||||
|
|
||||||
@@ -3561,7 +3561,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
|
|||||||
EVENT_SetSoldierDesiredDirection( pSoldier, bTestDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, bTestDirection );
|
||||||
EVENT_SetSoldierDirection( pSoldier, bTestDirection );
|
EVENT_SetSoldierDirection( pSoldier, bTestDirection );
|
||||||
}
|
}
|
||||||
ChangeToFallbackAnimation( pSoldier, pSoldier->bDirection );
|
ChangeToFallbackAnimation( pSoldier, pSoldier->ubDirection );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3749,7 +3749,7 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier )
|
|||||||
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN )
|
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN )
|
||||||
{
|
{
|
||||||
// OK, put gun down....
|
// OK, put gun down....
|
||||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->bDirection, TRUE );
|
InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, TRUE );
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3846,7 +3846,7 @@ if ( pSoldier->bLife >= OKLIFE )
|
|||||||
// Randomly fall back or forward, if we are in the standing hit animation
|
// Randomly fall back or forward, if we are in the standing hit animation
|
||||||
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
||||||
{
|
{
|
||||||
INT8 bTestDirection = pSoldier->bDirection;
|
INT8 bTestDirection = pSoldier->ubDirection;
|
||||||
BOOLEAN fForceDirection = FALSE;
|
BOOLEAN fForceDirection = FALSE;
|
||||||
BOOLEAN fDoFallback = FALSE;
|
BOOLEAN fDoFallback = FALSE;
|
||||||
|
|
||||||
@@ -3882,20 +3882,22 @@ if ( pSoldier->bLife >= OKLIFE )
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8 bTestDirection, UINT16 usAnimState )
|
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState )
|
||||||
{
|
{
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"OKFallDirection");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"OKFallDirection");
|
||||||
STRUCTURE_FILE_REF * pStructureFileRef;
|
STRUCTURE_FILE_REF * pStructureFileRef;
|
||||||
UINT16 usAnimSurface;
|
UINT16 usAnimSurface;
|
||||||
|
UINT8 bOverTerrainType;
|
||||||
|
|
||||||
// How are the movement costs?
|
// How are the movement costs?
|
||||||
if ( gubWorldMovementCosts[ sGridNo ][ bTestDirection ][ bLevel ] > TRAVELCOST_SHORE )
|
if ( gubWorldMovementCosts[ sGridNo ][ ubTestDirection ][ bLevel ] > TRAVELCOST_SHORE )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bOverTerrainType = GetTerrainType( sGridNo);
|
||||||
//NOT ok if in water....
|
//NOT ok if in water....
|
||||||
if ( GetTerrainType( sGridNo ) == MED_WATER || GetTerrainType( sGridNo ) == DEEP_WATER || GetTerrainType( sGridNo ) == LOW_WATER )
|
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -3922,9 +3924,9 @@ BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8
|
|||||||
// work now. The function is passing in an adjacent gridno but we need to place the structure
|
// work now. The function is passing in an adjacent gridno but we need to place the structure
|
||||||
// data in the tile BEFORE. So we take one step back in the direction opposite to bTestDirection
|
// data in the tile BEFORE. So we take one step back in the direction opposite to bTestDirection
|
||||||
// and use that gridno
|
// and use that gridno
|
||||||
sTestGridNo = NewGridNo( sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ bTestDirection ] ) ) );
|
sTestGridNo = NewGridNo( sGridNo, DirectionInc( gOppositeDirection[ ubTestDirection ] ) );
|
||||||
|
|
||||||
if ( ! OkayToAddStructureToWorld( sTestGridNo, bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bTestDirection ] ]), usStructureID ) )
|
if ( ! OkayToAddStructureToWorld( sTestGridNo, bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ ubTestDirection ] ]), usStructureID ) )
|
||||||
{
|
{
|
||||||
// can't go in that dir!
|
// can't go in that dir!
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -4071,7 +4073,7 @@ void KickOutWheelchair( SOLDIERTYPE *pSoldier )
|
|||||||
INT16 sNewGridNo;
|
INT16 sNewGridNo;
|
||||||
|
|
||||||
// Move forward one gridno....
|
// Move forward one gridno....
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
// ATE: Make sure that the gridno is unoccupied!
|
// ATE: Make sure that the gridno is unoccupied!
|
||||||
if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->bLevel ) )
|
if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->bLevel ) )
|
||||||
@@ -4080,7 +4082,7 @@ void KickOutWheelchair( SOLDIERTYPE *pSoldier )
|
|||||||
sNewGridNo = pSoldier->sGridNo;
|
sNewGridNo = pSoldier->sGridNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, sNewGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, sNewGridNo, pSoldier->ubDirection );
|
||||||
pSoldier->ubBodyType = REGMALE;
|
pSoldier->ubBodyType = REGMALE;
|
||||||
if ( pSoldier->ubProfile == SLAY && pSoldier->bTeam == CIV_TEAM && !pSoldier->bNeutral )
|
if ( pSoldier->ubProfile == SLAY && pSoldier->bTeam == CIV_TEAM && !pSoldier->bNeutral )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ BOOLEAN CheckForAndHandleSoldierDyingNotFromHit( SOLDIERTYPE *pSoldier );
|
|||||||
|
|
||||||
BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse );
|
BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse );
|
||||||
|
|
||||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8 bTestDirection, UINT16 usAnimState );
|
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState );
|
||||||
|
|
||||||
BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier );
|
BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
|
|||||||
+190
-107
@@ -839,7 +839,7 @@ UINT16 *CreateEnemyGreyGlow16BPPPalette( SGPPaletteEntry *pPalette, UINT32 rscal
|
|||||||
void SoldierBleed( SOLDIERTYPE *pSoldier, BOOLEAN fBandagedBleed );
|
void SoldierBleed( SOLDIERTYPE *pSoldier, BOOLEAN fBandagedBleed );
|
||||||
INT32 CheckBleeding( SOLDIERTYPE *pSoldier );
|
INT32 CheckBleeding( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
||||||
|
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
extern void ValidatePlayersAreInOneGroupOnly();
|
extern void ValidatePlayersAreInOneGroupOnly();
|
||||||
@@ -961,7 +961,7 @@ void HandleCrowShadowNewGridNo( SOLDIERTYPE *pSoldier )
|
|||||||
AniParams.sZ = 0;
|
AniParams.sZ = 0;
|
||||||
strcpy( AniParams.zCachedFile, "TILECACHE\\FLY_SHDW.STI" );
|
strcpy( AniParams.zCachedFile, "TILECACHE\\FLY_SHDW.STI" );
|
||||||
|
|
||||||
AniParams.uiUserData3 = pSoldier->bDirection;
|
AniParams.uiUserData3 = pSoldier->ubDirection;
|
||||||
|
|
||||||
pSoldier->pAniTile = CreateAnimationTile( &AniParams );
|
pSoldier->pAniTile = CreateAnimationTile( &AniParams );
|
||||||
|
|
||||||
@@ -996,7 +996,7 @@ void HandleCrowShadowNewDirection( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
if ( pSoldier->pAniTile != NULL )
|
if ( pSoldier->pAniTile != NULL )
|
||||||
{
|
{
|
||||||
pSoldier->pAniTile->uiUserData3 = pSoldier->bDirection;
|
pSoldier->pAniTile->uiUserData3 = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2181,7 +2181,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
if ( usNewState == WALKING || usNewState == RUNNING || usNewState == SWATTING )
|
if ( usNewState == WALKING || usNewState == RUNNING || usNewState == SWATTING )
|
||||||
{
|
{
|
||||||
// CHECK FOR SIDEWAYS!
|
// CHECK FOR SIDEWAYS!
|
||||||
if ( pSoldier->bDirection == gPurpendicularDirection[ pSoldier->bDirection ][ pSoldier->usPathingData[ pSoldier->usPathIndex ] ] )
|
if ( pSoldier->ubDirection == gPurpendicularDirection[ pSoldier->ubDirection ][ pSoldier->usPathingData[ pSoldier->usPathIndex ] ] )
|
||||||
{
|
{
|
||||||
// We are perpendicular!
|
// We are perpendicular!
|
||||||
usNewState = SIDE_STEP;
|
usNewState = SIDE_STEP;
|
||||||
@@ -2220,7 +2220,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we are in water.....and trying to run, change to run
|
// If we are in water.....and trying to run, change to run
|
||||||
if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
if ( MercInWater( pSoldier) )
|
||||||
{
|
{
|
||||||
// Check animation
|
// Check animation
|
||||||
// Change to walking
|
// Change to walking
|
||||||
@@ -2638,14 +2638,14 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
|
|
||||||
DeductPoints( pSoldier, AP_JUMP_OVER, BP_JUMP_OVER );
|
DeductPoints( pSoldier, AP_JUMP_OVER, BP_JUMP_OVER );
|
||||||
|
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->bDirection ) );
|
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->bDirection ) );
|
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||||
|
|
||||||
pSoldier->usPathDataSize = 0;
|
pSoldier->usPathDataSize = 0;
|
||||||
pSoldier->usPathIndex = 0;
|
pSoldier->usPathIndex = 0;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->bDirection;
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
||||||
pSoldier->usPathDataSize++;
|
pSoldier->usPathDataSize++;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->bDirection;
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
||||||
pSoldier->usPathDataSize++;
|
pSoldier->usPathDataSize++;
|
||||||
pSoldier->sFinalDestination = usNewGridNo;
|
pSoldier->sFinalDestination = usNewGridNo;
|
||||||
// Set direction
|
// Set direction
|
||||||
@@ -3243,7 +3243,7 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
|||||||
|
|
||||||
|
|
||||||
// OK, If we were not in deep water but we are now, handle deep animations!
|
// OK, If we were not in deep water but we are now, handle deep animations!
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER && pSoldier->bOldOverTerrainType != DEEP_WATER )
|
if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && !TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) )
|
||||||
{
|
{
|
||||||
// Based on our current animation, change!
|
// Based on our current animation, change!
|
||||||
switch( pSoldier->usAnimState )
|
switch( pSoldier->usAnimState )
|
||||||
@@ -3263,13 +3263,13 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Damage water if in deep water....
|
// Damage water if in deep water....
|
||||||
if ( pSoldier->bOverTerrainType == MED_WATER || pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInHighWater( pSoldier) )
|
||||||
{
|
{
|
||||||
WaterDamage( pSoldier );
|
WaterDamage( pSoldier );
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK, If we were in deep water but we are NOT now, handle mid animations!
|
// OK, If we were in deep water but we are NOT now, handle mid animations!
|
||||||
if ( pSoldier->bOverTerrainType != DEEP_WATER && pSoldier->bOldOverTerrainType == DEEP_WATER )
|
if ( !TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) )
|
||||||
{
|
{
|
||||||
// Make transition from low to deep
|
// Make transition from low to deep
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_TO_LOW_WATER, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, DEEP_TO_LOW_WATER, 0 , FALSE );
|
||||||
@@ -3791,7 +3791,7 @@ void SelectFallAnimation( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier )
|
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
return( InternalSoldierReadyWeapon( pSoldier, (INT8)pSoldier->bDirection, FALSE ) );
|
return( InternalSoldierReadyWeapon( pSoldier, (INT8)pSoldier->ubDirection, FALSE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady )
|
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady )
|
||||||
@@ -3839,7 +3839,7 @@ BOOLEAN InternalSoldierReadyWeapon( SOLDIERTYPE *pSoldier, UINT8 sFacingDir, BOO
|
|||||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, sFacingDir, FALSE, usAnimState );
|
EVENT_InternalSetSoldierDesiredDirection( pSoldier, sFacingDir, FALSE, usAnimState );
|
||||||
|
|
||||||
// Check if facing dir is different from ours and change direction if so!
|
// Check if facing dir is different from ours and change direction if so!
|
||||||
//if ( sFacingDir != pSoldier->bDirection )
|
//if ( sFacingDir != pSoldier->ubDirection )
|
||||||
//{
|
//{
|
||||||
// DeductPoints( pSoldier, AP_CHANGE_FACING, 0 );
|
// DeductPoints( pSoldier, AP_CHANGE_FACING, 0 );
|
||||||
//}//
|
//}//
|
||||||
@@ -3859,7 +3859,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady )
|
|||||||
return( INVALID_ANIMATION );
|
return( INVALID_ANIMATION );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
return( INVALID_ANIMATION );
|
return( INVALID_ANIMATION );
|
||||||
}
|
}
|
||||||
@@ -4490,12 +4490,12 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If here, we are a merc, check if we are in water
|
// If here, we are a merc, check if we are in water
|
||||||
if ( pSoldier->bOverTerrainType == LOW_WATER )
|
if ( MercInShallowWater( pSoldier) )
|
||||||
{
|
{
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, WATER_HIT, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, WATER_HIT, 0 , FALSE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_HIT, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_HIT, 0 , FALSE );
|
||||||
return;
|
return;
|
||||||
@@ -4573,7 +4573,7 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection )
|
|||||||
{
|
{
|
||||||
//SetSoldierDesiredDirection( pSoldier, bDirection );
|
//SetSoldierDesiredDirection( pSoldier, bDirection );
|
||||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, STANDING_BURST_HIT, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, STANDING_BURST_HIT, 0 , FALSE );
|
||||||
}
|
}
|
||||||
@@ -4623,14 +4623,14 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD
|
|||||||
{
|
{
|
||||||
if (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && usWeaponIndex == BARRETT ))
|
if (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && usWeaponIndex == BARRETT ))
|
||||||
{
|
{
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->bDirection ) ) );
|
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
// CHECK OK DESTINATION!
|
// CHECK OK DESTINATION!
|
||||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->bDirection, JFK_HITDEATH ) )
|
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, JFK_HITDEATH ) )
|
||||||
{
|
{
|
||||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (INT8)( DirectionInc( pSoldier->bDirection ) ) );
|
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||||
|
|
||||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||||
{
|
{
|
||||||
fHeadHit = TRUE;
|
fHeadHit = TRUE;
|
||||||
}
|
}
|
||||||
@@ -4646,9 +4646,9 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD
|
|||||||
{
|
{
|
||||||
|
|
||||||
// possibly play torso explosion anim!
|
// possibly play torso explosion anim!
|
||||||
if (pSoldier->bDirection == bDirection)
|
if (pSoldier->ubDirection == bDirection)
|
||||||
{
|
{
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->bDirection ] ) );
|
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) );
|
||||||
|
|
||||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
||||||
{
|
{
|
||||||
@@ -4824,7 +4824,7 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16
|
|||||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
||||||
{
|
{
|
||||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
ChangeToFallbackAnimation( pSoldier, (INT8)bDirection );
|
ChangeToFallbackAnimation( pSoldier, (INT8)bDirection );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -4855,7 +4855,7 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||||
|
|
||||||
// Check behind us!
|
// Check behind us!
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||||
@@ -5067,7 +5067,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid
|
|||||||
|
|
||||||
usMoveAnimState = pSoldier->usUIMovementMode;
|
usMoveAnimState = pSoldier->usUIMovementMode;
|
||||||
|
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
usMoveAnimState = DEEP_WATER_SWIM;
|
usMoveAnimState = DEEP_WATER_SWIM;
|
||||||
}
|
}
|
||||||
@@ -5120,7 +5120,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid
|
|||||||
|
|
||||||
// If true, we're OK, if not, WAIT for a guy to pass!
|
// If true, we're OK, if not, WAIT for a guy to pass!
|
||||||
// If we are in deep water, we can only swim!
|
// If we are in deep water, we can only swim!
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
usMoveAnimState = DEEP_WATER_SWIM;
|
usMoveAnimState = DEEP_WATER_SWIM;
|
||||||
}
|
}
|
||||||
@@ -5168,7 +5168,7 @@ void StopSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) )
|
if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) )
|
||||||
{
|
{
|
||||||
//SoldierGotoStationaryStance( pSoldier );
|
//SoldierGotoStationaryStance( pSoldier );
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set desination
|
// Set desination
|
||||||
@@ -5196,7 +5196,7 @@ void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we are in deep water!
|
// Check if we are in deep water!
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
// IN deep water, tred!
|
// IN deep water, tred!
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_TRED, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_TRED, 0 , FALSE );
|
||||||
@@ -5258,6 +5258,12 @@ void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!IsValidStance( pSoldier, ubDesiredStance))
|
||||||
|
{
|
||||||
|
AssertMsg( 0, "Attempted to set soldier to an invalid stance.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set UI Busy
|
// Set UI Busy
|
||||||
SetUIBusy( pSoldier->ubID );
|
SetUIBusy( pSoldier->ubID );
|
||||||
|
|
||||||
@@ -5285,22 +5291,22 @@ void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState )
|
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState )
|
||||||
{
|
{
|
||||||
UINT16 usNewGridNo;
|
INT16 sNewGridNo;
|
||||||
INT16 sXPos, sYPos;
|
INT16 sXPos, sYPos;
|
||||||
|
|
||||||
// Get dest gridno, convert to center coords
|
// Get dest gridno, convert to center coords
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( usNewDirection ) );
|
sNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( ubNewDirection ) );
|
||||||
|
|
||||||
ConvertMapPosToWorldTileCenter( usNewGridNo, &sXPos, &sYPos );
|
ConvertMapPosToWorldTileCenter( sNewGridNo, &sXPos, &sYPos );
|
||||||
|
|
||||||
// Save new dest gridno, x, y
|
// Save new dest gridno, x, y
|
||||||
pSoldier->sDestination = usNewGridNo;
|
pSoldier->sDestination = sNewGridNo;
|
||||||
pSoldier->sDestXPos = sXPos;
|
pSoldier->sDestXPos = sXPos;
|
||||||
pSoldier->sDestYPos = sYPos;
|
pSoldier->sDestYPos = sYPos;
|
||||||
|
|
||||||
pSoldier->bMovementDirection = (INT8)usNewDirection;
|
pSoldier->bMovementDirection = (INT8)ubNewDirection;
|
||||||
|
|
||||||
|
|
||||||
// OK, ATE: If we are side_stepping, calculate a NEW desired direction....
|
// OK, ATE: If we are side_stepping, calculate a NEW desired direction....
|
||||||
@@ -5309,17 +5315,17 @@ void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDir
|
|||||||
UINT8 ubPerpDirection;
|
UINT8 ubPerpDirection;
|
||||||
|
|
||||||
// Get a new desired direction,
|
// Get a new desired direction,
|
||||||
ubPerpDirection = gPurpendicularDirection[ pSoldier->bDirection ][ usNewDirection ];
|
ubPerpDirection = gPurpendicularDirection[ pSoldier->ubDirection ][ ubNewDirection ];
|
||||||
|
|
||||||
// CHange actual and desired direction....
|
// CHange actual and desired direction....
|
||||||
EVENT_SetSoldierDirection( pSoldier, ubPerpDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubPerpDirection );
|
||||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !( gAnimControl[ usAnimState ].uiFlags & ANIM_SPECIALMOVE ) )
|
if ( !( gAnimControl[ usAnimState ].uiFlags & ANIM_SPECIALMOVE ) )
|
||||||
{
|
{
|
||||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, usNewDirection, fFromMove, usAnimState );
|
EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, fFromMove, usAnimState );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5409,17 +5415,17 @@ INT8 MultiTiledTurnDirection( SOLDIERTYPE * pSoldier, INT8 bStartDirection, INT8
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState )
|
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState )
|
||||||
{
|
{
|
||||||
//if ( usAnimState == WALK_BACKWARDS )
|
//if ( usAnimState == WALK_BACKWARDS )
|
||||||
if ( pSoldier->bReverse && usAnimState != SIDE_STEP )
|
if ( pSoldier->bReverse && usAnimState != SIDE_STEP )
|
||||||
{
|
{
|
||||||
// OK, check if we are going to go in the exact opposite than our facing....
|
// OK, check if we are going to go in the exact opposite than our facing....
|
||||||
usNewDirection = gOppositeDirection[ usNewDirection ];
|
ubNewDirection = gOppositeDirection[ ubNewDirection ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pSoldier->bDesiredDirection = (INT8)usNewDirection;
|
pSoldier->bDesiredDirection = (INT8)ubNewDirection;
|
||||||
|
|
||||||
// If we are prone, goto crouched first!
|
// If we are prone, goto crouched first!
|
||||||
// ONly if we are stationary, and only if directions are differnet!
|
// ONly if we are stationary, and only if directions are differnet!
|
||||||
@@ -5434,7 +5440,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
|||||||
AdjustNoAPToFinishMove( pSoldier, FALSE );
|
AdjustNoAPToFinishMove( pSoldier, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pSoldier->bDesiredDirection != pSoldier->bDirection )
|
if ( pSoldier->bDesiredDirection != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->fDontChargeTurningAPs )
|
if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->fDontChargeTurningAPs )
|
||||||
{
|
{
|
||||||
@@ -5492,7 +5498,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
|||||||
// Set desired direction for the extended directions...
|
// Set desired direction for the extended directions...
|
||||||
pSoldier->ubHiResDesiredDirection = ubExtDirection[ pSoldier->bDesiredDirection ];
|
pSoldier->ubHiResDesiredDirection = ubExtDirection[ pSoldier->bDesiredDirection ];
|
||||||
|
|
||||||
if ( pSoldier->bDesiredDirection != pSoldier->bDirection )
|
if ( pSoldier->bDesiredDirection != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
if ( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) )
|
if ( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) )
|
||||||
{
|
{
|
||||||
@@ -5509,20 +5515,20 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
|||||||
{
|
{
|
||||||
if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
||||||
{
|
{
|
||||||
pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->bDirection, pSoldier->bDesiredDirection );
|
pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->bDirection, pSoldier->bDesiredDirection );
|
pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection )
|
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection )
|
||||||
{
|
{
|
||||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, usNewDirection, FALSE, pSoldier->usAnimState );
|
EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, FALSE, pSoldier->usAnimState );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5531,10 +5537,10 @@ void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection )
|
|||||||
// Remove old location data
|
// Remove old location data
|
||||||
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE );
|
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE );
|
||||||
|
|
||||||
pSoldier->bDirection = (INT8)usNewDirection;
|
pSoldier->ubDirection = (INT8)usNewDirection;
|
||||||
|
|
||||||
// Updated extended direction.....
|
// Updated extended direction.....
|
||||||
pSoldier->ubHiResDirection = ubExtDirection[ pSoldier->bDirection ];
|
pSoldier->ubHiResDirection = ubExtDirection[ pSoldier->ubDirection ];
|
||||||
|
|
||||||
// Add new stuff
|
// Add new stuff
|
||||||
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, FALSE );
|
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, FALSE );
|
||||||
@@ -5809,7 +5815,7 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame )
|
|||||||
CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE );
|
CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE );
|
||||||
|
|
||||||
// COnvert world direction into sprite direction
|
// COnvert world direction into sprite direction
|
||||||
ubTempDir = gOneCDirection[ pSoldier->bDirection ];
|
ubTempDir = gOneCDirection[ pSoldier->ubDirection ];
|
||||||
|
|
||||||
//If we are only one frame, ignore what the script is telling us!
|
//If we are only one frame, ignore what the script is telling us!
|
||||||
if ( gAnimSurfaceDatabase[ usAnimSurface ].ubFlags & ANIM_DATA_FLAG_NOFRAMES )
|
if ( gAnimSurfaceDatabase[ usAnimSurface ].ubFlags & ANIM_DATA_FLAG_NOFRAMES )
|
||||||
@@ -5834,22 +5840,22 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame )
|
|||||||
// Check # of directions /surface, adjust if ness.
|
// Check # of directions /surface, adjust if ness.
|
||||||
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 3 )
|
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 3 )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection == NORTHWEST )
|
if ( pSoldier->ubDirection == NORTHWEST )
|
||||||
{
|
{
|
||||||
ubTempDir = 1;
|
ubTempDir = 1;
|
||||||
}
|
}
|
||||||
if ( pSoldier->bDirection == WEST )
|
if ( pSoldier->ubDirection == WEST )
|
||||||
{
|
{
|
||||||
ubTempDir = 0;
|
ubTempDir = 0;
|
||||||
}
|
}
|
||||||
if ( pSoldier->bDirection == EAST )
|
if ( pSoldier->ubDirection == EAST )
|
||||||
{
|
{
|
||||||
ubTempDir = 2;
|
ubTempDir = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 2 )
|
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 2 )
|
||||||
{
|
{
|
||||||
ubTempDir = gDirectionFrom8to2[ pSoldier->bDirection ];
|
ubTempDir = gDirectionFrom8to2[ pSoldier->ubDirection ];
|
||||||
}
|
}
|
||||||
|
|
||||||
pSoldier->usAniFrame = usAniFrame + (UINT16) ( ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir * ubTempDir ) );
|
pSoldier->usAniFrame = usAniFrame + (UINT16) ( ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir * ubTempDir ) );
|
||||||
@@ -5892,7 +5898,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
if ( pSoldier->bDesiredDirection > 7 || pSoldier->bDesiredDirection < 0)
|
if ( pSoldier->bDesiredDirection > 7 || pSoldier->bDesiredDirection < 0)
|
||||||
{
|
{
|
||||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("TurnSoldier() Warinig: Invalid desired direction for non-vehicle unit") );
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("TurnSoldier() Warinig: Invalid desired direction for non-vehicle unit") );
|
||||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Lesh: patch ended
|
// Lesh: patch ended
|
||||||
@@ -5914,7 +5920,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if ( pSoldier->fTurningToShoot )
|
if ( pSoldier->fTurningToShoot )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
if ( ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !pSoldier->fTurningFromPronePosition ) || pSoldier->ubBodyType == ROBOTNOWEAPON || pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
if ( ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !pSoldier->fTurningFromPronePosition ) || pSoldier->ubBodyType == ROBOTNOWEAPON || pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||||
{
|
{
|
||||||
@@ -5946,7 +5952,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if ( pSoldier->fTurningToFall )
|
if ( pSoldier->fTurningToFall )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
SelectFallAnimation( pSoldier );
|
SelectFallAnimation( pSoldier );
|
||||||
pSoldier->fTurningToFall = FALSE;
|
pSoldier->fTurningToFall = FALSE;
|
||||||
@@ -5955,7 +5961,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if ( pSoldier->fTurningUntilDone && ( pSoldier->ubPendingStanceChange != NO_PENDING_STANCE ) )
|
if ( pSoldier->fTurningUntilDone && ( pSoldier->ubPendingStanceChange != NO_PENDING_STANCE ) )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
SendChangeSoldierStanceEvent( pSoldier, pSoldier->ubPendingStanceChange );
|
SendChangeSoldierStanceEvent( pSoldier, pSoldier->ubPendingStanceChange );
|
||||||
pSoldier->ubPendingStanceChange = NO_PENDING_STANCE;
|
pSoldier->ubPendingStanceChange = NO_PENDING_STANCE;
|
||||||
@@ -5965,7 +5971,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if ( pSoldier->fTurningUntilDone && ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) )
|
if ( pSoldier->fTurningUntilDone && ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
UINT16 usPendingAnimation;
|
UINT16 usPendingAnimation;
|
||||||
|
|
||||||
@@ -5978,7 +5984,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't do anything if we are at dest direction!
|
// Don't do anything if we are at dest direction!
|
||||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||||
{
|
{
|
||||||
@@ -6124,8 +6130,8 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get new direction
|
// Get new direction
|
||||||
//sDirection = pSoldier->bDirection + QuickestDirection( pSoldier->bDirection, pSoldier->bDesiredDirection );
|
//sDirection = pSoldier->ubDirection + QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||||
sDirection = pSoldier->bDirection + pSoldier->bTurningIncrement;
|
sDirection = pSoldier->ubDirection + pSoldier->bTurningIncrement;
|
||||||
if (sDirection > 7)
|
if (sDirection > 7)
|
||||||
{
|
{
|
||||||
sDirection = 0;
|
sDirection = 0;
|
||||||
@@ -6180,7 +6186,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
|||||||
// If we are a creature, or multi-tiled, cancel AI action.....?
|
// If we are a creature, or multi-tiled, cancel AI action.....?
|
||||||
else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
||||||
{
|
{
|
||||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6972,7 +6978,7 @@ void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMo
|
|||||||
FLOAT dAngle = (FLOAT)0;
|
FLOAT dAngle = (FLOAT)0;
|
||||||
|
|
||||||
// Determine which direction we are in
|
// Determine which direction we are in
|
||||||
switch( pSoldier->bDirection )
|
switch( pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
dAngle = (FLOAT)( -1 * PI );
|
dAngle = (FLOAT)( -1 * PI );
|
||||||
@@ -7024,7 +7030,7 @@ void BeginSoldierClimbUpRoof( SOLDIERTYPE *pSoldier )
|
|||||||
UINT8 ubWhoIsThere;
|
UINT8 ubWhoIsThere;
|
||||||
|
|
||||||
|
|
||||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel == 0 ) )
|
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel == 0 ) )
|
||||||
{
|
{
|
||||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, FALSE ), 0, TRUE ) )
|
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, FALSE ), 0, TRUE ) )
|
||||||
{
|
{
|
||||||
@@ -7074,7 +7080,7 @@ void BeginSoldierClimbFence( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bDirection = pSoldier->bDirection;
|
bDirection = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, bDirection, &bDirection ) )
|
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, bDirection, &bDirection ) )
|
||||||
@@ -8215,7 +8221,7 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier )
|
|||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||||
{
|
{
|
||||||
// ONly if standing!
|
// ONly if standing!
|
||||||
if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
||||||
@@ -8237,11 +8243,11 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Are wee near enough to fall forwards....
|
// Are wee near enough to fall forwards....
|
||||||
if ( pSoldier->bDirection == gOneCDirection[ bNewDirection ] ||
|
if ( pSoldier->ubDirection == gOneCDirection[ bNewDirection ] ||
|
||||||
pSoldier->bDirection == gTwoCDirection[ bNewDirection ] ||
|
pSoldier->ubDirection == gTwoCDirection[ bNewDirection ] ||
|
||||||
pSoldier->bDirection == bNewDirection ||
|
pSoldier->ubDirection == bNewDirection ||
|
||||||
pSoldier->bDirection == gOneCCDirection[ bNewDirection ] ||
|
pSoldier->ubDirection == gOneCCDirection[ bNewDirection ] ||
|
||||||
pSoldier->bDirection == gTwoCCDirection[ bNewDirection ] )
|
pSoldier->ubDirection == gTwoCCDirection[ bNewDirection ] )
|
||||||
{
|
{
|
||||||
// Do backwards...
|
// Do backwards...
|
||||||
fDoForwards = FALSE;
|
fDoForwards = FALSE;
|
||||||
@@ -8290,7 +8296,7 @@ void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier )
|
|||||||
UINT8 ubWhoIsThere;
|
UINT8 ubWhoIsThere;
|
||||||
|
|
||||||
|
|
||||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||||
{
|
{
|
||||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
||||||
{
|
{
|
||||||
@@ -8334,7 +8340,7 @@ INT8 bNewDirection;
|
|||||||
UINT8 ubWhoIsThere;
|
UINT8 ubWhoIsThere;
|
||||||
|
|
||||||
|
|
||||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||||
{
|
{
|
||||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
||||||
{
|
{
|
||||||
@@ -8487,7 +8493,7 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier )
|
UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT16 sXPos, sYPos;
|
INT16 sXPos, sYPos;
|
||||||
|
|
||||||
@@ -8508,7 +8514,7 @@ INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier )
|
UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT16 sXPos2, sYPos2;
|
INT16 sXPos2, sYPos2;
|
||||||
|
|
||||||
@@ -8812,7 +8818,7 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier )
|
|||||||
// ATE: Mod: Only fastturn for OUR guys!
|
// ATE: Mod: Only fastturn for OUR guys!
|
||||||
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FASTTURN && pSoldier->bTeam == gbPlayerNum && !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FASTTURN && pSoldier->bTeam == gbPlayerNum && !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection != pSoldier->bDesiredDirection )
|
if ( pSoldier->ubDirection != pSoldier->bDesiredDirection )
|
||||||
{
|
{
|
||||||
pSoldier->sAniDelay = FAST_TURN_ANIM_SPEED;
|
pSoldier->sAniDelay = FAST_TURN_ANIM_SPEED;
|
||||||
}
|
}
|
||||||
@@ -8989,7 +8995,7 @@ void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier )
|
|||||||
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier )
|
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
// Our water texture , for now is of a given type
|
// Our water texture , for now is of a given type
|
||||||
if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER || pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( TERRAIN_IS_WATER( pSoldier->bOverTerrainType))
|
||||||
{
|
{
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
@@ -8999,6 +9005,47 @@ BOOLEAN MercInWater( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier )
|
||||||
|
{
|
||||||
|
// Our water texture , for now is of a given type
|
||||||
|
if ( TERRAIN_IS_SHALLOW_WATER( pSoldier->bOverTerrainType))
|
||||||
|
{
|
||||||
|
return( TRUE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier )
|
||||||
|
{
|
||||||
|
// Our water texture , for now is of a given type
|
||||||
|
if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType))
|
||||||
|
{
|
||||||
|
return( TRUE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier )
|
||||||
|
{
|
||||||
|
// Our water texture , for now is of a given type
|
||||||
|
if ( TERRAIN_IS_HIGH_WATER( pSoldier->bOverTerrainType))
|
||||||
|
{
|
||||||
|
return( TRUE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void RevivePlayerTeam( )
|
void RevivePlayerTeam( )
|
||||||
{
|
{
|
||||||
@@ -9083,7 +9130,7 @@ void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN
|
|||||||
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
||||||
|
|
||||||
// Get direction
|
// Get direction
|
||||||
pProfileDir = &( pProfile->Dirs[ pSoldier->bDirection ] );
|
pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] );
|
||||||
|
|
||||||
// Loop tiles and set accordingly into world
|
// Loop tiles and set accordingly into world
|
||||||
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
||||||
@@ -9180,7 +9227,7 @@ BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UI
|
|||||||
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
||||||
|
|
||||||
// Get direction
|
// Get direction
|
||||||
pProfileDir = &( pProfile->Dirs[ pSoldier->bDirection ] );
|
pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] );
|
||||||
|
|
||||||
// Loop tiles and set accordingly into world
|
// Loop tiles and set accordingly into world
|
||||||
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
||||||
@@ -9214,7 +9261,7 @@ void EVENT_SoldierBeginGiveItem( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
// CHANGE DIRECTION AND GOTO ANIMATION NOW
|
// CHANGE DIRECTION AND GOTO ANIMATION NOW
|
||||||
pSoldier->bDesiredDirection = pSoldier->bPendingActionData3;
|
pSoldier->bDesiredDirection = pSoldier->bPendingActionData3;
|
||||||
pSoldier->bDirection = pSoldier->bPendingActionData3;
|
pSoldier->ubDirection = pSoldier->bPendingActionData3;
|
||||||
|
|
||||||
// begin animation
|
// begin animation
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, GIVE_ITEM, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, GIVE_ITEM, 0 , FALSE );
|
||||||
@@ -9330,7 +9377,7 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
|
|||||||
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
||||||
{
|
{
|
||||||
// OK, stop merc....
|
// OK, stop merc....
|
||||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||||
|
|
||||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||||
{
|
{
|
||||||
@@ -9487,7 +9534,7 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
|
|||||||
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
||||||
{
|
{
|
||||||
// OK, stop merc....
|
// OK, stop merc....
|
||||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||||
|
|
||||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||||
{
|
{
|
||||||
@@ -10004,7 +10051,7 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy
|
|||||||
//EV_S_STOP_MERC SStopMerc;
|
//EV_S_STOP_MERC SStopMerc;
|
||||||
|
|
||||||
//SStopMerc.sGridNo = pSoldier->sGridNo;
|
//SStopMerc.sGridNo = pSoldier->sGridNo;
|
||||||
//SStopMerc.bDirection = pSoldier->bDirection;
|
//SStopMerc.bDirection = pSoldier->ubDirection;
|
||||||
//SStopMerc.usSoldierID = pSoldier->ubID;
|
//SStopMerc.usSoldierID = pSoldier->ubID;
|
||||||
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc );
|
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc );
|
||||||
|
|
||||||
@@ -10065,7 +10112,7 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy
|
|||||||
|
|
||||||
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
|
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -10595,7 +10642,7 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew
|
|||||||
|
|
||||||
BOOLEAN IsValidStance( SOLDIERTYPE *pSoldier, INT8 bNewStance )
|
BOOLEAN IsValidStance( SOLDIERTYPE *pSoldier, INT8 bNewStance )
|
||||||
{
|
{
|
||||||
return( InternalIsValidStance( pSoldier, pSoldier->bDirection, bNewStance ) );
|
return( InternalIsValidStance( pSoldier, pSoldier->ubDirection, bNewStance ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -10915,11 +10962,11 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
case ANIM_STAND:
|
case ANIM_STAND:
|
||||||
|
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_DIE, 0, FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_DIE, 0, FALSE );
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bOverTerrainType == LOW_WATER )
|
else if ( MercInShallowWater( pSoldier) )
|
||||||
{
|
{
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, WATER_DIE, 0, FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, WATER_DIE, 0, FALSE );
|
||||||
}
|
}
|
||||||
@@ -11218,7 +11265,7 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
bDirection = pSoldier->bDirection;
|
bDirection = pSoldier->ubDirection;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11486,13 +11533,33 @@ void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
||||||
{
|
{
|
||||||
UINT16 usNewGridNo;
|
INT16 sNewGridNo;
|
||||||
|
UINT8 ubOppositeDir;
|
||||||
|
INT16 sDirectionInc;
|
||||||
|
|
||||||
|
ubOppositeDir = gOppositeDirection[ ubDirection ];
|
||||||
|
sDirectionInc = DirectionInc( ubOppositeDir);
|
||||||
|
|
||||||
// Get dest gridno, convert to center coords
|
// Get dest gridno, convert to center coords
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirectionInc );
|
||||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||||
|
{
|
||||||
|
// No room to fly back. Pretend we hit the wall and fall forward instead
|
||||||
|
BeginTyingToFall( pSoldier );
|
||||||
|
ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sNewGridNo = NewGridNo( sNewGridNo, sDirectionInc );
|
||||||
|
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||||
|
{
|
||||||
|
// No room to fly back. Fall back instead
|
||||||
|
BeginTyingToFall( pSoldier );
|
||||||
|
ChangeSoldierState( pSoldier, FALLBACK_HIT_STAND, 0, FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Remove any previous actions
|
// Remove any previous actions
|
||||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||||
@@ -11500,23 +11567,38 @@ void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
|||||||
// Set path....
|
// Set path....
|
||||||
pSoldier->usPathDataSize = 0;
|
pSoldier->usPathDataSize = 0;
|
||||||
pSoldier->usPathIndex = 0;
|
pSoldier->usPathIndex = 0;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||||
pSoldier->usPathDataSize++;
|
pSoldier->usPathDataSize++;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||||
pSoldier->usPathDataSize++;
|
pSoldier->usPathDataSize++;
|
||||||
pSoldier->sFinalDestination = usNewGridNo;
|
pSoldier->sFinalDestination = sNewGridNo;
|
||||||
EVENT_InternalSetSoldierDestination( pSoldier, pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FLYBACK_HIT );
|
EVENT_InternalSetSoldierDestination( pSoldier, pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FLYBACK_HIT );
|
||||||
|
|
||||||
// Get a new direction based on direction
|
// Get a new direction based on direction
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
||||||
{
|
{
|
||||||
UINT16 usNewGridNo;
|
INT16 sNewGridNo;
|
||||||
|
UINT8 ubOppositeDir;
|
||||||
|
INT16 sDirection;
|
||||||
|
|
||||||
|
ubOppositeDir = gOppositeDirection[ ubDirection ];
|
||||||
|
sDirection = DirectionInc( ubOppositeDir);
|
||||||
|
|
||||||
// Get dest gridno, convert to center coords
|
// Get dest gridno, convert to center coords
|
||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirection );
|
||||||
|
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||||
|
{
|
||||||
|
// No room to fly back. Pretend we hit the wall and fall forward instead
|
||||||
|
BeginTyingToFall( pSoldier );
|
||||||
|
ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get dest gridno, convert to center coords
|
||||||
|
//sNewGridNo = NewGridNo( sNewGridNo, sDirection );
|
||||||
//usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (UINT16)(-1 * DirectionInc( bDirection ) ) );
|
//usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (UINT16)(-1 * DirectionInc( bDirection ) ) );
|
||||||
|
|
||||||
// Remove any previous actions
|
// Remove any previous actions
|
||||||
@@ -11525,10 +11607,11 @@ void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
|||||||
// Set path....
|
// Set path....
|
||||||
pSoldier->usPathDataSize = 0;
|
pSoldier->usPathDataSize = 0;
|
||||||
pSoldier->usPathIndex = 0;
|
pSoldier->usPathIndex = 0;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||||
pSoldier->usPathDataSize++;
|
pSoldier->usPathDataSize++;
|
||||||
pSoldier->sFinalDestination = usNewGridNo;
|
pSoldier->sFinalDestination = sNewGridNo;
|
||||||
EVENT_InternalSetSoldierDestination( pSoldier, pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FALLBACK_HIT_STAND );
|
//pSoldier->sFinalDestination = pSoldier->sGridNo;
|
||||||
|
EVENT_InternalSetSoldierDestination( pSoldier, ubOppositeDir, FALSE, FALLBACK_HIT_STAND );
|
||||||
|
|
||||||
// Get a new direction based on direction
|
// Get a new direction based on direction
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, FALLBACK_HIT_STAND, 0 , FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, FALLBACK_HIT_STAND, 0 , FALSE );
|
||||||
@@ -11664,7 +11747,7 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL
|
|||||||
SendSoldierSetDesiredDirectionEvent( pTSoldier, gOppositeDirection[ sFacingDir ] );
|
SendSoldierSetDesiredDirectionEvent( pTSoldier, gOppositeDirection[ sFacingDir ] );
|
||||||
|
|
||||||
// Stop our guys...
|
// Stop our guys...
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
|
|
||||||
pTMilitiaSoldier = pTSoldier; //lal
|
pTMilitiaSoldier = pTSoldier; //lal
|
||||||
@@ -12051,12 +12134,12 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier )
|
|||||||
{
|
{
|
||||||
ubSoundBase = WALK_LEFT_ROAD;
|
ubSoundBase = WALK_LEFT_ROAD;
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
else if ( MercInShallowWater( pSoldier) )
|
||||||
{
|
{
|
||||||
ubSoundBase = WATER_WALK1_IN;
|
ubSoundBase = WATER_WALK1_IN;
|
||||||
ubRandomMax = 2;
|
ubRandomMax = 2;
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
else if ( MercInDeepWater( pSoldier) )
|
||||||
{
|
{
|
||||||
ubSoundBase = SWIM_1;
|
ubSoundBase = SWIM_1;
|
||||||
ubRandomMax = 2;
|
ubRandomMax = 2;
|
||||||
@@ -12208,7 +12291,7 @@ void DebugValidateSoldierData( )
|
|||||||
|
|
||||||
void BeginTyingToFall( SOLDIERTYPE *pSoldier )
|
void BeginTyingToFall( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
pSoldier->bStartFallDir = pSoldier->bDirection;
|
pSoldier->bStartFallDir = pSoldier->ubDirection;
|
||||||
pSoldier->fTryingToFall = TRUE;
|
pSoldier->fTryingToFall = TRUE;
|
||||||
|
|
||||||
// Randomize direction
|
// Randomize direction
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ public:
|
|||||||
FLOAT dOldYPos;
|
FLOAT dOldYPos;
|
||||||
INT16 sInitialGridNo;
|
INT16 sInitialGridNo;
|
||||||
INT16 sGridNo;
|
INT16 sGridNo;
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
INT16 sHeightAdjustment;
|
INT16 sHeightAdjustment;
|
||||||
INT16 sDesiredHeight;
|
INT16 sDesiredHeight;
|
||||||
INT16 sTempNewGridNo; // New grid no for advanced animations
|
INT16 sTempNewGridNo; // New grid no for advanced animations
|
||||||
@@ -1158,7 +1158,7 @@ void EVENT_GetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16
|
|||||||
BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestart );
|
BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestart );
|
||||||
|
|
||||||
void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection );
|
void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection );
|
||||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection );
|
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection );
|
||||||
void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo );
|
void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo );
|
||||||
void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGridNo );
|
void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGridNo );
|
||||||
void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection );
|
void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection );
|
||||||
@@ -1204,8 +1204,8 @@ BOOLEAN DeletePaletteData( );
|
|||||||
// UTILITY FUNCTUIONS
|
// UTILITY FUNCTUIONS
|
||||||
void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange );
|
void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange );
|
||||||
void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMovementDist );
|
void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMovementDist );
|
||||||
INT16 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier );
|
UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier );
|
||||||
INT16 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier );
|
UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier );
|
||||||
UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 );
|
UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 );
|
||||||
UINT8 atan8FromAngle( DOUBLE dAngle );
|
UINT8 atan8FromAngle( DOUBLE dAngle );
|
||||||
INT8 CalcActionPoints(SOLDIERTYPE *pSold );
|
INT8 CalcActionPoints(SOLDIERTYPE *pSold );
|
||||||
@@ -1214,6 +1214,9 @@ INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc );
|
|||||||
// This function is now obsolete. Call ReduceAttackBusyCount instead.
|
// This function is now obsolete. Call ReduceAttackBusyCount instead.
|
||||||
// void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier );
|
// void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier );
|
||||||
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier );
|
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier );
|
||||||
|
BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier );
|
||||||
|
BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier );
|
||||||
|
BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier );
|
||||||
UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance );
|
UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance );
|
||||||
UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight );
|
UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight );
|
||||||
void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier );
|
void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier );
|
||||||
@@ -1270,10 +1273,10 @@ void PositionSoldierLight( SOLDIERTYPE *pSoldier );
|
|||||||
|
|
||||||
void SetCheckSoldierLightFlag( SOLDIERTYPE *pSoldier );
|
void SetCheckSoldierLightFlag( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState );
|
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState );
|
||||||
|
|
||||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection );
|
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection );
|
||||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection );
|
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection );
|
||||||
|
|
||||||
//reset soldier timers
|
//reset soldier timers
|
||||||
void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier );
|
void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier );
|
||||||
|
|||||||
+11
-10
@@ -414,10 +414,10 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
|||||||
Soldier.sSectorX = pCreateStruct->sSectorX;
|
Soldier.sSectorX = pCreateStruct->sSectorX;
|
||||||
Soldier.sSectorY = pCreateStruct->sSectorY;
|
Soldier.sSectorY = pCreateStruct->sSectorY;
|
||||||
Soldier.bSectorZ = pCreateStruct->bSectorZ;
|
Soldier.bSectorZ = pCreateStruct->bSectorZ;
|
||||||
Soldier.ubInsertionDirection = pCreateStruct->bDirection;
|
Soldier.ubInsertionDirection = pCreateStruct->ubDirection;
|
||||||
Soldier.bDesiredDirection = pCreateStruct->bDirection;
|
Soldier.bDesiredDirection = pCreateStruct->ubDirection;
|
||||||
Soldier.bDominantDir = pCreateStruct->bDirection;
|
Soldier.bDominantDir = pCreateStruct->ubDirection;
|
||||||
Soldier.bDirection = pCreateStruct->bDirection;
|
Soldier.ubDirection = pCreateStruct->ubDirection;
|
||||||
|
|
||||||
Soldier.sInsertionGridNo = pCreateStruct->sInsertionGridNo;
|
Soldier.sInsertionGridNo = pCreateStruct->sInsertionGridNo;
|
||||||
Soldier.bOldLife = Soldier.bLifeMax;
|
Soldier.bOldLife = Soldier.bLifeMax;
|
||||||
@@ -812,7 +812,7 @@ BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STR
|
|||||||
|
|
||||||
pSoldier->bOrders = pCreateStruct->bOrders;
|
pSoldier->bOrders = pCreateStruct->bOrders;
|
||||||
pSoldier->bAttitude = pCreateStruct->bAttitude;
|
pSoldier->bAttitude = pCreateStruct->bAttitude;
|
||||||
pSoldier->bDirection = pCreateStruct->bDirection;
|
pSoldier->ubDirection = pCreateStruct->ubDirection;
|
||||||
pSoldier->bPatrolCnt = pCreateStruct->bPatrolCnt;
|
pSoldier->bPatrolCnt = pCreateStruct->bPatrolCnt;
|
||||||
memcpy( pSoldier->usPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
memcpy( pSoldier->usPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
||||||
|
|
||||||
@@ -1642,7 +1642,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B
|
|||||||
//Pass over mandatory information specified from the basic placement
|
//Pass over mandatory information specified from the basic placement
|
||||||
pp->bOrders = bp->bOrders;
|
pp->bOrders = bp->bOrders;
|
||||||
pp->bAttitude = bp->bAttitude;
|
pp->bAttitude = bp->bAttitude;
|
||||||
pp->bDirection = bp->bDirection;
|
pp->ubDirection = bp->ubDirection;
|
||||||
|
|
||||||
|
|
||||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenBasicPlacementInfo: determine soldier's class"));
|
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenBasicPlacementInfo: determine soldier's class"));
|
||||||
@@ -1861,7 +1861,7 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT
|
|||||||
//Pass over mandatory information specified from the basic placement
|
//Pass over mandatory information specified from the basic placement
|
||||||
spp->bOrders = bp->bOrders;
|
spp->bOrders = bp->bOrders;
|
||||||
spp->bAttitude = bp->bAttitude;
|
spp->bAttitude = bp->bAttitude;
|
||||||
spp->bDirection = bp->bDirection;
|
spp->ubDirection = bp->ubDirection;
|
||||||
|
|
||||||
//Only creatures have mandatory body types specified.
|
//Only creatures have mandatory body types specified.
|
||||||
if( spp->bTeam == CREATURE_TEAM )
|
if( spp->bTeam == CREATURE_TEAM )
|
||||||
@@ -1929,7 +1929,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
|||||||
// Copy over team
|
// Copy over team
|
||||||
pp->bTeam = bp->bTeam;
|
pp->bTeam = bp->bTeam;
|
||||||
|
|
||||||
pp->bDirection = bp->bDirection;
|
pp->ubDirection = bp->ubDirection;
|
||||||
pp->sInsertionGridNo = bp->usStartingGridNo;
|
pp->sInsertionGridNo = bp->usStartingGridNo;
|
||||||
|
|
||||||
//ATE: Copy over sector coordinates from profile to create struct
|
//ATE: Copy over sector coordinates from profile to create struct
|
||||||
@@ -1941,7 +1941,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
|||||||
|
|
||||||
pp->bOrders = bp->bOrders;
|
pp->bOrders = bp->bOrders;
|
||||||
pp->bAttitude = bp->bAttitude;
|
pp->bAttitude = bp->bAttitude;
|
||||||
pp->bDirection = bp->bDirection;
|
pp->ubDirection = bp->ubDirection;
|
||||||
pp->bPatrolCnt = bp->bPatrolCnt;
|
pp->bPatrolCnt = bp->bPatrolCnt;
|
||||||
memcpy( pp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
memcpy( pp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
||||||
pp->fHasKeys = bp->fHasKeys;
|
pp->fHasKeys = bp->fHasKeys;
|
||||||
@@ -2383,7 +2383,8 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass )
|
|||||||
UINT8 ubID;
|
UINT8 ubID;
|
||||||
SOLDIERTYPE * pSoldier;
|
SOLDIERTYPE * pSoldier;
|
||||||
|
|
||||||
if (gpBattleGroup->ubSectorZ == gbWorldSectorZ &&
|
if (gpBattleGroup &&
|
||||||
|
gpBattleGroup->ubSectorZ == gbWorldSectorZ &&
|
||||||
gpBattleGroup->ubSectorX == gWorldSectorX &&
|
gpBattleGroup->ubSectorX == gWorldSectorX &&
|
||||||
gpBattleGroup->ubSectorY == gWorldSectorY &&
|
gpBattleGroup->ubSectorY == gWorldSectorY &&
|
||||||
guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ typedef struct
|
|||||||
INT8 bTeam; //The team this individual is part of.
|
INT8 bTeam; //The team this individual is part of.
|
||||||
INT8 bRelativeAttributeLevel;
|
INT8 bRelativeAttributeLevel;
|
||||||
INT8 bRelativeEquipmentLevel;
|
INT8 bRelativeEquipmentLevel;
|
||||||
INT8 bDirection; //1 of 8 values (always mandatory)
|
UINT8 ubDirection; //1 of 8 values (always mandatory)
|
||||||
INT8 bOrders;
|
INT8 bOrders;
|
||||||
INT8 bAttitude;
|
INT8 bAttitude;
|
||||||
INT8 bBodyType; //up to 128 body types, -1 means random
|
INT8 bBodyType; //up to 128 body types, -1 means random
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
//Location information
|
//Location information
|
||||||
INT16 sSectorX;
|
INT16 sSectorX;
|
||||||
INT16 sSectorY;
|
INT16 sSectorY;
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
INT16 sInsertionGridNo;
|
INT16 sInsertionGridNo;
|
||||||
|
|
||||||
// Can force a team, but needs flag set
|
// Can force a team, but needs flag set
|
||||||
|
|||||||
@@ -2368,7 +2368,9 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated()
|
|||||||
{
|
{
|
||||||
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
MemFree( curr->pDetailedPlacement );
|
// pDetailedPlacement has been C++'d
|
||||||
|
//MemFree( curr->pDetailedPlacement );
|
||||||
|
delete curr->pDetailedPlacement;
|
||||||
curr->pDetailedPlacement = NULL;
|
curr->pDetailedPlacement = NULL;
|
||||||
curr->pBasicPlacement->fDetailedPlacement = FALSE;
|
curr->pBasicPlacement->fDetailedPlacement = FALSE;
|
||||||
curr->pBasicPlacement->fPriorityExistance = FALSE;
|
curr->pBasicPlacement->fPriorityExistance = FALSE;
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
|
|||||||
MercCreateStruct.sSectorY = pSoldier->sSectorY;
|
MercCreateStruct.sSectorY = pSoldier->sSectorY;
|
||||||
MercCreateStruct.bSectorZ = pSoldier->bSectorZ;
|
MercCreateStruct.bSectorZ = pSoldier->bSectorZ;
|
||||||
MercCreateStruct.sInsertionGridNo = pSoldier->sGridNo;
|
MercCreateStruct.sInsertionGridNo = pSoldier->sGridNo;
|
||||||
MercCreateStruct.bDirection = pSoldier->bDirection;
|
MercCreateStruct.ubDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void SetFinalTile( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fGivenUp )
|
|||||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name );
|
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
|||||||
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
// Restore...
|
// Restore...
|
||||||
pSoldier->sFinalDestination = sOldFinalDest;
|
pSoldier->sFinalDestination = sOldFinalDest;
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
|||||||
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
// Restore...
|
// Restore...
|
||||||
pSoldier->sFinalDestination = sOldFinalDest;
|
pSoldier->sFinalDestination = sOldFinalDest;
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
|||||||
bOverTerrainType = GetTerrainType( sGridNo );
|
bOverTerrainType = GetTerrainType( sGridNo );
|
||||||
|
|
||||||
// Check if we are going into water!
|
// Check if we are going into water!
|
||||||
if ( bOverTerrainType == LOW_WATER || bOverTerrainType == MED_WATER || bOverTerrainType == DEEP_WATER )
|
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||||
{
|
{
|
||||||
// Check if we are of prone or crawl height and change stance accordingly....
|
// Check if we are of prone or crawl height and change stance accordingly....
|
||||||
switch( gAnimControl[ pSoldier->usAnimState ].ubHeight )
|
switch( gAnimControl[ pSoldier->usAnimState ].ubHeight )
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void AccumulateBurstLocation( INT16 sGridNo )
|
|||||||
void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
UINT8 ubShotsPerBurst = 0;
|
UINT8 ubShotsPerBurst = 0;
|
||||||
FLOAT dAccululator = 0;
|
FLOAT dAccumulator = 0;
|
||||||
FLOAT dStep = 0;
|
FLOAT dStep = 0;
|
||||||
INT32 cnt;
|
INT32 cnt;
|
||||||
UINT8 ubLocationNum;
|
UINT8 ubLocationNum;
|
||||||
@@ -147,7 +147,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
|||||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||||
pSoldier->bDoAutofire--;
|
pSoldier->bDoAutofire--;
|
||||||
|
|
||||||
ubShotsPerBurst = __min(pSoldier->bDoAutofire,MAX_BURST_SPREAD_TARGETS);
|
ubShotsPerBurst = pSoldier->bDoAutofire;
|
||||||
}
|
}
|
||||||
else if ( gbNumBurstLocations > 0 )
|
else if ( gbNumBurstLocations > 0 )
|
||||||
ubShotsPerBurst = pSoldier->bDoAutofire / gbNumBurstLocations;
|
ubShotsPerBurst = pSoldier->bDoAutofire / gbNumBurstLocations;
|
||||||
@@ -156,11 +156,13 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST )
|
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST )
|
||||||
ubShotsPerBurst = __min(Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS])].ubShotsPerBurst,MAX_BURST_SPREAD_TARGETS);
|
ubShotsPerBurst = Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS])].ubShotsPerBurst;
|
||||||
else
|
else
|
||||||
ubShotsPerBurst = __min(GetShotsPerBurst(&pSoldier->inv[ HANDPOS ]),MAX_BURST_SPREAD_TARGETS);
|
ubShotsPerBurst = GetShotsPerBurst(&pSoldier->inv[ HANDPOS ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubShotsPerBurst = __min( ubShotsPerBurst, MAX_BURST_SPREAD_TARGETS);
|
||||||
|
|
||||||
// Use # gridnos accululated and # burst shots to determine accululator
|
// Use # gridnos accululated and # burst shots to determine accululator
|
||||||
dStep = gbNumBurstLocations / (FLOAT)ubShotsPerBurst;
|
dStep = gbNumBurstLocations / (FLOAT)ubShotsPerBurst;
|
||||||
|
|
||||||
@@ -168,13 +170,18 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
|||||||
for ( cnt = 0; cnt < ubShotsPerBurst; cnt++ )
|
for ( cnt = 0; cnt < ubShotsPerBurst; cnt++ )
|
||||||
{
|
{
|
||||||
// Get index into list
|
// Get index into list
|
||||||
ubLocationNum = (UINT8)( dAccululator );
|
ubLocationNum = (UINT8)( dAccumulator );
|
||||||
|
|
||||||
// Add to merc location
|
// Add to merc location
|
||||||
pSoldier->sSpreadLocations[ cnt ] = gsBurstLocations[ ubLocationNum ].sGridNo;
|
pSoldier->sSpreadLocations[ cnt ] = gsBurstLocations[ ubLocationNum ].sGridNo;
|
||||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickBurstLocations: loc#%d = %d", cnt, pSoldier->sSpreadLocations[ cnt ]));
|
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickBurstLocations: loc#%d = %d", cnt, pSoldier->sSpreadLocations[ cnt ]));
|
||||||
// Acculuate index value
|
// Acculuate index value
|
||||||
dAccululator += dStep;
|
dAccumulator += dStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; cnt < MAX_BURST_SPREAD_TARGETS; cnt++)
|
||||||
|
{
|
||||||
|
pSoldier->sSpreadLocations[ cnt ] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK, they have been added
|
// OK, they have been added
|
||||||
@@ -219,6 +226,10 @@ void AIPickBurstLocations( SOLDIERTYPE *pSoldier, INT8 bTargets, SOLDIERTYPE *pT
|
|||||||
dAccululator += dStep;
|
dAccululator += dStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (; cnt < MAX_BURST_SPREAD_TARGETS; cnt++)
|
||||||
|
{
|
||||||
|
pSoldier->sSpreadLocations[ cnt ] = 0;
|
||||||
|
}
|
||||||
// OK, they have been added
|
// OK, they have been added
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2779,7 +2779,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
|
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
|
||||||
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
|
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
|
||||||
|
|
||||||
Corpse.bDirection = pSoldier->bDirection;
|
Corpse.ubDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
// Set time of death
|
// Set time of death
|
||||||
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
|
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
|
||||||
|
|||||||
@@ -2358,7 +2358,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
BeginSoldierClimbUpRoof( pjSoldier );
|
BeginSoldierClimbUpRoof( pjSoldier );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->bDirection, &bDirection ) )
|
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
|
||||||
{
|
{
|
||||||
BeginSoldierClimbFence( pjSoldier );
|
BeginSoldierClimbFence( pjSoldier );
|
||||||
}
|
}
|
||||||
@@ -4392,7 +4392,7 @@ void TeleportSelectedSoldier()
|
|||||||
{
|
{
|
||||||
SetSoldierHeight( pSoldier, 0 );
|
SetSoldierHeight( pSoldier, 0 );
|
||||||
TeleportSoldier( pSoldier, usMapPos, FALSE );
|
TeleportSoldier( pSoldier, usMapPos, FALSE );
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4402,7 +4402,7 @@ void TeleportSelectedSoldier()
|
|||||||
SetSoldierHeight( pSoldier, 50.0 );
|
SetSoldierHeight( pSoldier, 50.0 );
|
||||||
|
|
||||||
TeleportSoldier( pSoldier, usMapPos, TRUE );
|
TeleportSoldier( pSoldier, usMapPos, TRUE );
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4519,7 +4519,7 @@ void ObliterateSector()
|
|||||||
// CreateAnimationTile( &AniParams );
|
// CreateAnimationTile( &AniParams );
|
||||||
//PlayJA2Sample( EXPLOSION_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN );
|
//PlayJA2Sample( EXPLOSION_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN );
|
||||||
|
|
||||||
EVENT_SoldierGotHit( pTSoldier, 0, 400, 0, pTSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE );
|
EVENT_SoldierGotHit( pTSoldier, 0, 400, 0, pTSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4544,7 +4544,7 @@ void JumpFence()
|
|||||||
INT8 bDirection;
|
INT8 bDirection;
|
||||||
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||||
{
|
{
|
||||||
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bDirection ) )
|
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bDirection ) )
|
||||||
{
|
{
|
||||||
BeginSoldierClimbFence( pSoldier );
|
BeginSoldierClimbFence( pSoldier );
|
||||||
}
|
}
|
||||||
@@ -4568,7 +4568,7 @@ void CreateNextCivType()
|
|||||||
MercCreateStruct.sSectorY = gWorldSectorY;
|
MercCreateStruct.sSectorY = gWorldSectorY;
|
||||||
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
||||||
MercCreateStruct.bBodyType = bBodyType;
|
MercCreateStruct.bBodyType = bBodyType;
|
||||||
MercCreateStruct.bDirection = SOUTH;
|
MercCreateStruct.ubDirection = SOUTH;
|
||||||
|
|
||||||
bBodyType++;
|
bBodyType++;
|
||||||
|
|
||||||
|
|||||||
@@ -2347,7 +2347,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now check our terrain to see if we cannot do the action now...
|
// Now check our terrain to see if we cannot do the action now...
|
||||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
if ( WaterTooDeepForAttacks( pSoldier->sGridNo) )
|
||||||
{
|
{
|
||||||
ubCursor = INVALIDCURS;
|
ubCursor = INVALIDCURS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -576,7 +576,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId )
|
|||||||
EVENT_SetSoldierPosition( pSoldier, pVehicleSoldier->dXPos, pVehicleSoldier->dYPos );
|
EVENT_SetSoldierPosition( pSoldier, pVehicleSoldier->dXPos, pVehicleSoldier->dYPos );
|
||||||
|
|
||||||
// Stop from any movement.....
|
// Stop from any movement.....
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
// can't call SetCurrentSquad OR SelectSoldier in mapscreen, that will initialize interface panels!!!
|
// can't call SetCurrentSquad OR SelectSoldier in mapscreen, that will initialize interface panels!!!
|
||||||
if ( guiCurrentScreen == GAME_SCREEN )
|
if ( guiCurrentScreen == GAME_SCREEN )
|
||||||
|
|||||||
+88
-62
@@ -1314,28 +1314,36 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
||||||
if ( pSoldier->fDoSpread && !pSoldier->bDoBurst )
|
if ( pSoldier->fDoSpread)
|
||||||
{
|
{
|
||||||
pSoldier->fDoSpread = FALSE;
|
if (pSoldier->bDoBurst )
|
||||||
}
|
{
|
||||||
|
pSoldier->fDoSpread = FALSE;
|
||||||
if ( pSoldier->fDoSpread >= MAX_BURST_SPREAD_TARGETS )
|
}
|
||||||
{
|
// 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the
|
||||||
//If we have more than MAX_BURST_SPREAD_TARGETS bullets, loop over and start again from the first target location
|
// non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS,
|
||||||
pSoldier->fDoSpread = 1;
|
// but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this
|
||||||
|
// will work better.
|
||||||
|
else if (pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS ||
|
||||||
|
pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0)
|
||||||
|
{
|
||||||
|
if (pSoldier->fDoSpread == 1)
|
||||||
|
{
|
||||||
|
// If no spread locations are defined, don't spread
|
||||||
|
pSoldier->fDoSpread = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we hit the end of the array, either by finding a 0 or by exceeding its size, reset
|
||||||
|
pSoldier->fDoSpread = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( pSoldier->fDoSpread )
|
if ( pSoldier->fDoSpread )
|
||||||
{
|
{
|
||||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||||
{
|
|
||||||
UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UseGun( pSoldier, sTargetGridNo );
|
|
||||||
}
|
|
||||||
pSoldier->fDoSpread++;
|
pSoldier->fDoSpread++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1357,28 +1365,36 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
|||||||
UseGun( pSoldier, sTargetGridNo );
|
UseGun( pSoldier, sTargetGridNo );
|
||||||
else
|
else
|
||||||
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
||||||
if ( pSoldier->fDoSpread && !pSoldier->bDoBurst )
|
if ( pSoldier->fDoSpread)
|
||||||
{
|
{
|
||||||
pSoldier->fDoSpread = FALSE;
|
if (!pSoldier->bDoBurst )
|
||||||
}
|
{
|
||||||
|
pSoldier->fDoSpread = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if ( pSoldier->fDoSpread >= MAX_BURST_SPREAD_TARGETS )
|
// 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the
|
||||||
{
|
// non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS,
|
||||||
//If we have more than MAX_BURST_SPREAD_TARGETS bullets, loop over and start again from the first target location
|
// but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this
|
||||||
pSoldier->fDoSpread = 1;
|
// will work better.
|
||||||
|
else if ( pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS ||
|
||||||
|
pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0)
|
||||||
|
{
|
||||||
|
if (pSoldier->fDoSpread == 1)
|
||||||
|
{
|
||||||
|
// If no spread locations are defined, don't spread
|
||||||
|
pSoldier->fDoSpread = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we hit the end of the array, either by finding a 0 or by exceeding its size, reset
|
||||||
|
pSoldier->fDoSpread = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( pSoldier->fDoSpread )
|
if ( pSoldier->fDoSpread )
|
||||||
{
|
{
|
||||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||||
{
|
|
||||||
UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UseLauncher( pSoldier, sTargetGridNo );
|
|
||||||
}
|
|
||||||
pSoldier->fDoSpread++;
|
pSoldier->fDoSpread++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1917,7 +1933,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Direction to center of explosion
|
// Direction to center of explosion
|
||||||
ubDirection = gOppositeDirection[ pSoldier->bDirection ];
|
ubDirection = gOppositeDirection[ pSoldier->ubDirection ];
|
||||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(1 * DirectionInc( ubDirection ) ) );
|
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(1 * DirectionInc( ubDirection ) ) );
|
||||||
|
|
||||||
// Check if a person exists here and is not prone....
|
// Check if a person exists here and is not prone....
|
||||||
@@ -1932,7 +1948,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
|||||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) );
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) );
|
||||||
DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" );
|
DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" );
|
||||||
|
|
||||||
EVENT_SoldierGotHit( MercPtrs[ ubMerc ], MINI_GRENADE, 10, 200, pSoldier->bDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo );
|
EVENT_SoldierGotHit( MercPtrs[ ubMerc ], MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2602,7 +2618,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo )
|
|||||||
|
|
||||||
//AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP
|
//AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP
|
||||||
// costs are deducted. Final throw cost is deducted on creating the grenade object
|
// costs are deducted. Final throw cost is deducted on creating the grenade object
|
||||||
if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->bDirection )
|
if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->ubDirection )
|
||||||
sAPCost += (INT16)GetAPsToLook( pSoldier );
|
sAPCost += (INT16)GetAPsToLook( pSoldier );
|
||||||
sAPCost += (INT16)GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
sAPCost += (INT16)GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
||||||
|
|
||||||
@@ -2897,29 +2913,30 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos,
|
|||||||
// gTacticalStatus.ubAttackBusyCount++;
|
// gTacticalStatus.ubAttackBusyCount++;
|
||||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Explosion gone off, COunt now %d", gTacticalStatus.ubAttackBusyCount ) );
|
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Explosion gone off, COunt now %d", gTacticalStatus.ubAttackBusyCount ) );
|
||||||
|
|
||||||
PlayJA2Sample( CREATURE_GAS_NOISE, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
PlayJA2Sample( CREATURE_GAS_NOISE, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||||
|
// 0verhaul: Not ready to simplify this to a single call yet. What we need in order to
|
||||||
|
// fix this correctly is to detach 'alien spit' as a special caliber and instead add 3 new calibers for actual "ammo":
|
||||||
|
// very small spit, small spit, and large spit. Then we need to add a special effect miss index to point to the
|
||||||
|
// appropriate smoke effect to disperse.
|
||||||
|
//NewSmokeEffect( sGridNo, usItem, 0, ubAttackerID);
|
||||||
|
|
||||||
// WDS fix 07/25/2007
|
// Do Spread effect.......
|
||||||
// Don't have monsters cause explosions
|
switch( usItem )
|
||||||
// NewSmokeEffect( sGridNo, usItem, 0, ubAttackerID );
|
{
|
||||||
|
case CREATURE_YOUNG_MALE_SPIT:
|
||||||
|
case CREATURE_INFANT_SPIT:
|
||||||
|
|
||||||
// // Do Spread effect.......
|
NewSmokeEffect( sGridNo, VERY_SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||||
// switch( usItem )
|
break;
|
||||||
// {
|
case CREATURE_OLD_MALE_SPIT:
|
||||||
// case CREATURE_YOUNG_MALE_SPIT:
|
NewSmokeEffect( sGridNo, SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||||
//case CREATURE_INFANT_SPIT:
|
break;
|
||||||
|
|
||||||
// NewSmokeEffect( sGridNo, VERY_SMALL_CREATURE_GAS, 0, ubAttackerID );
|
case CREATURE_QUEEN_SPIT:
|
||||||
// break;
|
NewSmokeEffect( sGridNo, LARGE_CREATURE_GAS, 0, ubAttackerID );
|
||||||
// case CREATURE_OLD_MALE_SPIT:
|
break;
|
||||||
// NewSmokeEffect( sGridNo, SMALL_CREATURE_GAS, 0, ubAttackerID );
|
}
|
||||||
// break;
|
}
|
||||||
|
|
||||||
// case CREATURE_QUEEN_SPIT:
|
|
||||||
// NewSmokeEffect( sGridNo, LARGE_CREATURE_GAS, 0, ubAttackerID );
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -2980,7 +2997,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
|||||||
DoSpecialEffectAmmoMiss( ubAttackerID, pTargetSoldier->sGridNo, sXPos, sYPos, sZPos, FALSE, FALSE, 0 );
|
DoSpecialEffectAmmoMiss( ubAttackerID, pTargetSoldier->sGridNo, sXPos, sYPos, sZPos, FALSE, FALSE, 0 );
|
||||||
|
|
||||||
// OK, SHOT HAS HIT, DO THINGS APPROPRIATELY
|
// OK, SHOT HAS HIT, DO THINGS APPROPRIATELY
|
||||||
// ATE: This is 'cause of that darn smoke effect that could potnetially kill
|
// ATE: This is 'cause of that darn smoke effect that could potentially kill
|
||||||
// the poor bastard .. so check
|
// the poor bastard .. so check
|
||||||
if ( !pTargetSoldier->fDoingExternalDeath )
|
if ( !pTargetSoldier->fDoingExternalDeath )
|
||||||
{
|
{
|
||||||
@@ -2988,7 +3005,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
|||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// Buddy had died from additional dammage - free up attacker here...
|
// Buddy had died from additional damage - free up attacker here...
|
||||||
// ReduceAttackBusyCount( pTargetSoldier->ubAttackerID, FALSE );
|
// ReduceAttackBusyCount( pTargetSoldier->ubAttackerID, FALSE );
|
||||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Special effect killed before bullet impact, attack count now %d", gTacticalStatus.ubAttackBusyCount) );
|
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Special effect killed before bullet impact, attack count now %d", gTacticalStatus.ubAttackBusyCount) );
|
||||||
// OutputDebugString( "Special effect killed before bullet impact\n" );
|
// OutputDebugString( "Special effect killed before bullet impact\n" );
|
||||||
@@ -3228,7 +3245,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
|
|||||||
usMissTileType = FIRSTMISS;
|
usMissTileType = FIRSTMISS;
|
||||||
|
|
||||||
// Check if we are in water...
|
// Check if we are in water...
|
||||||
if ( gpWorldLevelData[ sGridNo ].ubTerrainID == LOW_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == DEEP_WATER )
|
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridNo ].ubTerrainID) )
|
||||||
{
|
{
|
||||||
usMissTileIndex = SECONDMISS1;
|
usMissTileIndex = SECONDMISS1;
|
||||||
usMissTileType = SECONDMISS;
|
usMissTileType = SECONDMISS;
|
||||||
@@ -3688,7 +3705,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
|
|||||||
{
|
{
|
||||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT );
|
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
//restore old flag
|
//restore old flag
|
||||||
gAnimControl[ pSoldier->usAnimState ].uiFlags = oldFlag;
|
gAnimControl[ pSoldier->usAnimState ].uiFlags = oldFlag;
|
||||||
|
|
||||||
@@ -4498,7 +4515,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat
|
|||||||
break;
|
break;
|
||||||
case AIM_SHOT_LEGS:
|
case AIM_SHOT_LEGS:
|
||||||
// is the damage enough to make us fall over?
|
// is the damage enough to make us fall over?
|
||||||
if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && pTarget->bOverTerrainType != LOW_WATER && pTarget->bOverTerrainType != MED_WATER && pTarget->bOverTerrainType != DEEP_WATER )
|
if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && !MercInWater( pTarget) )
|
||||||
{
|
{
|
||||||
if (iImpactForCrits > MIN_DAMAGE_FOR_AUTO_FALL_OVER )
|
if (iImpactForCrits > MIN_DAMAGE_FOR_AUTO_FALL_OVER )
|
||||||
{
|
{
|
||||||
@@ -5355,6 +5372,14 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed )
|
|||||||
// better max range due to expertise
|
// better max range due to expertise
|
||||||
iRange = iRange * (100 + gbSkillTraitBonus[THROWING] * NUM_SKILL_TRAITS( pSoldier, THROWING ) ) / 100;
|
iRange = iRange * (100 + gbSkillTraitBonus[THROWING] * NUM_SKILL_TRAITS( pSoldier, THROWING ) ) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust for thrower's stance
|
||||||
|
if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight < ANIM_STAND)
|
||||||
|
{
|
||||||
|
// For now we just assume the thrower is crouched since we don't allow prone tossing at the moment
|
||||||
|
// So dock 30% from the distance
|
||||||
|
iRange = (iRange * 70) / 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iRange < 1)
|
if (iRange < 1)
|
||||||
@@ -5768,12 +5793,13 @@ BOOLEAN WeaponReady(SOLDIERTYPE * pSoldier)
|
|||||||
if ( AM_A_ROBOT( pSoldier) )
|
if ( AM_A_ROBOT( pSoldier) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY )
|
if ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) ||
|
||||||
|
(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 GetAPsToReload( OBJECTTYPE *pObj )
|
INT8 GetAPsToReload( OBJECTTYPE *pObj )
|
||||||
{
|
{
|
||||||
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("GetAPsToReload"));
|
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("GetAPsToReload"));
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ typedef struct
|
|||||||
BOOLEAN antiTank;
|
BOOLEAN antiTank;
|
||||||
BOOLEAN dart;
|
BOOLEAN dart;
|
||||||
BOOLEAN knife;
|
BOOLEAN knife;
|
||||||
BOOLEAN monsterSpit;
|
UINT16 monsterSpit;
|
||||||
BOOLEAN ignoreArmour;
|
BOOLEAN ignoreArmour;
|
||||||
BOOLEAN acidic;
|
BOOLEAN acidic;
|
||||||
INT16 lockBustingPower;
|
INT16 lockBustingPower;
|
||||||
|
|||||||
+2
-2
@@ -351,7 +351,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
|
|||||||
|
|
||||||
|
|
||||||
who = pSoldier->ubID;
|
who = pSoldier->ubID;
|
||||||
dir = pSoldier->bDirection;
|
dir = pSoldier->ubDirection;
|
||||||
|
|
||||||
//NumMessage("good old reveal",dir);
|
//NumMessage("good old reveal",dir);
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
|
|||||||
|
|
||||||
// create gridno increment for NOVIEW - in other words, no increment!
|
// create gridno increment for NOVIEW - in other words, no increment!
|
||||||
Inc[5] = 0;
|
Inc[5] = 0;
|
||||||
Dir[5] = pSoldier->bDirection;
|
Dir[5] = pSoldier->ubDirection;
|
||||||
|
|
||||||
if (dir % 2 == 1) /* even numbers use ViewPath2 */
|
if (dir % 2 == 1) /* even numbers use ViewPath2 */
|
||||||
Path2 = TRUE;
|
Path2 = TRUE;
|
||||||
|
|||||||
+29
-29
@@ -1151,7 +1151,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo );
|
bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo );
|
||||||
}
|
}
|
||||||
if (bFacingDir == DIRECTION_IRRELEVANT) {
|
if (bFacingDir == DIRECTION_IRRELEVANT) {
|
||||||
bFacingDir = pSoldier->bDirection;
|
bFacingDir = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
||||||
@@ -1205,8 +1205,8 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
// valid map references then use the ambient light level instead.
|
// valid map references then use the ambient light level instead.
|
||||||
if(0 > sSubjectGridNo || sSubjectGridNo > WORLD_MAX)
|
if(0 > sSubjectGridNo || sSubjectGridNo > WORLD_MAX)
|
||||||
{
|
{
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
||||||
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
||||||
|
|
||||||
bLightLevel = ubAmbientLightLevel;
|
bLightLevel = ubAmbientLightLevel;
|
||||||
}
|
}
|
||||||
@@ -1232,7 +1232,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
sDistVisible += sDistVisible * GetTotalVisionRangeBonus(pSoldier, bLightLevel) / 100;
|
sDistVisible += sDistVisible * GetTotalVisionRangeBonus(pSoldier, bLightLevel) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// give one step better vision for people with nightops
|
// give one step better vision for people with nightops
|
||||||
if (HAS_SKILL_TRAIT( pSoldier, NIGHTOPS ))
|
if (HAS_SKILL_TRAIT( pSoldier, NIGHTOPS ))
|
||||||
{
|
{
|
||||||
@@ -1254,7 +1254,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
if ( TANK(pSoldier) && sDistVisible > 0 && pSubject)
|
if ( TANK(pSoldier) && sDistVisible > 0 && pSubject)
|
||||||
{
|
{
|
||||||
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel) );
|
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
|
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
|
||||||
}
|
}
|
||||||
@@ -2111,7 +2111,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
{
|
{
|
||||||
CancelAIAction( pSoldier, TRUE );
|
CancelAIAction( pSoldier, TRUE );
|
||||||
pSoldier->sAbsoluteFinalDestination = NOWHERE;
|
pSoldier->sAbsoluteFinalDestination = NOWHERE;
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
TriggerNPCRecord( ANGEL, 20 );
|
TriggerNPCRecord( ANGEL, 20 );
|
||||||
// trigger Angel to walk off afterwards
|
// trigger Angel to walk off afterwards
|
||||||
//TriggerNPCRecord( ANGEL, 24 );
|
//TriggerNPCRecord( ANGEL, 24 );
|
||||||
@@ -3852,7 +3852,7 @@ void DebugSoldierPage2( )
|
|||||||
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
||||||
gprintf( 0, LINE_HEIGHT * ubLine, L"Direction:");
|
gprintf( 0, LINE_HEIGHT * ubLine, L"Direction:");
|
||||||
SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL);
|
SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL);
|
||||||
gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->bDirection] );
|
gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->ubDirection] );
|
||||||
ubLine++;
|
ubLine++;
|
||||||
|
|
||||||
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
||||||
@@ -5688,14 +5688,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
|||||||
sNoiseX = CenterX(sGridNo);
|
sNoiseX = CenterX(sGridNo);
|
||||||
sNoiseY = CenterY(sGridNo);
|
sNoiseY = CenterY(sGridNo);
|
||||||
bDirection = atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY);
|
bDirection = atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY);
|
||||||
if ( pSoldier->bDirection != bDirection && pSoldier->bDirection != gOneCDirection[ bDirection ] && pSoldier->bDirection != gOneCCDirection[ bDirection ] )
|
if ( pSoldier->ubDirection != bDirection && pSoldier->ubDirection != gOneCDirection[ bDirection ] && pSoldier->ubDirection != gOneCCDirection[ bDirection ] )
|
||||||
{
|
{
|
||||||
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
||||||
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = FALSE;
|
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = FALSE;
|
||||||
fMuzzleFlash = TRUE;
|
fMuzzleFlash = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sDistVisible = pSoldier->GetMaxDistanceVisible(sGridNo, bLevel, CALC_FROM_WANTED_DIR );
|
int sDistVisible = pSoldier->GetMaxDistanceVisible(sGridNo, bLevel, CALC_FROM_WANTED_DIR );
|
||||||
|
|
||||||
if ( fMuzzleFlash )
|
if ( fMuzzleFlash )
|
||||||
@@ -5703,14 +5703,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
|||||||
// turn flash on again
|
// turn flash on again
|
||||||
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = TRUE;
|
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= sDistVisible )
|
if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= sDistVisible )
|
||||||
{
|
{
|
||||||
// just use the XXadjustedXX center of the gridno
|
// just use the XXadjustedXX center of the gridno
|
||||||
sNoiseX = CenterX(sGridNo);
|
sNoiseX = CenterX(sGridNo);
|
||||||
sNoiseY = CenterY(sGridNo);
|
sNoiseY = CenterY(sGridNo);
|
||||||
|
|
||||||
if (pSoldier->bDirection != atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY))
|
if (pSoldier->ubDirection != atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY))
|
||||||
{
|
{
|
||||||
bHadToTurn = TRUE;
|
bHadToTurn = TRUE;
|
||||||
}
|
}
|
||||||
@@ -6530,27 +6530,27 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT
|
|||||||
}
|
}
|
||||||
|
|
||||||
bOldOppList = pDefender->bOppList[ pAttacker->ubID ];
|
bOldOppList = pDefender->bOppList[ pAttacker->ubID ];
|
||||||
// check LOS, considering we are now aware of the attacker
|
// check LOS, considering we are now aware of the attacker
|
||||||
// ignore muzzle flashes when must turning head
|
// ignore muzzle flashes when must turning head
|
||||||
if ( pAttacker->fMuzzleFlash )
|
if ( pAttacker->fMuzzleFlash )
|
||||||
{
|
|
||||||
bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY );
|
|
||||||
if ( pDefender->bDirection != bDirection && pDefender->bDirection != gOneCDirection[ bDirection ] && pDefender->bDirection != gOneCCDirection[ bDirection ] )
|
|
||||||
{
|
{
|
||||||
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY );
|
||||||
pAttacker->fMuzzleFlash = FALSE;
|
if ( pDefender->ubDirection != bDirection && pDefender->ubDirection != gOneCDirection[ bDirection ] && pDefender->ubDirection != gOneCCDirection[ bDirection ] )
|
||||||
fMuzzleFlash = TRUE;
|
{
|
||||||
|
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
||||||
|
pAttacker->fMuzzleFlash = FALSE;
|
||||||
|
fMuzzleFlash = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE, CALC_FROM_WANTED_DIR ) != 0)
|
if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE, CALC_FROM_WANTED_DIR ) != 0)
|
||||||
{
|
{
|
||||||
fSeesAttacker = TRUE;
|
fSeesAttacker = TRUE;
|
||||||
}
|
}
|
||||||
if ( fMuzzleFlash )
|
if ( fMuzzleFlash )
|
||||||
{
|
{
|
||||||
pAttacker->fMuzzleFlash = TRUE;
|
pAttacker->fMuzzleFlash = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fSeesAttacker)
|
if (fSeesAttacker)
|
||||||
{
|
{
|
||||||
@@ -7011,4 +7011,4 @@ BOOLEAN SoldierHasLimitedVision(SOLDIERTYPE * pSoldier)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-16
@@ -1101,7 +1101,7 @@ void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook)
|
|||||||
{
|
{
|
||||||
#ifdef TESTAI
|
#ifdef TESTAI
|
||||||
DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3,
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1160,7 +1160,7 @@ void ActionDone(SOLDIERTYPE *pSoldier)
|
|||||||
{
|
{
|
||||||
#ifdef TESTAI
|
#ifdef TESTAI
|
||||||
DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3,
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1177,7 +1177,7 @@ void ActionDone(SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if ( !pSoldier->fNoAPToFinishMove )
|
if ( !pSoldier->fNoAPToFinishMove )
|
||||||
{
|
{
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
AdjustNoAPToFinishMove( pSoldier, FALSE );
|
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
|
// 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
|
// 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");
|
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)
|
// force him to face in the right direction (as long as it's legal)
|
||||||
if ((pSoldier->bDesiredDirection >= 1) && (pSoldier->bDesiredDirection <= 8))
|
if ((pSoldier->bDesiredDirection >= 1) && (pSoldier->bDesiredDirection <= 8))
|
||||||
pSoldier->bDirection = pSoldier->bDesiredDirection;
|
pSoldier->ubDirection = pSoldier->bDesiredDirection;
|
||||||
else
|
else
|
||||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||||
|
|
||||||
// free up ONLY players from whom we haven't received an AI_ACTION_DONE yet
|
// 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...
|
// we can all agree the action is DONE and we can continue...
|
||||||
// (otherwise they'll be calling FreeUp... twice and get REAL screwed up)
|
// (otherwise they'll be calling FreeUp... twice and get REAL screwed up)
|
||||||
NetSend.msgType = NET_FREE_UP_TURN;
|
NetSend.msgType = NET_FREE_UP_TURN;
|
||||||
NetSend.ubID = pSoldier->ubID;
|
NetSend.ubID = pSoldier->ubID;
|
||||||
NetSend.misc_UCHAR = pSoldier->bDirection;
|
NetSend.misc_UCHAR = pSoldier->ubDirection;
|
||||||
NetSend.answer = pSoldier->bDesiredDirection;
|
NetSend.answer = pSoldier->bDesiredDirection;
|
||||||
|
|
||||||
for (cnt = 0; cnt < MAXPLAYERS; cnt++)
|
for (cnt = 0; cnt < MAXPLAYERS; cnt++)
|
||||||
@@ -2416,7 +2416,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
|||||||
case AI_ACTION_PULL_TRIGGER: // activate an adjacent panic trigger
|
case AI_ACTION_PULL_TRIGGER: // activate an adjacent panic trigger
|
||||||
|
|
||||||
// turn to face trigger first
|
// 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 );
|
SendSoldierSetDesiredDirectionEvent( pSoldier, NORTH );
|
||||||
}
|
}
|
||||||
@@ -2553,17 +2553,17 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
|||||||
case AI_ACTION_LOCK_DOOR:
|
case AI_ACTION_LOCK_DOOR:
|
||||||
{
|
{
|
||||||
STRUCTURE * pStructure;
|
STRUCTURE * pStructure;
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
INT16 sDoorGridNo;
|
INT16 sDoorGridNo;
|
||||||
|
|
||||||
bDirection = (INT8) GetDirectionFromGridNo( pSoldier->usActionData, pSoldier );
|
ubDirection = GetDirectionFromGridNo( (INT16)pSoldier->usActionData, pSoldier );
|
||||||
if (bDirection == EAST || bDirection == SOUTH)
|
if (ubDirection == EAST || ubDirection == SOUTH)
|
||||||
{
|
{
|
||||||
sDoorGridNo = pSoldier->sGridNo;
|
sDoorGridNo = pSoldier->sGridNo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sDoorGridNo = pSoldier->sGridNo + DirectionInc( bDirection );
|
sDoorGridNo = pSoldier->sGridNo + DirectionInc( ubDirection );
|
||||||
}
|
}
|
||||||
|
|
||||||
pStructure = FindStructure( sDoorGridNo, STRUCTURE_ANYDOOR );
|
pStructure = FindStructure( sDoorGridNo, STRUCTURE_ANYDOOR );
|
||||||
@@ -2582,14 +2582,14 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
|||||||
EndAIGuysTurn( pSoldier );
|
EndAIGuysTurn( pSoldier );
|
||||||
}
|
}
|
||||||
|
|
||||||
StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, bDirection );
|
StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, ubDirection );
|
||||||
InteractWithInteractiveObject( pSoldier, pStructure, bDirection );
|
InteractWithInteractiveObject( pSoldier, pStructure, ubDirection );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AI_ACTION_LOWER_GUN:
|
case AI_ACTION_LOWER_GUN:
|
||||||
// for now, just do "action done"
|
// for now, just do "action done"
|
||||||
InternalSoldierReadyWeapon(pSoldier,pSoldier->bDirection,TRUE);
|
InternalSoldierReadyWeapon(pSoldier,pSoldier->ubDirection,TRUE);
|
||||||
HandleSight(pSoldier, SIGHT_LOOK );
|
HandleSight(pSoldier, SIGHT_LOOK );
|
||||||
ActionDone( pSoldier );
|
ActionDone( pSoldier );
|
||||||
break;
|
break;
|
||||||
|
|||||||
+11
-11
@@ -448,7 +448,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
|||||||
{
|
{
|
||||||
INT8 bMinPointsNeeded = 0;
|
INT8 bMinPointsNeeded = 0;
|
||||||
INT8 bAPForStandUp = 0;
|
INT8 bAPForStandUp = 0;
|
||||||
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier->sGridNo ) == pSoldier->bDirection ) ? 0 : 1;
|
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier->sGridNo ) == pSoldier->ubDirection ) ? 0 : 1;
|
||||||
|
|
||||||
//NumMessage("AffordableAction - Guy#",pSoldier->ubID);
|
//NumMessage("AffordableAction - Guy#",pSoldier->ubID);
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
|||||||
UINT32 uiLoop;
|
UINT32 uiLoop;
|
||||||
UINT16 usMaxDist;
|
UINT16 usMaxDist;
|
||||||
UINT8 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID;
|
UINT8 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID;
|
||||||
UINT16 usDirection;
|
UINT8 ubDirection;
|
||||||
UINT8 ubDirsLeft;
|
UINT8 ubDirsLeft;
|
||||||
BOOLEAN fDirChecked[8];
|
BOOLEAN fDirChecked[8];
|
||||||
BOOLEAN fRangeRestricted = FALSE, fFound = FALSE;
|
BOOLEAN fRangeRestricted = FALSE, fFound = FALSE;
|
||||||
@@ -663,9 +663,9 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
|||||||
// should be close enough, try to find a legal ->sDestination within 1 tile
|
// should be close enough, try to find a legal ->sDestination within 1 tile
|
||||||
|
|
||||||
// clear dirChecked flag for all 8 directions
|
// clear dirChecked flag for all 8 directions
|
||||||
for (usDirection = 0; usDirection < 8; usDirection++)
|
for (ubDirection = 0; ubDirection < 8; ubDirection++)
|
||||||
{
|
{
|
||||||
fDirChecked[usDirection] = FALSE;
|
fDirChecked[ubDirection] = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ubDirsLeft = 8;
|
ubDirsLeft = 8;
|
||||||
@@ -677,14 +677,14 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
|||||||
// randomly select a direction which hasn't been 'checked' yet
|
// randomly select a direction which hasn't been 'checked' yet
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
usDirection = (UINT16) Random(8);
|
ubDirection = (UINT8) Random(8);
|
||||||
}
|
}
|
||||||
while (fDirChecked[usDirection]);
|
while (fDirChecked[ubDirection]);
|
||||||
|
|
||||||
fDirChecked[usDirection] = TRUE;
|
fDirChecked[ubDirection] = TRUE;
|
||||||
|
|
||||||
// determine the gridno 1 tile away from current friend in this direction
|
// determine the gridno 1 tile away from current friend in this direction
|
||||||
usDest = NewGridNo(Menptr[ubFriendID].sGridNo,DirectionInc((INT16)(usDirection + 1)));
|
usDest = NewGridNo(Menptr[ubFriendID].sGridNo,DirectionInc(ubDirection));
|
||||||
|
|
||||||
// if that's out of bounds, ignore it & check next direction
|
// if that's out of bounds, ignore it & check next direction
|
||||||
if (usDest == Menptr[ubFriendID].sGridNo)
|
if (usDest == Menptr[ubFriendID].sGridNo)
|
||||||
@@ -2189,7 +2189,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ADD 5% if man's already facing me
|
// ADD 5% if man's already facing me
|
||||||
if (pEnemy->bDirection == atan8(CenterX(pEnemy->sGridNo),CenterY(pEnemy->sGridNo),CenterX(sMyGrid),CenterY(sMyGrid)))
|
if (pEnemy->ubDirection == atan8(CenterX(pEnemy->sGridNo),CenterY(pEnemy->sGridNo),CenterX(sMyGrid),CenterY(sMyGrid)))
|
||||||
{
|
{
|
||||||
iThreatValue += (iThreatValue / 20);
|
iThreatValue += (iThreatValue / 20);
|
||||||
}
|
}
|
||||||
@@ -2441,13 +2441,13 @@ BOOLEAN ValidCreatureTurn( SOLDIERTYPE * pCreature, INT8 bNewDirection )
|
|||||||
INT8 bLoop;
|
INT8 bLoop;
|
||||||
BOOLEAN fFound;
|
BOOLEAN fFound;
|
||||||
|
|
||||||
bDirChange = (INT8) QuickestDirection( pCreature->bDirection, bNewDirection );
|
bDirChange = (INT8) QuickestDirection( pCreature->ubDirection, bNewDirection );
|
||||||
|
|
||||||
for( bLoop = 0; bLoop < 2; bLoop++ )
|
for( bLoop = 0; bLoop < 2; bLoop++ )
|
||||||
{
|
{
|
||||||
fFound = TRUE;
|
fFound = TRUE;
|
||||||
|
|
||||||
bTempDir = pCreature->bDirection;
|
bTempDir = pCreature->ubDirection;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-12
@@ -399,7 +399,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
|||||||
BOOLEAN CloseEnoughForGrenadeToss( INT16 sGridNo, INT16 sGridNo2 )
|
BOOLEAN CloseEnoughForGrenadeToss( INT16 sGridNo, INT16 sGridNo2 )
|
||||||
{
|
{
|
||||||
INT16 sTempGridNo;
|
INT16 sTempGridNo;
|
||||||
INT8 bDirection;
|
UINT8 ubDirection;
|
||||||
INT16 sXPos, sYPos, sXPos2, sYPos2;
|
INT16 sXPos, sYPos, sXPos2, sYPos2;
|
||||||
UINT8 ubMovementCost;
|
UINT8 ubMovementCost;
|
||||||
|
|
||||||
@@ -407,10 +407,10 @@ BOOLEAN CloseEnoughForGrenadeToss( INT16 sGridNo, INT16 sGridNo2 )
|
|||||||
{
|
{
|
||||||
// checking the same space; if there is a closed door next to location in ANY direction then forget it
|
// checking the same space; if there is a closed door next to location in ANY direction then forget it
|
||||||
// (could be the player closed a door on us)
|
// (could be the player closed a door on us)
|
||||||
for (bDirection = 0; bDirection < NUM_WORLD_DIRECTIONS; bDirection++)
|
for (ubDirection = 0; ubDirection < NUM_WORLD_DIRECTIONS; ubDirection++)
|
||||||
{
|
{
|
||||||
sTempGridNo = NewGridNo( sGridNo, DirectionInc( bDirection ) );
|
sTempGridNo = NewGridNo( sGridNo, DirectionInc( ubDirection ) );
|
||||||
ubMovementCost = gubWorldMovementCosts[ sTempGridNo ][ bDirection ][ 0 ];
|
ubMovementCost = gubWorldMovementCosts[ sTempGridNo ][ ubDirection ][ 0 ];
|
||||||
if ( IS_TRAVELCOST_DOOR( ubMovementCost ) )
|
if ( IS_TRAVELCOST_DOOR( ubMovementCost ) )
|
||||||
{
|
{
|
||||||
ubMovementCost = DoorTravelCost( NULL, sTempGridNo, ubMovementCost, FALSE, NULL );
|
ubMovementCost = DoorTravelCost( NULL, sTempGridNo, ubMovementCost, FALSE, NULL );
|
||||||
@@ -437,14 +437,14 @@ BOOLEAN CloseEnoughForGrenadeToss( INT16 sGridNo, INT16 sGridNo2 )
|
|||||||
sYPos = CenterY( sGridNo );
|
sYPos = CenterY( sGridNo );
|
||||||
sXPos2 = CenterX( sGridNo2 );
|
sXPos2 = CenterX( sGridNo2 );
|
||||||
sYPos2 = CenterY( sGridNo2 );
|
sYPos2 = CenterY( sGridNo2 );
|
||||||
bDirection = atan8( sXPos, sYPos, sXPos2, sYPos2 );
|
ubDirection = atan8( sXPos, sYPos, sXPos2, sYPos2 );
|
||||||
|
|
||||||
// For each step of the loop, we are checking for door or obstacle movement costs. If we
|
// For each step of the loop, we are checking for door or obstacle movement costs. If we
|
||||||
// find we're blocked, then this is no good for grenade tossing!
|
// find we're blocked, then this is no good for grenade tossing!
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sTempGridNo = NewGridNo( sTempGridNo, DirectionInc( bDirection ) );
|
sTempGridNo = NewGridNo( sTempGridNo, DirectionInc( ubDirection ) );
|
||||||
ubMovementCost = gubWorldMovementCosts[ sTempGridNo ][ bDirection ][ 0 ];
|
ubMovementCost = gubWorldMovementCosts[ sTempGridNo ][ ubDirection ][ 0 ];
|
||||||
if ( IS_TRAVELCOST_DOOR( ubMovementCost ) )
|
if ( IS_TRAVELCOST_DOOR( ubMovementCost ) )
|
||||||
{
|
{
|
||||||
ubMovementCost = DoorTravelCost( NULL, sTempGridNo, ubMovementCost, FALSE, NULL );
|
ubMovementCost = DoorTravelCost( NULL, sTempGridNo, ubMovementCost, FALSE, NULL );
|
||||||
@@ -1575,6 +1575,8 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
|||||||
INT32 iTotalProt;
|
INT32 iTotalProt;
|
||||||
INT8 bPlatePos;
|
INT8 bPlatePos;
|
||||||
UINT8 ubAmmoType;
|
UINT8 ubAmmoType;
|
||||||
|
UINT16 usItem;
|
||||||
|
OBJECTTYPE *pObj;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ( pOpponent->uiStatusFlags & SOLDIER_VEHICLE )
|
if ( pOpponent->uiStatusFlags & SOLDIER_VEHICLE )
|
||||||
@@ -1584,19 +1586,22 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( Item[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].usItemClass & IC_THROWING_KNIFE )
|
pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||||
|
usItem = pObj->usItem;
|
||||||
|
|
||||||
|
if ( Item[ usItem ].usItemClass & IC_THROWING_KNIFE )
|
||||||
{
|
{
|
||||||
ubAmmoType = AMMO_KNIFE;
|
ubAmmoType = AMMO_KNIFE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ubAmmoType = pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
|
ubAmmoType = pObj->ItemData.Gun.ubGunAmmoType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate distance to target, obtain his gun's maximum range rating
|
// calculate distance to target, obtain his gun's maximum range rating
|
||||||
|
|
||||||
iRange = GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, pOpponent->sGridNo );
|
iRange = GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, pOpponent->sGridNo );
|
||||||
iMaxRange = Weapon[pSoldier->inv[HANDPOS].usItem].usRange;
|
iMaxRange = Weapon[usItem].usRange;
|
||||||
|
|
||||||
// bullet loses speed and penetrating power, 50% loss per maximum range
|
// bullet loses speed and penetrating power, 50% loss per maximum range
|
||||||
iPowerLost = ((50 * iRange) / iMaxRange);
|
iPowerLost = ((50 * iRange) / iMaxRange);
|
||||||
@@ -1604,7 +1609,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
|||||||
// up to 50% extra impact for making particularly accurate successful shots
|
// up to 50% extra impact for making particularly accurate successful shots
|
||||||
ubBonus = ubChanceToHit / 4; // /4 is really /2 and /2 again
|
ubBonus = ubChanceToHit / 4; // /4 is really /2 and /2 again
|
||||||
|
|
||||||
iDamage = ((GetDamage(&pSoldier->inv[HANDPOS])) * (100 - iPowerLost + ubBonus) / 100) ;
|
iDamage = ((GetDamage(pObj)) * (100 - iPowerLost + ubBonus) / 100) ;
|
||||||
|
|
||||||
//NumMessage("Pre-protection damage: ",damage);
|
//NumMessage("Pre-protection damage: ",damage);
|
||||||
|
|
||||||
@@ -1679,7 +1684,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
|||||||
{
|
{
|
||||||
// cheat and emphasize shots
|
// cheat and emphasize shots
|
||||||
//iDamage = (iDamage * 15) / 10;
|
//iDamage = (iDamage * 15) / 10;
|
||||||
switch( pSoldier->inv[pSoldier->ubAttackingHand].usItem )
|
switch( usItem )
|
||||||
{
|
{
|
||||||
// explosive damage is 100-200% that of the rated, so multiply by 3/2s here
|
// explosive damage is 100-200% that of the rated, so multiply by 3/2s here
|
||||||
case CREATURE_QUEEN_SPIT: //TODO: Madd - remove the hardcoding here
|
case CREATURE_QUEEN_SPIT: //TODO: Madd - remove the hardcoding here
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier )
|
|||||||
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
|
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
|
||||||
// back towards that facing 50% of the time here (normally just enemies)
|
// back towards that facing 50% of the time here (normally just enemies)
|
||||||
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
|
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
|
||||||
(pSoldier->bDirection != pSoldier->bDominantDir) && PreRandom(2))
|
(pSoldier->ubDirection != pSoldier->bDominantDir) && PreRandom(2))
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = pSoldier->bDominantDir;
|
pSoldier->usActionData = pSoldier->bDominantDir;
|
||||||
}
|
}
|
||||||
@@ -399,7 +399,7 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier )
|
|||||||
{
|
{
|
||||||
pSoldier->usActionData = (UINT16)PreRandom(8);
|
pSoldier->usActionData = (UINT16)PreRandom(8);
|
||||||
}
|
}
|
||||||
} while (pSoldier->usActionData == pSoldier->bDirection);
|
} while (pSoldier->usActionData == pSoldier->ubDirection);
|
||||||
|
|
||||||
#ifdef DEBUGDECISIONS
|
#ifdef DEBUGDECISIONS
|
||||||
STR16 tempstr;
|
STR16 tempstr;
|
||||||
@@ -479,7 +479,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
// if soldier is not already facing in that direction,
|
// if soldier is not already facing in that direction,
|
||||||
// and the noise source is close enough that it could possibly be seen
|
// and the noise source is close enough that it could possibly be seen
|
||||||
if ((GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) && (pSoldier->bDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= STRAIGHT)
|
if ((GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) && (pSoldier->ubDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= STRAIGHT)
|
||||||
{
|
{
|
||||||
// set base chance according to orders
|
// set base chance according to orders
|
||||||
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
||||||
@@ -850,7 +850,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
// note, have to change this to use the level returned from ClosestKnownOpponent
|
// note, have to change this to use the level returned from ClosestKnownOpponent
|
||||||
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0 );
|
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0 );
|
||||||
|
|
||||||
if ((pSoldier->bDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
||||||
{
|
{
|
||||||
// set base chance according to orders
|
// set base chance according to orders
|
||||||
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
||||||
@@ -1405,7 +1405,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
|
|||||||
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
||||||
|
|
||||||
// if we're not facing towards him
|
// if we're not facing towards him
|
||||||
if (pSoldier->bDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) )
|
if (pSoldier->ubDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = bDirection;
|
pSoldier->usActionData = bDirection;
|
||||||
|
|
||||||
@@ -1699,7 +1699,7 @@ INT8 CrowDecideActionGreen( SOLDIERTYPE * pSoldier )
|
|||||||
// Change facing
|
// Change facing
|
||||||
sFacingDir = GetDirectionFromGridNo( sCorpseGridNo, pSoldier );
|
sFacingDir = GetDirectionFromGridNo( sCorpseGridNo, pSoldier );
|
||||||
|
|
||||||
if ( sFacingDir != pSoldier->bDirection )
|
if ( sFacingDir != pSoldier->ubDirection )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = sFacingDir;
|
pSoldier->usActionData = sFacingDir;
|
||||||
return(AI_ACTION_CHANGE_FACING);
|
return(AI_ACTION_CHANGE_FACING);
|
||||||
|
|||||||
+21
-21
@@ -550,7 +550,7 @@ INT8 DecideActionBoxerEnteringRing(SOLDIERTYPE *pSoldier)
|
|||||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc));
|
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc));
|
||||||
|
|
||||||
// if not already facing in that direction,
|
// if not already facing in that direction,
|
||||||
if ( pSoldier->bDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if ( pSoldier->ubDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
pSoldier->usActionData = ubDesiredMercDir;
|
pSoldier->usActionData = ubDesiredMercDir;
|
||||||
@@ -610,7 +610,7 @@ INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier )
|
|||||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc));
|
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc));
|
||||||
|
|
||||||
// if not already facing in that direction,
|
// if not already facing in that direction,
|
||||||
if (pSoldier->bDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if (pSoldier->ubDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
pSoldier->usActionData = ubDesiredMercDir;
|
pSoldier->usActionData = ubDesiredMercDir;
|
||||||
@@ -754,7 +754,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
ubRingDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(CENTER_OF_RING),CenterY(CENTER_OF_RING));
|
ubRingDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(CENTER_OF_RING),CenterY(CENTER_OF_RING));
|
||||||
if ( gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
if ( gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bDirection != ubRingDir )
|
if ( pSoldier->ubDirection != ubRingDir )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = ubRingDir;
|
pSoldier->usActionData = ubRingDir;
|
||||||
return( AI_ACTION_CHANGE_FACING );
|
return( AI_ACTION_CHANGE_FACING );
|
||||||
@@ -1220,7 +1220,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
|
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
|
||||||
// back towards that facing 50% of the time here (normally just enemies)
|
// back towards that facing 50% of the time here (normally just enemies)
|
||||||
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
|
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
|
||||||
(pSoldier->bDirection != pSoldier->bDominantDir) && PreRandom(2) && pSoldier->bOrders != SNIPER )
|
(pSoldier->ubDirection != pSoldier->bDominantDir) && PreRandom(2) && pSoldier->bOrders != SNIPER )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = pSoldier->bDominantDir;
|
pSoldier->usActionData = pSoldier->bDominantDir;
|
||||||
}
|
}
|
||||||
@@ -1234,7 +1234,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
if (sNoiseGridNo == NOWHERE ||
|
if (sNoiseGridNo == NOWHERE ||
|
||||||
(ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sNoiseGridNo),CenterY(sNoiseGridNo))
|
(ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sNoiseGridNo),CenterY(sNoiseGridNo))
|
||||||
) == pSoldier->bDirection )
|
) == pSoldier->ubDirection )
|
||||||
|
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = (UINT16)PreRandom(8);
|
pSoldier->usActionData = (UINT16)PreRandom(8);
|
||||||
@@ -1244,7 +1244,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
pSoldier->usActionData = ubNoiseDir;
|
pSoldier->usActionData = ubNoiseDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (pSoldier->usActionData == pSoldier->bDirection);
|
} while (pSoldier->usActionData == pSoldier->ubDirection);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUGDECISIONS
|
#ifdef DEBUGDECISIONS
|
||||||
@@ -1355,7 +1355,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
// and the noise source is close enough that it could possibly be seen
|
// and the noise source is close enough that it could possibly be seen
|
||||||
if ( !gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
if ( !gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
||||||
{
|
{
|
||||||
if ((pSoldier->bDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= pSoldier->GetMaxDistanceVisible(sNoiseGridNo) )
|
if ((pSoldier->ubDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= pSoldier->GetMaxDistanceVisible(sNoiseGridNo) )
|
||||||
{
|
{
|
||||||
// set base chance according to orders
|
// set base chance according to orders
|
||||||
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD) )
|
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD) )
|
||||||
@@ -2154,10 +2154,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
// if firing mortar make sure we have room
|
// if firing mortar make sure we have room
|
||||||
if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar )
|
if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar )
|
||||||
{
|
{
|
||||||
ubOpponentDir = (UINT8)GetDirectionFromGridNo( BestThrow.sTarget, pSoldier );
|
ubOpponentDir = GetDirectionFromGridNo( BestThrow.sTarget, pSoldier );
|
||||||
|
|
||||||
// Get new gridno!
|
// Get new gridno!
|
||||||
sCheckGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( ubOpponentDir ) );
|
sCheckGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( ubOpponentDir ) );
|
||||||
|
|
||||||
if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, ubOpponentDir, pSoldier->usAnimState ) )
|
if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, ubOpponentDir, pSoldier->usAnimState ) )
|
||||||
{
|
{
|
||||||
@@ -2181,10 +2181,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
BestThrow.ubPossible = FALSE;
|
BestThrow.ubPossible = FALSE;
|
||||||
|
|
||||||
// try behind us, see if there's room to move back
|
// try behind us, see if there's room to move back
|
||||||
sCheckGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( gOppositeDirection[ ubOpponentDir ] ) );
|
sCheckGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( gOppositeDirection[ ubOpponentDir ] ) );
|
||||||
if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) )
|
if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = sCheckGridNo;
|
pSoldier->usActionData = (UINT16) sCheckGridNo;
|
||||||
|
|
||||||
return( AI_ACTION_GET_CLOSER );
|
return( AI_ACTION_GET_CLOSER );
|
||||||
}
|
}
|
||||||
@@ -2909,7 +2909,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
|
|
||||||
// if soldier is not already facing in that direction,
|
// if soldier is not already facing in that direction,
|
||||||
// and the opponent is close enough that he could possibly be seen
|
// and the opponent is close enough that he could possibly be seen
|
||||||
if ( pSoldier->bDirection != ubOpponentDir && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if ( pSoldier->ubDirection != ubOpponentDir && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
// turn
|
// turn
|
||||||
pSoldier->usActionData = ubOpponentDir;
|
pSoldier->usActionData = ubOpponentDir;
|
||||||
@@ -3162,7 +3162,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
// note, have to change this to use the level returned from ClosestKnownOpponent
|
// note, have to change this to use the level returned from ClosestKnownOpponent
|
||||||
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0, CALC_FROM_ALL_DIRS );
|
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0, CALC_FROM_ALL_DIRS );
|
||||||
|
|
||||||
if ((pSoldier->bDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
||||||
{
|
{
|
||||||
// set base chance according to orders
|
// set base chance according to orders
|
||||||
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
||||||
@@ -3197,7 +3197,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
return(AI_ACTION_CHANGE_FACING);
|
return(AI_ACTION_CHANGE_FACING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bDirection == ubOpponentDir && pSoldier->bOrders == SNIPER )
|
else if ( pSoldier->ubDirection == ubOpponentDir && pSoldier->bOrders == SNIPER )
|
||||||
{
|
{
|
||||||
if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints)
|
if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints)
|
||||||
{
|
{
|
||||||
@@ -3216,7 +3216,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
if ( sClosestDisturbance != NOWHERE )
|
if ( sClosestDisturbance != NOWHERE )
|
||||||
{
|
{
|
||||||
ubOpponentDir = atan8( CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), CenterX( sClosestDisturbance ), CenterY( sClosestDisturbance ) );
|
ubOpponentDir = atan8( CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), CenterX( sClosestDisturbance ), CenterY( sClosestDisturbance ) );
|
||||||
if ( pSoldier->bDirection == ubOpponentDir )
|
if ( pSoldier->ubDirection == ubOpponentDir )
|
||||||
{
|
{
|
||||||
ubOpponentDir = (UINT8) PreRandom( NUM_WORLD_DIRECTIONS );
|
ubOpponentDir = (UINT8) PreRandom( NUM_WORLD_DIRECTIONS );
|
||||||
}
|
}
|
||||||
@@ -3226,7 +3226,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
ubOpponentDir = (UINT8) PreRandom( NUM_WORLD_DIRECTIONS );
|
ubOpponentDir = (UINT8) PreRandom( NUM_WORLD_DIRECTIONS );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (pSoldier->bDirection != ubOpponentDir) )
|
if ( (pSoldier->ubDirection != ubOpponentDir) )
|
||||||
{
|
{
|
||||||
if ( (pSoldier->bActionPoints == pSoldier->bInitialActionPoints || (INT16)PreRandom(100) < 60) && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if ( (pSoldier->bActionPoints == pSoldier->bInitialActionPoints || (INT16)PreRandom(100) < 60) && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
@@ -3365,7 +3365,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
if ( sClosestDisturbance != NOWHERE )
|
if ( sClosestDisturbance != NOWHERE )
|
||||||
{
|
{
|
||||||
ubOpponentDir = atan8( CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), CenterX( sClosestDisturbance ), CenterY( sClosestDisturbance ) );
|
ubOpponentDir = atan8( CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), CenterX( sClosestDisturbance ), CenterY( sClosestDisturbance ) );
|
||||||
if ( pSoldier->bDirection != ubOpponentDir )
|
if ( pSoldier->ubDirection != ubOpponentDir )
|
||||||
{
|
{
|
||||||
if ( !gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
if ( !gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints )
|
||||||
{
|
{
|
||||||
@@ -4277,7 +4277,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
|||||||
if (ubBestStance != 0)
|
if (ubBestStance != 0)
|
||||||
{
|
{
|
||||||
// change stance first!
|
// change stance first!
|
||||||
if ( pSoldier->bDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if ( pSoldier->ubDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
// we're not facing towards him, so turn first!
|
// we're not facing towards him, so turn first!
|
||||||
pSoldier->usActionData = bDirection;
|
pSoldier->usActionData = bDirection;
|
||||||
@@ -4632,7 +4632,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
|||||||
if ( pSoldier->usActionData != NOWHERE )
|
if ( pSoldier->usActionData != NOWHERE )
|
||||||
{
|
{
|
||||||
// truncate path to 1 step
|
// truncate path to 1 step
|
||||||
pSoldier->usActionData = pSoldier->sGridNo + DirectionInc( pSoldier->usPathingData[0] );
|
pSoldier->usActionData = pSoldier->sGridNo + DirectionInc( (UINT8) pSoldier->usPathingData[0] );
|
||||||
pSoldier->sFinalDestination = pSoldier->usActionData;
|
pSoldier->sFinalDestination = pSoldier->usActionData;
|
||||||
pSoldier->bNextAction = AI_ACTION_END_TURN;
|
pSoldier->bNextAction = AI_ACTION_END_TURN;
|
||||||
return( AI_ACTION_GET_CLOSER );
|
return( AI_ACTION_GET_CLOSER );
|
||||||
@@ -4749,7 +4749,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
|||||||
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
||||||
|
|
||||||
// if we're not facing towards him
|
// if we're not facing towards him
|
||||||
if (pSoldier->bDirection != bDirection)
|
if (pSoldier->ubDirection != bDirection)
|
||||||
{
|
{
|
||||||
if ( InternalIsValidStance( pSoldier, bDirection, (INT8) pSoldier->usActionData) )
|
if ( InternalIsValidStance( pSoldier, bDirection, (INT8) pSoldier->usActionData) )
|
||||||
{
|
{
|
||||||
@@ -4807,7 +4807,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
|||||||
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
|
||||||
|
|
||||||
// if we're not facing towards him
|
// if we're not facing towards him
|
||||||
if ( pSoldier->bDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
if ( pSoldier->ubDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = bDirection;
|
pSoldier->usActionData = bDirection;
|
||||||
|
|
||||||
|
|||||||
@@ -998,7 +998,7 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier )
|
|||||||
ubBestStrength = ubStrength;
|
ubBestStrength = ubStrength;
|
||||||
bDir = atan8( (INT16) iXStart, (INT16) iYStart, (INT16) (iXStart + iXDiff), (INT16) (iYStart + iYDiff) );
|
bDir = atan8( (INT16) iXStart, (INT16) iYStart, (INT16) (iXStart + iXDiff), (INT16) (iYStart + iYDiff) );
|
||||||
// now convert it into a difference in degree between it and our current dir
|
// now convert it into a difference in degree between it and our current dir
|
||||||
ubBestDirDiff = abs( pSoldier->bDirection - bDir );
|
ubBestDirDiff = abs( pSoldier->ubDirection - bDir );
|
||||||
if (ubBestDirDiff > 4 ) // dir 0 compared with dir 6, for instance
|
if (ubBestDirDiff > 4 ) // dir 0 compared with dir 6, for instance
|
||||||
{
|
{
|
||||||
ubBestDirDiff = 8 - ubBestDirDiff;
|
ubBestDirDiff = 8 - ubBestDirDiff;
|
||||||
@@ -1018,7 +1018,7 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier )
|
|||||||
// start by calculating direction to the new gridno
|
// start by calculating direction to the new gridno
|
||||||
bDir = atan8( (INT16) iXStart, (INT16) iYStart, (INT16) (iXStart + iXDiff), (INT16) (iYStart + iYDiff) );
|
bDir = atan8( (INT16) iXStart, (INT16) iYStart, (INT16) (iXStart + iXDiff), (INT16) (iYStart + iYDiff) );
|
||||||
// now convert it into a difference in degree between it and our current dir
|
// now convert it into a difference in degree between it and our current dir
|
||||||
ubDirDiff = abs( pSoldier->bDirection - bDir );
|
ubDirDiff = abs( pSoldier->ubDirection - bDir );
|
||||||
if (ubDirDiff > 4 ) // dir 0 compared with dir 6, for instance
|
if (ubDirDiff > 4 ) // dir 0 compared with dir 6, for instance
|
||||||
{
|
{
|
||||||
ubDirDiff = 8 - ubDirDiff;
|
ubDirDiff = 8 - ubDirDiff;
|
||||||
|
|||||||
+19
-19
@@ -44,7 +44,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
UINT32 uiLoop2;
|
UINT32 uiLoop2;
|
||||||
INT16 sTempGridNo, sNextTempGridNo, sVeryTemporaryGridNo;
|
INT16 sTempGridNo, sNextTempGridNo, sVeryTemporaryGridNo;
|
||||||
INT16 sStartGridNo, sCurrGridNo, sPrevGridNo = NOWHERE, sRightGridNo;
|
INT16 sStartGridNo, sCurrGridNo, sPrevGridNo = NOWHERE, sRightGridNo;
|
||||||
INT8 bDirection, bTempDirection;
|
UINT8 ubDirection, ubTempDirection;
|
||||||
BOOLEAN fFoundDir, fFoundWall;
|
BOOLEAN fFoundDir, fFoundWall;
|
||||||
UINT32 uiChanceIn = ROOF_LOCATION_CHANCE; // chance of a location being considered
|
UINT32 uiChanceIn = ROOF_LOCATION_CHANCE; // chance of a location being considered
|
||||||
INT16 sWallGridNo;
|
INT16 sWallGridNo;
|
||||||
@@ -77,13 +77,13 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
RoofReachableTest( sDesiredSpot, ubBuildingID );
|
RoofReachableTest( sDesiredSpot, ubBuildingID );
|
||||||
|
|
||||||
// From sGridNo, search until we find a spot that isn't part of the building
|
// From sGridNo, search until we find a spot that isn't part of the building
|
||||||
bDirection = NORTHWEST;
|
ubDirection = NORTHWEST;
|
||||||
sTempGridNo = sDesiredSpot;
|
sTempGridNo = sDesiredSpot;
|
||||||
// using diagonal directions to hopefully prevent picking a
|
// using diagonal directions to hopefully prevent picking a
|
||||||
// spot that
|
// spot that
|
||||||
while( (gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE ) )
|
while( (gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE ) )
|
||||||
{
|
{
|
||||||
sNextTempGridNo = NewGridNo( sTempGridNo, DirectionInc( bDirection ) );
|
sNextTempGridNo = NewGridNo( sTempGridNo, DirectionInc( ubDirection ) );
|
||||||
if ( sTempGridNo == sNextTempGridNo )
|
if ( sTempGridNo == sNextTempGridNo )
|
||||||
{
|
{
|
||||||
// hit edge of map!??!
|
// hit edge of map!??!
|
||||||
@@ -103,12 +103,12 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
if ( gpWorldLevelData[ sVeryTemporaryGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
if ( gpWorldLevelData[ sVeryTemporaryGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
||||||
{
|
{
|
||||||
// go north first
|
// go north first
|
||||||
bDirection = NORTH;
|
ubDirection = NORTH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// go that way (east)
|
// go that way (east)
|
||||||
bDirection = EAST;
|
ubDirection = EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpWorldLevelData[ sStartGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_ROOFCODE_VISITED;
|
gpWorldLevelData[ sStartGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_ROOFCODE_VISITED;
|
||||||
@@ -118,7 +118,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
{
|
{
|
||||||
// if point to (2 clockwise) is not part of building and is not visited,
|
// if point to (2 clockwise) is not part of building and is not visited,
|
||||||
// or is starting point, turn!
|
// or is starting point, turn!
|
||||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ bDirection ] ) );
|
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||||
sTempGridNo = sRightGridNo;
|
sTempGridNo = sRightGridNo;
|
||||||
if ( ( ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) ) || (sTempGridNo == sStartGridNo) ) && (sCurrGridNo != sStartGridNo) )
|
if ( ( ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) ) || (sTempGridNo == sStartGridNo) ) && (sCurrGridNo != sStartGridNo) )
|
||||||
{
|
{
|
||||||
@@ -128,47 +128,47 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
{
|
{
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
bDirection = gTwoCDirection[ bDirection ];
|
ubDirection = gTwoCDirection[ ubDirection ];
|
||||||
// try in that direction
|
// try in that direction
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
iLoopCount = 0;
|
iLoopCount = 0;
|
||||||
|
|
||||||
// if spot ahead is part of building, turn
|
// if spot ahead is part of building, turn
|
||||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bDirection ) );
|
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubDirection ) );
|
||||||
if ( gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
if ( gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
||||||
{
|
{
|
||||||
// first search for a spot that is neither part of the building or visited
|
// first search for a spot that is neither part of the building or visited
|
||||||
|
|
||||||
// we KNOW that the spot in the original direction is blocked, so only loop 3 times
|
// we KNOW that the spot in the original direction is blocked, so only loop 3 times
|
||||||
bTempDirection = gTwoCDirection[ bDirection ];
|
ubTempDirection = gTwoCDirection[ ubDirection ];
|
||||||
fFoundDir = FALSE;
|
fFoundDir = FALSE;
|
||||||
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
||||||
{
|
{
|
||||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bTempDirection ) );
|
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubTempDirection ) );
|
||||||
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) )
|
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) )
|
||||||
{
|
{
|
||||||
// this is the way to go!
|
// this is the way to go!
|
||||||
fFoundDir = TRUE;
|
fFoundDir = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bTempDirection = gTwoCDirection[ bTempDirection ];
|
ubTempDirection = gTwoCDirection[ ubTempDirection ];
|
||||||
}
|
}
|
||||||
if (!fFoundDir)
|
if (!fFoundDir)
|
||||||
{
|
{
|
||||||
// now search for a spot that is just not part of the building
|
// now search for a spot that is just not part of the building
|
||||||
bTempDirection = gTwoCDirection[ bDirection ];
|
ubTempDirection = gTwoCDirection[ ubDirection ];
|
||||||
fFoundDir = FALSE;
|
fFoundDir = FALSE;
|
||||||
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
||||||
{
|
{
|
||||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bTempDirection ) );
|
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubTempDirection ) );
|
||||||
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) )
|
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) )
|
||||||
{
|
{
|
||||||
// this is the way to go!
|
// this is the way to go!
|
||||||
fFoundDir = TRUE;
|
fFoundDir = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bTempDirection = gTwoCDirection[ bTempDirection ];
|
ubTempDirection = gTwoCDirection[ ubTempDirection ];
|
||||||
}
|
}
|
||||||
if (!fFoundDir)
|
if (!fFoundDir)
|
||||||
{
|
{
|
||||||
@@ -176,7 +176,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bDirection = bTempDirection;
|
ubDirection = ubTempDirection;
|
||||||
// try in that direction
|
// try in that direction
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
// move ahead
|
// move ahead
|
||||||
sPrevGridNo = sCurrGridNo;
|
sPrevGridNo = sCurrGridNo;
|
||||||
sCurrGridNo = sTempGridNo;
|
sCurrGridNo = sTempGridNo;
|
||||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ bDirection ] ) );
|
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||||
|
|
||||||
#ifdef ROOF_DEBUG
|
#ifdef ROOF_DEBUG
|
||||||
if (gsCoverValue[sCurrGridNo] == 0x7F7F)
|
if (gsCoverValue[sCurrGridNo] == 0x7F7F)
|
||||||
@@ -219,7 +219,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
// if south or west, the wall would be in the gridno two clockwise
|
// if south or west, the wall would be in the gridno two clockwise
|
||||||
fFoundWall = FALSE;
|
fFoundWall = FALSE;
|
||||||
|
|
||||||
switch( bDirection )
|
switch( ubDirection )
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
sWallGridNo = sCurrGridNo;
|
sWallGridNo = sCurrGridNo;
|
||||||
@@ -230,11 +230,11 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
|||||||
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ bDirection ] ) );
|
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||||
bDesiredOrientation = OUTSIDE_TOP_RIGHT;
|
bDesiredOrientation = OUTSIDE_TOP_RIGHT;
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ bDirection ] ) );
|
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||||
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion )
|
|||||||
AniParams.sStartFrame = pExplosion->sCurrentFrame;
|
AniParams.sStartFrame = pExplosion->sCurrentFrame;
|
||||||
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_EXPLOSION;
|
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_EXPLOSION;
|
||||||
|
|
||||||
if ( ubTerrainType == LOW_WATER || ubTerrainType == MED_WATER || ubTerrainType == DEEP_WATER )
|
if ( TERRAIN_IS_WATER(ubTerrainType) )
|
||||||
{
|
{
|
||||||
// Change type to water explosion...
|
// Change type to water explosion...
|
||||||
ubTypeID = WATER_BLAST;
|
ubTypeID = WATER_BLAST;
|
||||||
@@ -1209,7 +1209,6 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
|
|||||||
|
|
||||||
STRUCTURE *gStruct;
|
STRUCTURE *gStruct;
|
||||||
|
|
||||||
// Lesh: somewhere here once I got CTD when militia stepped on mine in cambria sam
|
|
||||||
void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
|
void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
|
||||||
{
|
{
|
||||||
STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
|
STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
|
||||||
@@ -1233,7 +1232,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
|||||||
// (1) we might need to destroy the currently-examined structure
|
// (1) we might need to destroy the currently-examined structure
|
||||||
while (pCurrent != NULL)
|
while (pCurrent != NULL)
|
||||||
{
|
{
|
||||||
// ATE: These are for the chacks below for multi-structs....
|
// ATE: These are for the checks below for multi-structs....
|
||||||
pBaseStructure = FindBaseStructure( pCurrent );
|
pBaseStructure = FindBaseStructure( pCurrent );
|
||||||
|
|
||||||
if ( pBaseStructure )
|
if ( pBaseStructure )
|
||||||
@@ -1243,7 +1242,6 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
|||||||
fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 );
|
fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 );
|
||||||
ppTile = (DB_STRUCTURE_TILE **) MemAlloc( sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
ppTile = (DB_STRUCTURE_TILE **) MemAlloc( sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
||||||
|
|
||||||
// Lesh: CTD was in next line once
|
|
||||||
memcpy( ppTile, pBaseStructure->pDBStructureRef->ppTile, sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
memcpy( ppTile, pBaseStructure->pDBStructureRef->ppTile, sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
||||||
|
|
||||||
if ( bMultiStructSpecialFlag == -1 )
|
if ( bMultiStructSpecialFlag == -1 )
|
||||||
@@ -1271,7 +1269,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
|||||||
{
|
{
|
||||||
fExplodeDamageReturn = ExplosiveDamageStructureAtGridNo( pCurrent, &pNextCurrent, sGridNo, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, 0, ubOwner, bLevel );
|
fExplodeDamageReturn = ExplosiveDamageStructureAtGridNo( pCurrent, &pNextCurrent, sGridNo, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, 0, ubOwner, bLevel );
|
||||||
|
|
||||||
// Are we overwritting damage due to multi-tile...?
|
// Are we overwriting damage due to multi-tile...?
|
||||||
if ( fExplodeDamageReturn )
|
if ( fExplodeDamageReturn )
|
||||||
{
|
{
|
||||||
if ( fSubSequentMultiTilesTransitionDamage == 2)
|
if ( fSubSequentMultiTilesTransitionDamage == 2)
|
||||||
@@ -1288,65 +1286,74 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
|||||||
{
|
{
|
||||||
fToBreak = TRUE;
|
fToBreak = TRUE;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
// OK, for multi-structs...
|
// 0verhaul: The following was combined with the previous code block. I don't think they intended to execute this
|
||||||
// AND we took damage...
|
// part unless fExplodeDamageReturn was actually set. When it was being executed, tossing a grenade just behind the
|
||||||
if ( fMultiStructure && !fOnlyWalls && fExplodeDamageReturn == 0 )
|
// plane in Drassen, for instance, would cause an infinite recursion in this code. The reason is that the plane's
|
||||||
{
|
// armor is (amazingly enough) stronger than a grenade blast can even damage. This code here seems to rely on the
|
||||||
// ATE: Don't after first attack...
|
// structure in question being destroyed by the blast since it indiscriminently recurses on neighbors, creating a
|
||||||
if ( uiDist > 1 )
|
// ping pong on two adjacent parts of the plane. Probably the reason this was not found before is that fExplodeDamageReturn
|
||||||
|
// was uninitialized before and usually was non-zero. Now it is initialized to false.
|
||||||
|
|
||||||
|
// OK, for multi-structs...
|
||||||
|
// AND we took damage...
|
||||||
|
if ( fMultiStructure && !fOnlyWalls && fExplodeDamageReturn == 0 )
|
||||||
{
|
{
|
||||||
if ( pBaseStructure )
|
// ATE: Don't after first attack...
|
||||||
|
if ( uiDist > 1 )
|
||||||
{
|
{
|
||||||
MemFree( ppTile );
|
if ( pBaseStructure )
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
|
|
||||||
{
|
|
||||||
sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
|
|
||||||
|
|
||||||
// look in adjacent tiles
|
|
||||||
for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ )
|
|
||||||
{
|
{
|
||||||
sNewGridNo2 = NewGridNo( sNewGridNo, DirectionInc( ubLoop2 ) );
|
MemFree( ppTile );
|
||||||
if ( sNewGridNo2 != sNewGridNo && sNewGridNo2 != sGridNo )
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
|
||||||
|
{
|
||||||
|
sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
|
||||||
|
|
||||||
|
// look in adjacent tiles
|
||||||
|
for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ )
|
||||||
{
|
{
|
||||||
pStructure = FindStructure( sNewGridNo2, STRUCTURE_MULTI );
|
sNewGridNo2 = NewGridNo( sNewGridNo, DirectionInc( ubLoop2 ) );
|
||||||
if ( pStructure )
|
if ( sNewGridNo2 != sNewGridNo && sNewGridNo2 != sGridNo )
|
||||||
{
|
{
|
||||||
fMultiStructSpecialFlag = ( ( pStructure->fFlags & STRUCTURE_SPECIAL ) != 0 );
|
pStructure = FindStructure( sNewGridNo2, STRUCTURE_MULTI );
|
||||||
|
if ( pStructure )
|
||||||
if ( ( bMultiStructSpecialFlag == fMultiStructSpecialFlag ) )
|
|
||||||
{
|
{
|
||||||
// If we just damaged it, use same damage value....
|
fMultiStructSpecialFlag = ( ( pStructure->fFlags & STRUCTURE_SPECIAL ) != 0 );
|
||||||
if ( fMultiStructSpecialFlag )
|
|
||||||
{
|
|
||||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 1, ubOwner, bLevel );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 2, ubOwner, bLevel );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ( ( bMultiStructSpecialFlag == fMultiStructSpecialFlag ) )
|
||||||
{
|
{
|
||||||
InternalIgniteExplosion( ubOwner, CenterX( sNewGridNo2 ), CenterY( sNewGridNo2 ), 0, sNewGridNo2, RDX, FALSE, bLevel );
|
// If we just damaged it, use same damage value....
|
||||||
}
|
if ( fMultiStructSpecialFlag )
|
||||||
|
{
|
||||||
|
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 1, ubOwner, bLevel );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 2, ubOwner, bLevel );
|
||||||
|
}
|
||||||
|
|
||||||
fToBreak = TRUE;
|
{
|
||||||
|
InternalIgniteExplosion( ubOwner, CenterX( sNewGridNo2 ), CenterY( sNewGridNo2 ), 0, sNewGridNo2, RDX, FALSE, bLevel );
|
||||||
|
}
|
||||||
|
|
||||||
|
fToBreak = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if ( fToBreak )
|
||||||
if ( fToBreak )
|
{
|
||||||
{
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2862,7 +2869,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
|
|||||||
{
|
{
|
||||||
|
|
||||||
// stop the merc...
|
// stop the merc...
|
||||||
EVENT_StopMerc( MercPtrs[ ubID ], MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->bDirection );
|
EVENT_StopMerc( MercPtrs[ ubID ], MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection );
|
||||||
|
|
||||||
switch( sGridNo )
|
switch( sGridNo )
|
||||||
{
|
{
|
||||||
@@ -3673,7 +3680,7 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL
|
|||||||
INT8 bNumTurns;
|
INT8 bNumTurns;
|
||||||
UINT16 usHeadItem1, usHeadItem2;
|
UINT16 usHeadItem1, usHeadItem2;
|
||||||
|
|
||||||
bNumTurns = FindNumTurnsBetweenDirs(pSoldier->bDirection, ubExplosionDir);
|
bNumTurns = FindNumTurnsBetweenDirs(pSoldier->ubDirection, ubExplosionDir);
|
||||||
usHeadItem1 = pSoldier->inv[ HEAD1POS ].usItem;
|
usHeadItem1 = pSoldier->inv[ HEAD1POS ].usItem;
|
||||||
usHeadItem2 = pSoldier->inv[ HEAD2POS ].usItem;
|
usHeadItem2 = pSoldier->inv[ HEAD2POS ].usItem;
|
||||||
|
|
||||||
|
|||||||
@@ -549,9 +549,9 @@ INT16 NewGridNo(INT16 sGridno, INT16 sDirInc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INT16 DirectionInc(INT16 sDirection)
|
INT16 DirectionInc(UINT8 ubDirection)
|
||||||
{
|
{
|
||||||
if ((sDirection < 0) || (sDirection > 7))
|
if ((ubDirection < 0) || (ubDirection > 7))
|
||||||
{
|
{
|
||||||
|
|
||||||
//#ifdef BETAVERSION
|
//#ifdef BETAVERSION
|
||||||
@@ -559,11 +559,11 @@ INT16 DirectionInc(INT16 sDirection)
|
|||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//direction = random(8); // replace garbage with random direction
|
//direction = random(8); // replace garbage with random direction
|
||||||
sDirection = 1;
|
ubDirection = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return(DirIncrementer[sDirection]);
|
return(DirIncrementer[ubDirection]);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY)
|
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
|||||||
|
|
||||||
// GRID NO MANIPULATION FUNCTIONS
|
// GRID NO MANIPULATION FUNCTIONS
|
||||||
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc);
|
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc);
|
||||||
INT16 DirectionInc(INT16 sDirection);
|
INT16 DirectionInc(UINT8 ubDirection);
|
||||||
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
|
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
|
|||||||
psArray = psTempArray;
|
psArray = psTempArray;
|
||||||
for (i = 0; i < usArraySize; i++)
|
for (i = 0; i < usArraySize; i++)
|
||||||
{
|
{
|
||||||
if (GetTerrainType(psArray[ i ]) == MED_WATER || GetTerrainType(psArray[ i ]) == DEEP_WATER)
|
if (TERRAIN_IS_HIGH_WATER( GetTerrainType(psArray[ i ]) ) )
|
||||||
{
|
{
|
||||||
if (i == usArraySize - 1)
|
if (i == usArraySize - 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1145,6 +1145,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
|||||||
if( uiNumBytesRead != uiFileSize )
|
if( uiNumBytesRead != uiFileSize )
|
||||||
{
|
{
|
||||||
FileClose( hFile );
|
FileClose( hFile );
|
||||||
|
MemFree( pTempArrayOfMaps);
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,6 +1181,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
|||||||
if( hFile == 0 )
|
if( hFile == 0 )
|
||||||
{
|
{
|
||||||
//Error opening map modification file,
|
//Error opening map modification file,
|
||||||
|
MemFree( pTempArrayOfMaps);
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1188,11 +1190,14 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
|||||||
if( uiNumBytesWritten != uiFileSize )
|
if( uiNumBytesWritten != uiFileSize )
|
||||||
{
|
{
|
||||||
FileClose( hFile );
|
FileClose( hFile );
|
||||||
|
MemFree( pTempArrayOfMaps);
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
FileClose( hFile );
|
FileClose( hFile );
|
||||||
|
|
||||||
|
MemFree( pTempArrayOfMaps);
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,14 +359,16 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng
|
|||||||
MAP_ELEMENT * pMapElement;
|
MAP_ELEMENT * pMapElement;
|
||||||
UINT8 ubOldStrength=0;
|
UINT8 ubOldStrength=0;
|
||||||
UINT8 ubNewStrength=0;
|
UINT8 ubNewStrength=0;
|
||||||
|
UINT8 bOverTerrainType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dropping some blood;
|
* Dropping some blood;
|
||||||
* We can check the type of blood by consulting the type in the smell byte
|
* We can check the type of blood by consulting the type in the smell byte
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bOverTerrainType = GetTerrainType( sGridNo);
|
||||||
// If we are in water...
|
// If we are in water...
|
||||||
if ( GetTerrainType( sGridNo ) == DEEP_WATER || GetTerrainType( sGridNo ) == LOW_WATER || GetTerrainType( sGridNo ) == MED_WATER )
|
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -831,6 +831,8 @@ void KillTacticalPlacementGUI()
|
|||||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Substituted different entry side due to invalid entry points or map edgepoints. KM, LC : 1" );
|
ScreenMsg( FONT_RED, MSG_ERROR, L"Substituted different entry side due to invalid entry points or map edgepoints. KM, LC : 1" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MemFree( gMercPlacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChooseRandomEdgepoints()
|
void ChooseRandomEdgepoints()
|
||||||
@@ -1178,7 +1180,7 @@ void PutDownMercPiece( INT32 iPlacement )
|
|||||||
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
|
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
|
||||||
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
|
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
|
||||||
EVENT_SetSoldierDirection( pSoldier, ubDirection );
|
EVENT_SetSoldierDirection( pSoldier, ubDirection );
|
||||||
pSoldier->ubInsertionDirection = pSoldier->bDirection;
|
pSoldier->ubInsertionDirection = pSoldier->ubDirection;
|
||||||
gMercPlacement[ iPlacement ].fPlaced = TRUE;
|
gMercPlacement[ iPlacement ].fPlaced = TRUE;
|
||||||
gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE;
|
gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2297,7 +2297,7 @@ void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID )
|
|||||||
sDamage = 1;
|
sDamage = 1;
|
||||||
sBreath = 0;
|
sBreath = 0;
|
||||||
|
|
||||||
EVENT_SoldierGotHit( pSoldier, NOTHING, sDamage, sBreath, pSoldier->bDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE );
|
EVENT_SoldierGotHit( pSoldier, NOTHING, sDamage, sBreath, pSoldier->ubDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE );
|
||||||
|
|
||||||
pObject->ubLastTargetTakenDamage = (UINT8)( usStructureID );
|
pObject->ubLastTargetTakenDamage = (UINT8)( usStructureID );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1602,7 +1602,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sMultiTransShadowZBlitterIndex = gOneCDirection[ pSoldier->bDirection ];
|
sMultiTransShadowZBlitterIndex = gOneCDirection[ pSoldier->ubDirection ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+10
-6
@@ -108,20 +108,20 @@ typedef struct
|
|||||||
UINT8 bZOffsetY;
|
UINT8 bZOffsetY;
|
||||||
|
|
||||||
// This union contains different data based on tile type
|
// This union contains different data based on tile type
|
||||||
union
|
// union
|
||||||
{
|
// {
|
||||||
// Land and overlay type
|
// Land and overlay type
|
||||||
struct
|
// struct
|
||||||
{
|
// {
|
||||||
INT16 sOffsetHeight;
|
INT16 sOffsetHeight;
|
||||||
UINT16 usWallOrientation;
|
UINT16 usWallOrientation;
|
||||||
UINT8 ubFullTile;
|
UINT8 ubFullTile;
|
||||||
|
|
||||||
// For animated tiles
|
// For animated tiles
|
||||||
TILE_ANIMATION_DATA *pAnimData;
|
TILE_ANIMATION_DATA *pAnimData;
|
||||||
};
|
// };
|
||||||
|
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Reserved for added room and 32-byte boundaries
|
// Reserved for added room and 32-byte boundaries
|
||||||
BYTE bReserved[ 3 ];
|
BYTE bReserved[ 3 ];
|
||||||
@@ -139,6 +139,10 @@ typedef struct
|
|||||||
} land_undo_struct;
|
} land_undo_struct;
|
||||||
|
|
||||||
|
|
||||||
|
#define TERRAIN_IS_WATER(x) ((x) == LOW_WATER || (x) == MED_WATER || (x) == DEEP_WATER)
|
||||||
|
#define TERRAIN_IS_SHALLOW_WATER(x) ((x) == LOW_WATER || (x) == MED_WATER)
|
||||||
|
#define TERRAIN_IS_HIGH_WATER(x) ((x) == MED_WATER || (x) == DEEP_WATER)
|
||||||
|
#define TERRAIN_IS_DEEP_WATER(x) ((x) == DEEP_WATER)
|
||||||
|
|
||||||
// Globals used
|
// Globals used
|
||||||
extern TILE_ELEMENT gTileDatabase[ NUMBEROFTILES ];
|
extern TILE_ELEMENT gTileDatabase[ NUMBEROFTILES ];
|
||||||
|
|||||||
@@ -3295,6 +3295,9 @@ void TrashWorld( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset attack busy since a militia might have been in the middle of radioing
|
||||||
|
gTacticalStatus.ubAttackBusyCount = 0;
|
||||||
|
|
||||||
RemoveCorpses( );
|
RemoveCorpses( );
|
||||||
|
|
||||||
// Remove all ani tiles...
|
// Remove all ani tiles...
|
||||||
|
|||||||
@@ -2208,18 +2208,18 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ] ), pSoldier->pLevelNode );
|
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode );
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if ( fReturn == FALSE )
|
if ( fReturn == FALSE )
|
||||||
{
|
{
|
||||||
// try to add default
|
// try to add default
|
||||||
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"FAILED: add struct info for merc: %d, at %d direction %d, trying default instead", pSoldier->ubID, sGridNo, pSoldier->bDirection );
|
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"FAILED: add struct info for merc: %d, at %d direction %d, trying default instead", pSoldier->ubID, sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
pStructureFileRef = GetDefaultStructureRef( pSoldier->ubID );
|
pStructureFileRef = GetDefaultStructureRef( pSoldier->ubID );
|
||||||
if ( pStructureFileRef )
|
if ( pStructureFileRef )
|
||||||
{
|
{
|
||||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ] ), pSoldier->pLevelNode );
|
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -2228,9 +2228,9 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Debug msg
|
// Debug msg
|
||||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"FAILED: add struct info for merc %d (%s), at %d direction %d", pSoldier->ubID, pSoldier->name, sGridNo, pSoldier->bDirection );
|
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"FAILED: add struct info for merc %d (%s), at %d direction %d", pSoldier->ubID, pSoldier->name, sGridNo, pSoldier->ubDirection );
|
||||||
|
|
||||||
if ( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ].pDBStructure->ubNumberOfTiles > 1 )
|
if ( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ].pDBStructure->ubNumberOfTiles > 1 )
|
||||||
{
|
{
|
||||||
// If we have more than one tile
|
// If we have more than one tile
|
||||||
pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_Z;
|
pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_Z;
|
||||||
@@ -3441,7 +3441,7 @@ BOOLEAN Water( INT16 sGridNo )
|
|||||||
}
|
}
|
||||||
|
|
||||||
pMapElement = &(gpWorldLevelData[sGridNo]);
|
pMapElement = &(gpWorldLevelData[sGridNo]);
|
||||||
if ( pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER || pMapElement->ubTerrainID == DEEP_WATER )
|
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||||
{
|
{
|
||||||
// check for a bridge! otherwise...
|
// check for a bridge! otherwise...
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
@@ -3457,7 +3457,7 @@ BOOLEAN DeepWater( INT16 sGridNo )
|
|||||||
MAP_ELEMENT * pMapElement;
|
MAP_ELEMENT * pMapElement;
|
||||||
|
|
||||||
pMapElement = &(gpWorldLevelData[sGridNo]);
|
pMapElement = &(gpWorldLevelData[sGridNo]);
|
||||||
if (pMapElement->ubTerrainID == DEEP_WATER)
|
if (TERRAIN_IS_DEEP_WATER( pMapElement->ubTerrainID) )
|
||||||
{
|
{
|
||||||
// check for a bridge! otherwise...
|
// check for a bridge! otherwise...
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ void ShutdownGame(void)
|
|||||||
InitTacticalSave( FALSE );
|
InitTacticalSave( FALSE );
|
||||||
|
|
||||||
ShutdownLua( );
|
ShutdownLua( );
|
||||||
|
|
||||||
|
FreeGameExternalOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -848,6 +848,7 @@ UINT32 MainGameScreenHandle(void)
|
|||||||
|
|
||||||
if ( gfScrollPending )
|
if ( gfScrollPending )
|
||||||
{
|
{
|
||||||
|
DeleteVideoOverlaysArea( );
|
||||||
AllocateVideoOverlaysArea( );
|
AllocateVideoOverlaysArea( );
|
||||||
SaveVideoOverlaysArea( FRAME_BUFFER );
|
SaveVideoOverlaysArea( FRAME_BUFFER );
|
||||||
ExecuteVideoOverlays( );
|
ExecuteVideoOverlays( );
|
||||||
|
|||||||
@@ -345,6 +345,10 @@
|
|||||||
RelativePath=".\ja2.h"
|
RelativePath=".\ja2.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\JA2Prototypes.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\jascreens.h"
|
RelativePath=".\jascreens.h"
|
||||||
>
|
>
|
||||||
|
|||||||
+36
@@ -256,6 +256,31 @@ int LuaSetSoldierGrid( lua_State *L )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaGetSoldierAPs( lua_State *L )
|
||||||
|
{
|
||||||
|
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) lua_touserdata( L, 1 );
|
||||||
|
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||||
|
if (!pSoldier)
|
||||||
|
{
|
||||||
|
lua_pushnil( L );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushinteger( L, pSoldier->bActionPoints);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaSetSoldierAPs( lua_State *L )
|
||||||
|
{
|
||||||
|
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) lua_touserdata( L, 1 );
|
||||||
|
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||||
|
int newaps = luaL_checkinteger( L, 3);
|
||||||
|
luaL_argcheck( L, newaps > 0 && newaps < 256, 2, "The grid number must be on screen!" );
|
||||||
|
pSoldier->bActionPoints = (INT8) newaps;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int LuaSoldierWalkTo( lua_State *L )
|
int LuaSoldierWalkTo( lua_State *L )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) luaL_checkudata( L, 1, SOLDIER_CLASS );
|
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) luaL_checkudata( L, 1, SOLDIER_CLASS );
|
||||||
@@ -282,12 +307,23 @@ int LuaSoldierRunTo( lua_State *L )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaSoldierChangeStance( lua_State *L )
|
||||||
|
{
|
||||||
|
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) luaL_checkudata( L, 1, SOLDIER_CLASS );
|
||||||
|
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||||
|
int newstance = luaL_checkinteger( L, 2);
|
||||||
|
ChangeSoldierStance( pSoldier, (UINT8) newstance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
LuaAttrib Soldier[] = {
|
LuaAttrib Soldier[] = {
|
||||||
{ "name", LuaGetSoldierName, },
|
{ "name", LuaGetSoldierName, },
|
||||||
{ "fullname", LuaGetSoldierFullName, },
|
{ "fullname", LuaGetSoldierFullName, },
|
||||||
{ "grid", LuaGetSoldierGrid, LuaSetSoldierGrid },
|
{ "grid", LuaGetSoldierGrid, LuaSetSoldierGrid },
|
||||||
|
{ "APs", LuaGetSoldierAPs, LuaSetSoldierAPs },
|
||||||
{ "walkto", NULL, NULL, LuaSoldierWalkTo },
|
{ "walkto", NULL, NULL, LuaSoldierWalkTo },
|
||||||
{ "runto", NULL, NULL, LuaSoldierRunTo },
|
{ "runto", NULL, NULL, LuaSoldierRunTo },
|
||||||
|
{ "changestance", NULL, NULL, LuaSoldierChangeStance },
|
||||||
{ NULL, },
|
{ NULL, },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ void luaWS_newlstr (lua_State *L, const CHAR16 *str, size_t l)
|
|||||||
int size = sizewstring( l);
|
int size = sizewstring( l);
|
||||||
ts = (TWString*) lua_newuserdata( L, size );
|
ts = (TWString*) lua_newuserdata( L, size );
|
||||||
ts->len = l;
|
ts->len = l;
|
||||||
memcpy( ts->data, str, size);
|
memcpy( ts->data, str, l*sizeof(CHAR16)+sizeof(CHAR16));
|
||||||
|
|
||||||
// Make this data a wstring
|
// Make this data a wstring
|
||||||
luaL_getmetatable(L, "wstring");
|
luaL_getmetatable(L, "wstring");
|
||||||
|
|||||||
Reference in New Issue
Block a user