Initialized many variables

Fix for enemy invasions and reinforcements


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1192 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-08-13 03:39:54 +00:00
parent ca8cb7b89a
commit 6ec2c5da7d
79 changed files with 2621 additions and 2584 deletions
+31 -27
View File
@@ -645,13 +645,13 @@ void Console::OnVScroll(WPARAM wParam) {
return; return;
} }
if (nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) { if ((nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) != 0) {
nCurrentPos += nDelta; nCurrentPos += nDelta;
SMALL_RECT sr; SMALL_RECT sr;
sr.Top = nCurrentPos; sr.Top = (short) nCurrentPos;
sr.Bottom = nDelta; // sr.Bottom = nDelta;
sr.Left = sr.Right = 0; sr.Left = sr.Right = 0;
m_csbiConsole.srWindow = sr; m_csbiConsole.srWindow = sr;
// ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr); // ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr);
@@ -825,6 +825,7 @@ void Console::OnMButtonDown(UINT uiFlags, POINTS points) {
void Console::OnMouseMove(UINT uiFlags, POINTS points) { void Console::OnMouseMove(UINT uiFlags, POINTS points) {
#if 0
RECT windowRect; RECT windowRect;
int deltaX, deltaY; int deltaX, deltaY;
POINT point; POINT point;
@@ -905,6 +906,7 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) {
} }
} }
} }
#endif
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -2697,11 +2699,12 @@ void Console::SetWindowSizeAndPosition() {
break; break;
} }
HWND hwndZ; HWND hwndZ = 0;
switch (m_dwCurrentZOrder) { switch (m_dwCurrentZOrder) {
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
default : return;
} }
::SetWindowPos( ::SetWindowPos(
@@ -2769,7 +2772,7 @@ BOOL Console::SetTrayIcon(DWORD dwMessage) {
if (strToolTip.length() > 63) { if (strToolTip.length() > 63) {
strToolTip.resize(59); strToolTip.resize(59);
strToolTip += _T(" ..."); strToolTip += _T(" ...");
DWORD dw = strToolTip.length(); // DWORD dw = strToolTip.length();
} }
_tcscpy(tnd.szTip, strToolTip.c_str()); _tcscpy(tnd.szTip, strToolTip.c_str());
@@ -2804,7 +2807,7 @@ void Console::EditConfigFile() {
// no params, just use the config file // no params, just use the config file
strParams = m_strConfigFile; strParams = m_strConfigFile;
} else { } else {
int nPos = strParams.find(_T("%f")); tstring::size_type nPos = strParams.find(_T("%f"));
if (nPos == tstring::npos) { if (nPos == tstring::npos) {
// no '%f' in editor params, concatenate config file name // no '%f' in editor params, concatenate config file name
@@ -3190,8 +3193,8 @@ void Console::InitConsoleWndSize(DWORD dwColumns) {
SMALL_RECT srConsoleRect; SMALL_RECT srConsoleRect;
srConsoleRect.Top = srConsoleRect.Left =0; srConsoleRect.Top = srConsoleRect.Left =0;
srConsoleRect.Right = dwColumns - 1; // srConsoleRect.Right = dwColumns - 1;
srConsoleRect.Bottom= m_dwRows - 1; // srConsoleRect.Bottom= m_dwRows - 1;
#if 0 #if 0
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
@@ -3230,8 +3233,8 @@ void Console::ResizeConsoleWindow() {
SMALL_RECT srConsoleRect; SMALL_RECT srConsoleRect;
srConsoleRect.Top = srConsoleRect.Left =0; srConsoleRect.Top = srConsoleRect.Left =0;
srConsoleRect.Right = m_dwColumns - 1; // srConsoleRect.Right = m_dwColumns - 1;
srConsoleRect.Bottom= m_dwRows - 1; // srConsoleRect.Bottom= m_dwRows - 1;
#if 0 #if 0
// order of setting window size and screen buffer size depends on current and desired dimensions // order of setting window size and screen buffer size depends on current and desired dimensions
@@ -3311,9 +3314,9 @@ void Console::RepaintWindow() {
COLORREF crBkColor = RGB(0, 0, 0); COLORREF crBkColor = RGB(0, 0, 0);
COLORREF crTxtColor = RGB(0, 0, 0); COLORREF crTxtColor = RGB(0, 0, 0);
int nNewBkMode = TRANSPARENT; // int nNewBkMode = TRANSPARENT;
COLORREF crNewBkColor = RGB(0, 0, 0); // COLORREF crNewBkColor = RGB(0, 0, 0);
COLORREF crNewTxtColor = RGB(0, 0, 0); // COLORREF crNewTxtColor = RGB(0, 0, 0);
bool bTextOut = false; bool bTextOut = false;
@@ -3635,7 +3638,7 @@ inline void Console::GetCursorRect(RECT& rectCursor) {
auto_ptr<wchar_t> pszLine(new wchar_t[m_csbiCursor.dwCursorPosition.X + 2]); auto_ptr<wchar_t> pszLine(new wchar_t[m_csbiCursor.dwCursorPosition.X + 2]);
::ZeroMemory(pszLine.get(), (m_csbiCursor.dwCursorPosition.X + 2)*sizeof(wchar_t)); ::ZeroMemory(pszLine.get(), (m_csbiCursor.dwCursorPosition.X + 2)*sizeof(wchar_t));
for (DWORD i = 0; i <= m_csbiCursor.dwCursorPosition.X; ++i) pszLine.get()[i] = m_pScreenBuffer[m_csbiCursor.dwCursorPosition.Y * m_dwColumns + i].Char.UnicodeChar; for (short i = 0; i <= m_csbiCursor.dwCursorPosition.X; ++i) pszLine.get()[i] = m_pScreenBuffer[m_csbiCursor.dwCursorPosition.Y * m_dwColumns + i].Char.UnicodeChar;
rectLine.left = rectLine.right = 0; rectLine.left = rectLine.right = 0;
rectLine.top = rectLine.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight; rectLine.top = rectLine.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight;
@@ -3676,7 +3679,7 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) {
GetCursorRect(rectCursor); GetCursorRect(rectCursor);
if (m_csbiCursor.dwCursorPosition.Y < m_csbiConsole.srWindow.Top || if (m_csbiCursor.dwCursorPosition.Y < m_csbiConsole.srWindow.Top ||
m_csbiCursor.dwCursorPosition.Y >= m_csbiConsole.srWindow.Top + m_dwRows) { m_csbiCursor.dwCursorPosition.Y >= m_csbiConsole.srWindow.Top + (SHORT) m_dwRows) {
return; return;
} }
@@ -3810,11 +3813,12 @@ void Console::ToggleWindowOnTop() {
m_dwCurrentZOrder = m_dwOriginalZOrder; m_dwCurrentZOrder = m_dwOriginalZOrder;
} }
HWND hwndZ; HWND hwndZ = 0;
switch (m_dwCurrentZOrder) { switch (m_dwCurrentZOrder) {
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
default : return;
} }
::SetWindowPos( ::SetWindowPos(
@@ -4098,7 +4102,7 @@ void Console::ShowReadmeFile() {
// no params, just use the readme file // no params, just use the readme file
strParams = m_strReadmeFile; strParams = m_strReadmeFile;
} else { } else {
int nPos = strParams.find(_T("%f")); tstring::size_type nPos = strParams.find(_T("%f"));
if (nPos == tstring::npos) { if (nPos == tstring::npos) {
// no '%f' in editor params, concatenate readme file name // no '%f' in editor params, concatenate readme file name
@@ -4148,7 +4152,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
RECT rectInval; RECT rectInval;
int cursorX; int cursorX;
int cursorY; int cursorY;
int attr = m_nTextColor + (m_nTextBgColor << 4); WORD attr = (WORD)(m_nTextColor + (m_nTextBgColor << 4));
cursorX = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder; cursorX = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder;
cursorY = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder; cursorY = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder;
@@ -4183,7 +4187,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
OnVScroll( SB_LINEUP); OnVScroll( SB_LINEUP);
} }
m_csbiCursor.dwCursorPosition.Y--; m_csbiCursor.dwCursorPosition.Y--;
m_csbiCursor.dwCursorPosition.X = m_dwColumns - 1; m_csbiCursor.dwCursorPosition.X = (SHORT)m_dwColumns - 1;
cursorX = m_nCharWidth * m_csbiCursor.dwCursorPosition.X; cursorX = m_nCharWidth * m_csbiCursor.dwCursorPosition.X;
idx--; idx--;
} }
@@ -4196,17 +4200,17 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
m_csbiCursor.dwCursorPosition.X++; m_csbiCursor.dwCursorPosition.X++;
} }
if (m_csbiCursor.dwCursorPosition.X >= m_dwColumns || *pszText == '\r' || *pszText == '\n' ) { if (m_csbiCursor.dwCursorPosition.X >= (SHORT) m_dwColumns || *pszText == '\r' || *pszText == '\n' ) {
m_csbiCursor.dwCursorPosition.X = 0; m_csbiCursor.dwCursorPosition.X = 0;
cursorX = m_nInsideBorder; cursorX = m_nInsideBorder;
if (*pszText != '\r') { if (*pszText != '\r') {
m_csbiCursor.dwCursorPosition.Y++; m_csbiCursor.dwCursorPosition.Y++;
if (m_csbiCursor.dwCursorPosition.Y >= m_dwBufferRows) { if (m_csbiCursor.dwCursorPosition.Y >= (SHORT)m_dwBufferRows) {
m_csbiCursor.dwCursorPosition.Y--; m_csbiCursor.dwCursorPosition.Y--;
idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns; idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns;
::CopyMemory( m_pScreenBufferNew, m_pScreenBufferNew + m_dwColumns, idx * sizeof( CHAR_INFO)); ::CopyMemory( m_pScreenBufferNew, m_pScreenBufferNew + m_dwColumns, idx * sizeof( CHAR_INFO));
::ZeroMemory( m_pScreenBufferNew + idx, m_dwColumns * sizeof( CHAR_INFO)); ::ZeroMemory( m_pScreenBufferNew + idx, m_dwColumns * sizeof( CHAR_INFO));
} else if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top + m_dwRows) { } else if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top + (SHORT)m_dwRows) {
OnVScroll( SB_LINEDOWN); OnVScroll( SB_LINEDOWN);
} else { } else {
cursorY += m_nCharHeight; cursorY += m_nCharHeight;
@@ -4429,7 +4433,7 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
#endif #endif
case WM_CHAR: case WM_CHAR:
myself->OnChar( wParam); myself->OnChar( (WORD) wParam);
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
@@ -4511,12 +4515,12 @@ DWORD WINAPI Console::MonitorThreadStatic(LPVOID lpParam) {
DWORD Console::MonitorThread() { DWORD Console::MonitorThread() {
// HANDLE arrHandles[] = {m_hConsoleProcess, m_hQuitEvent, m_hStdOut}; // HANDLE arrHandles[] = {m_hConsoleProcess, m_hQuitEvent, m_hStdOut};
HANDLE arrHandles[] = { m_hStdOut}; // HANDLE arrHandles[] = { m_hStdOut};
while (1) { for (;;) { // Infinite loop
#if 0
DWORD dwWait = ::WaitForMultipleObjects(1, arrHandles, FALSE, INFINITE); DWORD dwWait = ::WaitForMultipleObjects(1, arrHandles, FALSE, INFINITE);
#if 0
if (dwWait == WAIT_OBJECT_0) { if (dwWait == WAIT_OBJECT_0) {
::PostMessage(m_hWnd, WM_CLOSE, 0, 0); ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
break; break;
@@ -4532,7 +4536,7 @@ DWORD Console::MonitorThread() {
// } // }
} }
return 0; // return 0;
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
+2 -1
View File
@@ -61,9 +61,10 @@
AssemblerListingLocation=".\Debug/" AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/" ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/" ProgramDataBaseFileName=".\Debug/"
WarningLevel="3" WarningLevel="4"
SuppressStartupBanner="true" SuppressStartupBanner="true"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -68,7 +68,7 @@ HRESULT CreateFileStream(
hTemplateFile); hTemplateFile);
if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
DWORD a = ::GetLastError(); // DWORD a = ::GetLastError();
ppStream = NULL; ppStream = NULL;
return E_FAIL; return E_FAIL;
} }
+1
View File
@@ -548,6 +548,7 @@ void MapInfoEntryPointsCallback( GUI_BUTTON *btn, INT32 reason )
case MAPINFO_SOUTH_POINT: sGridNo = gMapInformation.sSouthGridNo; break; case MAPINFO_SOUTH_POINT: sGridNo = gMapInformation.sSouthGridNo; break;
case MAPINFO_CENTER_POINT: sGridNo = gMapInformation.sCenterGridNo; break; case MAPINFO_CENTER_POINT: sGridNo = gMapInformation.sCenterGridNo; break;
case MAPINFO_ISOLATED_POINT: sGridNo = gMapInformation.sIsolatedGridNo; break; case MAPINFO_ISOLATED_POINT: sGridNo = gMapInformation.sIsolatedGridNo; break;
default: AssertMsg( 0, "Invalid mapinfo point"); sGridNo = -1; break;
} }
if( sGridNo != -1 ) if( sGridNo != -1 )
{ {
+1 -1
View File
@@ -227,7 +227,7 @@ void CopyBuilding( INT32 iMapIndex )
//This will prevent overlapping problems. //This will prevent overlapping problems.
void SortBuildingLayout( INT32 iMapIndex ) void SortBuildingLayout( INT32 iMapIndex )
{ {
BUILDINGLAYOUTNODE *head, *curr, *prev, *prevBest, *best; BUILDINGLAYOUTNODE *head, *curr, *prev, *prevBest = NULL, *best = NULL;
INT32 iBestIndex; INT32 iBestIndex;
head = NULL; head = NULL;
if( iMapIndex < gsBuildingLayoutAnchorGridNo ) if( iMapIndex < gsBuildingLayoutAnchorGridNo )
+1 -1
View File
@@ -80,7 +80,7 @@ ITEM_POOL *gpItemPool = NULL;
void BuildItemPoolList() void BuildItemPoolList()
{ {
ITEM_POOL *temp; ITEM_POOL *temp;
IPListNode *tail; IPListNode *tail = NULL;
UINT16 i; UINT16 i;
KillItemPoolList(); KillItemPoolList();
for( i = 0; i < WORLD_MAX; i++ ) for( i = 0; i < WORLD_MAX; i++ )
+9 -4
View File
@@ -1182,9 +1182,7 @@ void EditMercIncDifficultyCallback(GUI_BUTTON *btn,INT32 reason)
// //
void ShowEditMercPalettes( SOLDIERTYPE *pSoldier ) void ShowEditMercPalettes( SOLDIERTYPE *pSoldier )
{ {
UINT8 ubPaletteRep; UINT8 ubPaletteRep = 0xff;
if( !pSoldier )
ubPaletteRep = 0xff;
if( pSoldier ) if( pSoldier )
{ {
@@ -2020,7 +2018,13 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only
pbArray = bCivArray; pbArray = bCivArray;
iMax = MAX_CIVTYPES; iMax = MAX_CIVTYPES;
break; break;
default:
AssertMsg( 0, "Unknown team");
return;
} }
iIndex = -1;
//find the matching bodytype index within the array. //find the matching bodytype index within the array.
for( x = 0; x < iMax; x++ ) for( x = 0; x < iMax; x++ )
{ {
@@ -3423,7 +3427,7 @@ void UpdateScheduleAction( UINT8 ubNewAction )
// 0:1A, 1:1B, 2:2A, 3:2B, ... // 0:1A, 1:1B, 2:2A, 3:2B, ...
void FindScheduleGridNo( UINT8 ubScheduleData ) void FindScheduleGridNo( UINT8 ubScheduleData )
{ {
INT32 iMapIndex; INT32 iMapIndex = 0xffff;
switch( ubScheduleData ) switch( ubScheduleData )
{ {
case 0: //1a case 0: //1a
@@ -3452,6 +3456,7 @@ void FindScheduleGridNo( UINT8 ubScheduleData )
break; break;
default: default:
AssertMsg( 0, "FindScheduleGridNo passed incorrect dataID." ); AssertMsg( 0, "FindScheduleGridNo passed incorrect dataID." );
return;
} }
if( iMapIndex != 0xffff ) if( iMapIndex != 0xffff )
{ {
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+4 -2
View File
@@ -1256,7 +1256,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{ {
INT32 i; INT32 i;
UINT16 usAttachment; UINT16 usAttachment = 0;
OBJECTTYPE temp; OBJECTTYPE temp;
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
{ //Loop through and find the button that was just modified { //Loop through and find the button that was just modified
@@ -1268,6 +1268,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
case 3: usAttachment = BIPOD; break; case 3: usAttachment = BIPOD; break;
case 4: usAttachment = DUCKBILL; break; case 4: usAttachment = DUCKBILL; break;
case 5: usAttachment = UNDER_GLAUNCHER; break; case 5: usAttachment = UNDER_GLAUNCHER; break;
default: Assert(0); continue;
} }
if( guiAttachmentButton[ i ] != -1 && btn == ButtonList[ guiAttachmentButton[ i ] ] ) if( guiAttachmentButton[ i ] != -1 && btn == ButtonList[ guiAttachmentButton[ i ] ] )
{ //Found it, now check the state of the button. { //Found it, now check the state of the button.
@@ -1515,7 +1516,7 @@ void UpdateActionItem( INT8 bActionItemIndex )
void ReEvaluateAttachmentStatii() void ReEvaluateAttachmentStatii()
{ {
INT32 i; INT32 i;
UINT16 usAttachment; UINT16 usAttachment = 0;
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
{ {
if( guiAttachmentButton[ i ] != -1 && !( ButtonList[ guiAttachmentButton[ i ] ]->uiFlags & BUTTON_CLICKED_ON ) ) if( guiAttachmentButton[ i ] != -1 && !( ButtonList[ guiAttachmentButton[ i ] ]->uiFlags & BUTTON_CLICKED_ON ) )
@@ -1528,6 +1529,7 @@ void ReEvaluateAttachmentStatii()
case 3: usAttachment = BIPOD; break; case 3: usAttachment = BIPOD; break;
case 4: usAttachment = DUCKBILL; break; case 4: usAttachment = DUCKBILL; break;
case 5: usAttachment = UNDER_GLAUNCHER; break; case 5: usAttachment = UNDER_GLAUNCHER; break;
default: Assert(0); continue;
} }
if( ValidItemAttachment( gpItem, usAttachment, TRUE ) ) if( ValidItemAttachment( gpItem, usAttachment, TRUE ) )
EnableButton( guiAttachmentButton[ i ] ); EnableButton( guiAttachmentButton[ i ] );
+7 -25
View File
@@ -1067,31 +1067,13 @@ BOOLEAN ExtractFilenameFromFields()
BOOLEAN ValidCoordinate() BOOLEAN ValidCoordinate()
{ {
if( gzFilename[0] >= 'A' && gzFilename[0] <= 'P' || CHAR16 sectorY = 0;
gzFilename[0] >= 'a' && gzFilename[0] <='p' ) UINT16 sectorX = 0;
{ swscanf( gzFilename, L"%c%2hd", &sectorY, &sectorX);
UINT16 usTotal;
if( gzFilename[1] == '1' && gzFilename[2] >= '0' && gzFilename[2] <= '6' ) sectorY = towupper( sectorY);
{ return ( sectorY >= 'A' && sectorY <= 'P' &&
usTotal = ( gzFilename[1] - 0x30 ) * 10 + ( gzFilename[2] - 0x30 ); sectorX >= 1 && sectorX <= 16);
}
else if( gzFilename[1] >= '1' && gzFilename[1] <= '9')
{
if( gzFilename[2] < '0' || gzFilename[2] > '9' )
{
usTotal = ( gzFilename[1] - 0x30 );
}
else
{
return FALSE;
}
}
if( usTotal >= 1 && usTotal <= 16 )
{
return TRUE;
}
}
return FALSE;
} }
BOOLEAN ValidFilename() BOOLEAN ValidFilename()
+2 -2
View File
@@ -541,7 +541,7 @@ void PasteStructure2( UINT32 iMapIndex )
// //
void PasteStructureCommon( UINT32 iMapIndex ) void PasteStructureCommon( UINT32 iMapIndex )
{ {
BOOLEAN fDoPaste = FALSE; // BOOLEAN fDoPaste = FALSE;
UINT32 fHeadType; UINT32 fHeadType;
UINT16 usUseIndex; UINT16 usUseIndex;
UINT16 usUseObjIndex; UINT16 usUseObjIndex;
@@ -1181,13 +1181,13 @@ void RaiseWorldLand( )
if (pTileElement->fType==FIRSTCLIFF) if (pTileElement->fType==FIRSTCLIFF)
{ {
fSomethingRaised = TRUE; fSomethingRaised = TRUE;
usIndex=pStruct->usIndex;
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt)); // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt));
if( pTileElement->ubNumberOfTiles > 1 ) if( pTileElement->ubNumberOfTiles > 1 )
{ {
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles)); // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles));
for (ubLoop = 0; ubLoop < pTileElement->ubNumberOfTiles; ubLoop++) for (ubLoop = 0; ubLoop < pTileElement->ubNumberOfTiles; ubLoop++)
{ {
usIndex=pStruct->usIndex;
// need means to turn land raising on and off based on the tile ID and the offset in the // need means to turn land raising on and off based on the tile ID and the offset in the
// tile database when reading into the mapsystem // tile database when reading into the mapsystem
// turning off of land raising can only be done // turning off of land raising can only be done
+3 -3
View File
@@ -2809,9 +2809,9 @@ BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY )
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
BOOLEAN fSoldierLight; BOOLEAN fSoldierLight;
BOOLEAN fRemovedLight; BOOLEAN fRemovedLight;
INT32 iMapIndex; INT32 iMapIndex = 0;
UINT32 uiLastLightType; UINT32 uiLastLightType = 0;
UINT8 *pLastLightName; UINT8 *pLastLightName = NULL;
fRemovedLight = FALSE; fRemovedLight = FALSE;
+13 -4
View File
@@ -217,6 +217,9 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
case 0xff: case 0xff:
usIndex = 60 + (UINT16)Random( 6 ); usIndex = 60 + (UINT16)Random( 6 );
break; break;
default:
AssertMsg(0, "Invalid total given");
return 0xffff;
} }
GetTileIndexFromTypeSubIndex( usType, usIndex, &usTileIndex ); GetTileIndexFromTypeSubIndex( usType, usIndex, &usTileIndex );
return usTileIndex; return usTileIndex;
@@ -447,6 +450,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
switch( ubWallPiece ) switch( ubWallPiece )
{ {
case EXTERIOR_TOP: case EXTERIOR_TOP:
ubWallClass = EXTERIOR_L;
iMapIndex -= WORLD_COLS; iMapIndex -= WORLD_COLS;
//exterior bottom left corner generated //exterior bottom left corner generated
if ( !gfBasement && GetVerticalWall( iMapIndex - 1) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1) ) if ( !gfBasement && GetVerticalWall( iMapIndex - 1) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1) )
@@ -464,7 +468,6 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex );
ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex ); ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex );
} }
ubWallClass = EXTERIOR_L;
if( !gfBasement ) if( !gfBasement )
{ {
//All exterior_l walls have shadows. //All exterior_l walls have shadows.
@@ -483,8 +486,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
} }
break; break;
case EXTERIOR_LEFT: case EXTERIOR_LEFT:
iMapIndex--;
ubWallClass = EXTERIOR_R; ubWallClass = EXTERIOR_R;
iMapIndex--;
if( GetHorizontalWall( iMapIndex ) ) if( GetHorizontalWall( iMapIndex ) )
{ //Special case where placing the new wall will generate a corner. This piece { //Special case where placing the new wall will generate a corner. This piece
//becomes an exterior bottomend, but nothing else is effected. //becomes an exterior bottomend, but nothing else is effected.
@@ -510,8 +513,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
} }
break; break;
case INTERIOR_TOP: case INTERIOR_TOP:
iMapIndex -= WORLD_COLS;
ubWallClass = INTERIOR_L; ubWallClass = INTERIOR_L;
iMapIndex -= WORLD_COLS;
//check for a lower left corner. //check for a lower left corner.
if( pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) ) if( pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) )
{ //Replace the piece with an extended piece. { //Replace the piece with an extended piece.
@@ -554,8 +557,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
} }
break; break;
case INTERIOR_LEFT: case INTERIOR_LEFT:
iMapIndex--;
ubWallClass = INTERIOR_R; ubWallClass = INTERIOR_R;
iMapIndex--;
if( GetHorizontalWall( iMapIndex ) ) if( GetHorizontalWall( iMapIndex ) )
{ {
ubWallClass = INTERIOR_BOTTOMEND; ubWallClass = INTERIOR_BOTTOMEND;
@@ -595,6 +598,10 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
AddExclusiveShadow( iMapIndex, usTileIndex ); AddExclusiveShadow( iMapIndex, usTileIndex );
} }
break; break;
default:
AssertMsg( 0, "Invalid wall piece");
return;
} }
sIndex = PickAWallPiece( ubWallClass ); sIndex = PickAWallPiece( ubWallClass );
GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex );
@@ -980,6 +987,8 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
//change the floor for say a kitchen which might have a different floor type. //change the floor for say a kitchen which might have a different floor type.
usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL ); usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL );
usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR );
usRoofType = 0xffff;
if( usWallType == 0xffff && usFloorType != 0xffff ) if( usWallType == 0xffff && usFloorType != 0xffff )
{ //allow user to place floors { //allow user to place floors
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
+3
View File
@@ -125,6 +125,9 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
usX = button->Area.RegionBottomRightX; usX = button->Area.RegionBottomRightX;
usY = button->Area.RegionBottomRightY; usY = button->Area.RegionBottomRightY;
break; break;
default:
AssertMsg(0, "Invalid direction given");
return;
} }
//Decipher the popupMenuID //Decipher the popupMenuID
+14 -13
View File
@@ -346,6 +346,10 @@ void CreateJA2SelectionWindow( INT16 sWhat )
pSelList = SelRoom; pSelList = SelRoom;
pNumSelList = &iNumRoomsSelected; pNumSelList = &iNumRoomsSelected;
break; break;
default:
// If none of these, don't create anything!
AssertMsg( 0, "Unknown window creation type");
return;
} }
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint,
@@ -1086,21 +1090,19 @@ void DisplaySelectionWindowGraphicalInformation()
// //
void AddToSelectionList( DisplayList *pNode ) void AddToSelectionList( DisplayList *pNode )
{ {
INT32 iIndex, iUseIndex; INT32 iIndex, iUseIndex = -1;
BOOLEAN fDone;
fDone = FALSE; for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ )
{ {
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex ) pNode->uiIndex == pSelList[ iIndex ].usIndex )
{ {
fDone = TRUE;
iUseIndex = iIndex; iUseIndex = iIndex;
break;
} }
} }
if ( fDone ) if ( iUseIndex >= 0 )
{ {
// Was already in the list, so bump up the count // Was already in the list, so bump up the count
pSelList[ iUseIndex ].sCount++; pSelList[ iUseIndex ].sCount++;
@@ -1158,26 +1160,25 @@ BOOLEAN ClearSelectionList( void )
// //
BOOLEAN RemoveFromSelectionList( DisplayList *pNode ) BOOLEAN RemoveFromSelectionList( DisplayList *pNode )
{ {
INT32 iIndex, iUseIndex; INT32 iIndex, iUseIndex = -1;
BOOLEAN fDone, fRemoved; BOOLEAN fRemoved;
// Abort if no entries in list (pretend we removed a node) // Abort if no entries in list (pretend we removed a node)
if ( (*pNumSelList) <= 0 ) if ( (*pNumSelList) <= 0 )
return( TRUE ); return( TRUE );
fRemoved = FALSE; fRemoved = FALSE;
fDone = FALSE; for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ )
{ {
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex ) pNode->uiIndex == pSelList[ iIndex ].usIndex )
{ {
fDone = TRUE;
iUseIndex = iIndex; iUseIndex = iIndex;
break;
} }
} }
if ( fDone ) if ( iUseIndex >= 0 )
{ {
// Was already in the list, so bump up the count // Was already in the list, so bump up the count
pSelList[ iUseIndex ].sCount--; pSelList[ iUseIndex ].sCount--;
@@ -1613,7 +1614,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
fReturnVal = FALSE; fReturnVal = FALSE;
if (DisplayWindowFunc(pNode->pNext, iTopCutOff, iBottomCutOff, pUpperLeft, fFlags)) if (DisplayWindowFunc(pNode->pNext, iTopCutOff, iBottomCutOff, pUpperLeft, fFlags))
{ {
iCurrY = pUpperLeft->iY + pNode->iY - iTopCutOff; iCurrY = (INT16) pUpperLeft->iY + pNode->iY - iTopCutOff;
if ( iCurrY > iBottomCutOff ) if ( iCurrY > iBottomCutOff )
return(TRUE); return(TRUE);
+5
View File
@@ -1079,6 +1079,11 @@ INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId)
iStart = GetFirstMaleSlot(); iStart = GetFirstMaleSlot();
iEnd = GetLastMaleSlot(); iEnd = GetLastMaleSlot();
} }
else
{
AssertMsg( 0, "Merc neither male nor female");
return -1;
}
// Find a free imp slot // Find a free imp slot
for (i = iStart; i <= iEnd; ++i) for (i = iStart; i <= iEnd; ++i)
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+2 -2
View File
@@ -2064,7 +2064,7 @@ INT32 GetPreviousDaysBalance( void )
UINT8 ubSecondCode; UINT8 ubSecondCode;
UINT32 uiDate; UINT32 uiDate;
INT32 iAmount; INT32 iAmount;
INT32 iBalanceToDate; INT32 iBalanceToDate = 0;
BOOLEAN fGoneTooFar= FALSE; BOOLEAN fGoneTooFar= FALSE;
INT32 iFileSize = 0; INT32 iFileSize = 0;
@@ -2157,7 +2157,7 @@ INT32 GetTodaysBalance( void )
UINT8 ubSecondCode; UINT8 ubSecondCode;
UINT32 uiDate; UINT32 uiDate;
INT32 iAmount; INT32 iAmount;
INT32 iBalanceToDate; INT32 iBalanceToDate = 0;
BOOLEAN fGoneTooFar= FALSE; BOOLEAN fGoneTooFar= FALSE;
+1 -1
View File
@@ -3280,7 +3280,7 @@ void DrawIconOnButton(GUI_BUTTON *b)
INT32 IconW,IconH; INT32 IconW,IconH;
SGPRect NewClip,OldClip; SGPRect NewClip,OldClip;
ETRLEObject *pTrav; ETRLEObject *pTrav;
HVOBJECT hvObject; HVOBJECT hvObject = NULL;
// If there's an actual icon on this button, try to show it. // If there's an actual icon on this button, try to show it.
if(b->iIconID >= 0) if(b->iIconID >= 0)
+1 -1
View File
@@ -469,7 +469,7 @@ void DbClose( HDBINDEX hFile )
HDBFILE DbFileOpen( STR strFilename ) HDBFILE DbFileOpen( STR strFilename )
{ {
HDBFILE hFile; HDBFILE hFile;
HFILEINDEX hFileIndex; HFILEINDEX hFileIndex = 0xffff;
HDBINDEX hDBIndex; HDBINDEX hDBIndex;
UINT16 i; UINT16 i;
@@ -451,8 +451,8 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32
HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ) HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx )
{ {
DDSURFACEDESC SurfaceDescription; DDSURFACEDESC SurfaceDescription;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES = 0;
UINT8 *pDestBuf, *pSrcBuf; UINT8 *pDestBuf, *pSrcBuf = NULL;
HRESULT ReturnCode; HRESULT ReturnCode;
DDCOLORKEY ColorKey; DDCOLORKEY ColorKey;
UINT16 us16BPPColorKey; UINT16 us16BPPColorKey;
+1 -1
View File
@@ -306,7 +306,7 @@ void MemFreeReal( PTR ptr, const STR8 pcFile, INT32 iLine )
PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine ) PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine )
{ {
PTR ptrNew; PTR ptrNew;
UINT32 uiOldSize; UINT32 uiOldSize = 0;
if ( !fMemManagerInit ) if ( !fMemManagerInit )
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+2
View File
@@ -856,6 +856,8 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
// At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is // At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is
// attend to the gaming mechanics themselves // attend to the gaming mechanics themselves
Message.wParam = 0;
while (gfProgramIsRunning) while (gfProgramIsRunning)
{ {
// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE)) // if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
+68 -66
View File
@@ -1,23 +1,23 @@
#ifdef JA2_PRECOMPILED_HEADERS #ifdef JA2_PRECOMPILED_HEADERS
#include "JA2 SGP ALL.H" #include "JA2 SGP ALL.H"
#elif defined( WIZ8_PRECOMPILED_HEADERS ) #elif defined( WIZ8_PRECOMPILED_HEADERS )
#include "WIZ8 SGP ALL.H" #include "WIZ8 SGP ALL.H"
#else #else
#include "DirectDraw Calls.h" #include "DirectDraw Calls.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "debug.h" #include "debug.h"
#if defined( JA2 ) || defined( UTIL ) #if defined( JA2 ) || defined( UTIL )
#include "video.h" #include "video.h"
#else #else
#include "video2.h" #include "video2.h"
#endif #endif
#include "himage.h" #include "himage.h"
#include "vsurface.h" #include "vsurface.h"
#include "vsurface_private.h" #include "vsurface_private.h"
#include "video_private.h" #include "video_private.h"
#include "wcheck.h" #include "wcheck.h"
#include "vobject_blitters.h" #include "vobject_blitters.h"
#endif #endif
extern void SetClippingRect(SGPRect *clip); extern void SetClippingRect(SGPRect *clip);
@@ -73,10 +73,10 @@ typedef struct VSURFACE_NODE
UINT32 uiIndex; UINT32 uiIndex;
struct VSURFACE_NODE *next, *prev; struct VSURFACE_NODE *next, *prev;
#ifdef SGP_VIDEO_DEBUGGING #ifdef SGP_VIDEO_DEBUGGING
STR8 pName; STR8 pName;
STR8 pCode; STR8 pCode;
#endif #endif
}VSURFACE_NODE; }VSURFACE_NODE;
@@ -161,12 +161,12 @@ BOOLEAN ShutdownVideoSurfaceManager( )
curr = gpVSurfaceHead; curr = gpVSurfaceHead;
gpVSurfaceHead = gpVSurfaceHead->next; gpVSurfaceHead = gpVSurfaceHead->next;
DeleteVideoSurface( curr->hVSurface ); DeleteVideoSurface( curr->hVSurface );
#ifdef SGP_VIDEO_DEBUGGING #ifdef SGP_VIDEO_DEBUGGING
if( curr->pName ) if( curr->pName )
MemFree( curr->pName ); MemFree( curr->pName );
if( curr->pCode ) if( curr->pCode )
MemFree( curr->pCode ); MemFree( curr->pCode );
#endif #endif
MemFree( curr ); MemFree( curr );
} }
gpVSurfaceHead = NULL; gpVSurfaceHead = NULL;
@@ -236,10 +236,10 @@ BOOLEAN AddStandardVideoSurface( VSURFACE_DESC *pVSurfaceDesc, UINT32 *puiIndex
gpVSurfaceHead->prev = gpVSurfaceHead->next = NULL; gpVSurfaceHead->prev = gpVSurfaceHead->next = NULL;
gpVSurfaceTail = gpVSurfaceHead; gpVSurfaceTail = gpVSurfaceHead;
} }
#ifdef SGP_VIDEO_DEBUGGING #ifdef SGP_VIDEO_DEBUGGING
gpVSurfaceTail->pName = NULL; gpVSurfaceTail->pName = NULL;
gpVSurfaceTail->pCode = NULL; gpVSurfaceTail->pCode = NULL;
#endif #endif
//Set the hVSurface into the node. //Set the hVSurface into the node.
gpVSurfaceTail->hVSurface = hVSurface; gpVSurfaceTail->hVSurface = hVSurface;
gpVSurfaceTail->uiIndex = guiVSurfaceIndex+=2; gpVSurfaceTail->uiIndex = guiVSurfaceIndex+=2;
@@ -370,9 +370,9 @@ BOOLEAN SetVideoSurfaceTransparency( UINT32 uiIndex, COLORVAL TransColor )
// Get Video Surface // Get Video Surface
// //
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_SETVIDEOSURFACETRANSPARENCY; gubVSDebugCode = DEBUGSTR_SETVIDEOSURFACETRANSPARENCY;
#endif #endif
CHECKF( GetVideoSurface( &hVSurface, uiIndex ) ); CHECKF( GetVideoSurface( &hVSurface, uiIndex ) );
// //
@@ -392,9 +392,9 @@ BOOLEAN AddVideoSurfaceRegion( UINT32 uiIndex, VSURFACE_REGION *pNewRegion )
// Get Video Surface // Get Video Surface
// //
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_ADDVIDEOSURFACEREGION; gubVSDebugCode = DEBUGSTR_ADDVIDEOSURFACEREGION;
#endif #endif
CHECKF( GetVideoSurface( &hVSurface, uiIndex ) ); CHECKF( GetVideoSurface( &hVSurface, uiIndex ) );
// //
@@ -419,9 +419,9 @@ BOOLEAN GetVideoSurfaceDescription( UINT32 uiIndex, UINT16 *usWidth, UINT16 *usH
// Get Video Surface // Get Video Surface
// //
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_GETVIDEOSURFACEDESCRIPTION; gubVSDebugCode = DEBUGSTR_GETVIDEOSURFACEDESCRIPTION;
#endif #endif
CHECKF( GetVideoSurface( &hVSurface, uiIndex ) ); CHECKF( GetVideoSurface( &hVSurface, uiIndex ) );
*usWidth = hVSurface->usWidth; *usWidth = hVSurface->usWidth;
@@ -435,9 +435,9 @@ BOOLEAN GetVideoSurface( HVSURFACE *hVSurface, UINT32 uiIndex )
{ {
VSURFACE_NODE *curr; VSURFACE_NODE *curr;
#ifdef _DEBUG #ifdef _DEBUG
CheckValidVSurfaceIndex( uiIndex ); CheckValidVSurfaceIndex( uiIndex );
#endif #endif
if ( uiIndex == PRIMARY_SURFACE ) if ( uiIndex == PRIMARY_SURFACE )
{ {
@@ -575,16 +575,16 @@ BOOLEAN BltVideoSurface(UINT32 uiDestVSurface, UINT32 uiSrcVSurface, UINT16 usRe
HVSURFACE hDestVSurface; HVSURFACE hDestVSurface;
HVSURFACE hSrcVSurface; HVSURFACE hSrcVSurface;
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_BLTVIDEOSURFACE_DST; gubVSDebugCode = DEBUGSTR_BLTVIDEOSURFACE_DST;
#endif #endif
if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) ) if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) )
{ {
return FALSE; return FALSE;
} }
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_BLTVIDEOSURFACE_SRC; gubVSDebugCode = DEBUGSTR_BLTVIDEOSURFACE_SRC;
#endif #endif
if( !GetVideoSurface( &hSrcVSurface, uiSrcVSurface ) ) if( !GetVideoSurface( &hSrcVSurface, uiSrcVSurface ) )
{ {
return FALSE; return FALSE;
@@ -608,9 +608,9 @@ BOOLEAN ColorFillVideoSurfaceArea(UINT32 uiDestVSurface, INT32 iDestX1, INT32 iD
HVSURFACE hDestVSurface; HVSURFACE hDestVSurface;
SGPRect Clip; SGPRect Clip;
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_COLORFILLVIDEOSURFACEAREA; gubVSDebugCode = DEBUGSTR_COLORFILLVIDEOSURFACEAREA;
#endif #endif
if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) ) if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) )
{ {
return FALSE; return FALSE;
@@ -782,18 +782,18 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
LPDIRECTDRAWSURFACE lpDDS; LPDIRECTDRAWSURFACE lpDDS;
LPDIRECTDRAWSURFACE2 lpDDS2; LPDIRECTDRAWSURFACE2 lpDDS2;
HVSURFACE hVSurface; HVSURFACE hVSurface;
HIMAGE hImage; HIMAGE hImage = NULL;
SGPRect tempRect; SGPRect tempRect;
UINT16 usHeight; UINT16 usHeight;
UINT16 usWidth; UINT16 usWidth;
UINT8 ubBitDepth; UINT8 ubBitDepth;
UINT32 fMemUsage; UINT32 fMemUsage;
//#ifdef JA2 //#ifdef JA2
UINT32 uiRBitMask; UINT32 uiRBitMask;
UINT32 uiGBitMask; UINT32 uiGBitMask;
UINT32 uiBBitMask; UINT32 uiBBitMask;
//#endif //#endif
//Clear the memory //Clear the memory
memset( &SurfaceDescription, 0, sizeof( DDSURFACEDESC ) ); memset( &SurfaceDescription, 0, sizeof( DDSURFACEDESC ) );
@@ -817,8 +817,8 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
// Check creation options // Check creation options
// //
do //do
{ //{
// //
// Check if creating from file // Check if creating from file
// //
@@ -843,9 +843,10 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
usHeight = hImage->usHeight; usHeight = hImage->usHeight;
usWidth = hImage->usWidth; usWidth = hImage->usWidth;
ubBitDepth = hImage->ubBitDepth; ubBitDepth = hImage->ubBitDepth;
break; // break;
} }
else
{
// //
// If here, no special options given, // If here, no special options given,
@@ -856,7 +857,8 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
usWidth = VSurfaceDesc->usWidth; usWidth = VSurfaceDesc->usWidth;
ubBitDepth = VSurfaceDesc->ubBitDepth; ubBitDepth = VSurfaceDesc->ubBitDepth;
} while( FALSE ); }
//while( FALSE );
// //
// Assertions // Assertions
@@ -891,18 +893,18 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
// Get current Pixel Format from DirectDraw // Get current Pixel Format from DirectDraw
// //
// We're using pixel formats too -- DB/Wiz // We're using pixel formats too -- DB/Wiz
//#ifdef JA2 //#ifdef JA2
CHECKF( GetPrimaryRGBDistributionMasks( &uiRBitMask, &uiGBitMask, &uiBBitMask ) ); CHECKF( GetPrimaryRGBDistributionMasks( &uiRBitMask, &uiGBitMask, &uiBBitMask ) );
PixelFormat.dwRBitMask = uiRBitMask; PixelFormat.dwRBitMask = uiRBitMask;
PixelFormat.dwGBitMask = uiGBitMask; PixelFormat.dwGBitMask = uiGBitMask;
PixelFormat.dwBBitMask = uiBBitMask; PixelFormat.dwBBitMask = uiBBitMask;
//#else //#else
// PixelFormat.dwRBitMask = 0xf800; // PixelFormat.dwRBitMask = 0xf800;
// PixelFormat.dwGBitMask = 0x7e0; // PixelFormat.dwGBitMask = 0x7e0;
// PixelFormat.dwBBitMask = 0x1f; // PixelFormat.dwBBitMask = 0x1f;
//#endif //#endif
break; break;
default: default:
@@ -1386,10 +1388,10 @@ BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex )
{ {
VSURFACE_NODE *curr; VSURFACE_NODE *curr;
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_DELETEVIDEOSURFACEFROMINDEX; gubVSDebugCode = DEBUGSTR_DELETEVIDEOSURFACEFROMINDEX;
CheckValidVSurfaceIndex( uiIndex ); CheckValidVSurfaceIndex( uiIndex );
#endif #endif
curr = gpVSurfaceHead; curr = gpVSurfaceHead;
while( curr ) while( curr )
@@ -1419,7 +1421,7 @@ BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex )
} }
//The node is now detached. Now deallocate it. //The node is now detached. Now deallocate it.
#ifdef SGP_VIDEO_DEBUGGING #ifdef SGP_VIDEO_DEBUGGING
if( curr->pName ) if( curr->pName )
{ {
MemFree( curr->pName ); MemFree( curr->pName );
@@ -1428,7 +1430,7 @@ BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex )
{ {
MemFree( curr->pCode ); MemFree( curr->pCode );
} }
#endif #endif
MemFree( curr ); MemFree( curr );
guiVSurfaceSize--; guiVSurfaceSize--;
@@ -1862,7 +1864,7 @@ BOOLEAN BltVideoSurfaceToVideoSurface( HVSURFACE hDestVSurface, HVSURFACE hSrcVS
UnLockVideoSurfaceBuffer(hDestVSurface); UnLockVideoSurfaceBuffer(hDestVSurface);
return(TRUE); return(TRUE);
} }
// For testing with non-DDraw blitting, uncomment to test -- DB // For testing with non-DDraw blitting, uncomment to test -- DB
#ifndef JA2 #ifndef JA2
else else
{ {
@@ -2288,9 +2290,9 @@ BOOLEAN InternalShadowVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32
// //
// Get Video Surface // Get Video Surface
// //
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_SHADOWVIDEOSURFACERECT; gubVSDebugCode = DEBUGSTR_SHADOWVIDEOSURFACERECT;
#endif #endif
CHECKF( GetVideoSurface( &hVSurface, uiDestVSurface ) ); CHECKF( GetVideoSurface( &hVSurface, uiDestVSurface ) );
if ( X1 < 0 ) if ( X1 < 0 )
@@ -2419,16 +2421,16 @@ BOOLEAN BltStretchVideoSurface(UINT32 uiDestVSurface, UINT32 uiSrcVSurface, INT3
HVSURFACE hDestVSurface; HVSURFACE hDestVSurface;
HVSURFACE hSrcVSurface; HVSURFACE hSrcVSurface;
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_BLTSTRETCHVIDEOSURFACE_DST; gubVSDebugCode = DEBUGSTR_BLTSTRETCHVIDEOSURFACE_DST;
#endif #endif
if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) ) if( !GetVideoSurface( &hDestVSurface, uiDestVSurface ) )
{ {
return FALSE; return FALSE;
} }
#ifdef _DEBUG #ifdef _DEBUG
gubVSDebugCode = DEBUGSTR_BLTSTRETCHVIDEOSURFACE_SRC; gubVSDebugCode = DEBUGSTR_BLTSTRETCHVIDEOSURFACE_SRC;
#endif #endif
if( !GetVideoSurface( &hSrcVSurface, uiSrcVSurface ) ) if( !GetVideoSurface( &hSrcVSurface, uiSrcVSurface ) )
{ {
return FALSE; return FALSE;
@@ -2463,9 +2465,9 @@ BOOLEAN ShadowVideoSurfaceImage( UINT32 uiDestVSurface, HVOBJECT hImageHandle, I
BOOLEAN MakeVSurfaceFromVObject(UINT32 uiVObject, UINT16 usSubIndex, UINT32 *puiVSurface) BOOLEAN MakeVSurfaceFromVObject(UINT32 uiVObject, UINT16 usSubIndex, UINT32 *puiVSurface)
{ {
HVOBJECT hSrcVObject; HVOBJECT hSrcVObject;
UINT32 uiVSurface; UINT32 uiVSurface;
VSURFACE_DESC hDesc; VSURFACE_DESC hDesc;
if(GetVideoObject(&hSrcVObject, uiVObject)) if(GetVideoObject(&hSrcVObject, uiVObject))
{ {
+1 -1
View File
@@ -455,7 +455,7 @@ void RenderStationaryGroups()
INT32 x, y, xp, yp; INT32 x, y, xp, yp;
CHAR16 str[20]; CHAR16 str[20];
INT32 iSector = 0; INT32 iSector = 0;
UINT8 ubIconColor; UINT8 ubIconColor = 0;
UINT8 ubGroupSize = 0; UINT8 ubGroupSize = 0;
+2 -2
View File
@@ -3950,7 +3950,7 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAtG
INT8 bSkill = 0; INT8 bSkill = 0;
INT16 sBestTrainingPts, sTrainingPtsDueToInstructor; INT16 sBestTrainingPts, sTrainingPtsDueToInstructor;
UINT16 usMaxTrainerPts, usBestMaxTrainerPts; UINT16 usMaxTrainerPts, usBestMaxTrainerPts = 0;
UINT32 uiCnt; UINT32 uiCnt;
SOLDIERTYPE * pTrainer; SOLDIERTYPE * pTrainer;
@@ -8106,7 +8106,7 @@ void HandleShadingOfLinesForSquadMenu( void )
UINT32 uiCounter; UINT32 uiCounter;
SOLDIERTYPE *pSoldier = NULL; SOLDIERTYPE *pSoldier = NULL;
UINT32 uiMaxSquad; UINT32 uiMaxSquad;
INT8 bResult; INT8 bResult = 0;
if ( ( fShowSquadMenu == FALSE ) || ( ghSquadBox == -1 ) ) if ( ( fShowSquadMenu == FALSE ) || ( ghSquadBox == -1 ) )
+1 -1
View File
@@ -622,7 +622,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
{ {
INT32 iRandom; INT32 iRandom;
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
MAPEDGEPOINTINFO MapEdgepointInfo; MAPEDGEPOINTINFO MapEdgepointInfo = { };
UINT8 bDesiredDirection=0; UINT8 bDesiredDirection=0;
UINT8 ubCurrSlot = 0; UINT8 ubCurrSlot = 0;
+1 -1
View File
@@ -180,7 +180,7 @@ UINT16 LarryItems[ NUM_LARRY_ITEMS ][ 3 ] =
void HourlyLarryUpdate( void ) void HourlyLarryUpdate( void )
{ {
SOLDIERTYPE * pSoldier; SOLDIERTYPE * pSoldier;
INT8 bSlot, bBoozeSlot; INT8 bSlot = NO_SLOT, bBoozeSlot;
INT8 bLarryItemLoop; INT8 bLarryItemLoop;
UINT16 usTemptation = 0; UINT16 usTemptation = 0;
UINT16 usCashAmount; UINT16 usCashAmount;
+198 -198
View File
@@ -1,43 +1,43 @@
#ifdef PRECOMPILEDHEADERS #ifdef PRECOMPILEDHEADERS
#include "Strategic All.h" #include "Strategic All.h"
#else #else
#include "Map Screen Helicopter.h" #include "Map Screen Helicopter.h"
#include "LaptopSave.h" #include "LaptopSave.h"
#include "Vehicles.h" #include "Vehicles.h"
#include "Finances.h" #include "Finances.h"
#include "Quests.h" #include "Quests.h"
#include "Game Clock.h" #include "Game Clock.h"
#include "strategic.h" #include "strategic.h"
#include "Queen Command.h" #include "Queen Command.h"
#include "Strategic Pathing.h" #include "Strategic Pathing.h"
#include "Random.h" #include "Random.h"
#include "Game Event Hook.h" #include "Game Event Hook.h"
#include "String.h" #include "String.h"
#include "Dialogue Control.h" #include "Dialogue Control.h"
#include "Message.h" #include "Message.h"
#include "Strategic Movement.h" #include "Strategic Movement.h"
#include "Soldier Profile.h" #include "Soldier Profile.h"
#include "Assignments.h" #include "Assignments.h"
#include "PreBattle Interface.h" #include "PreBattle Interface.h"
#include "strategicmap.h" #include "strategicmap.h"
#include "worlddef.h" #include "worlddef.h"
#include "worldman.h" #include "worldman.h"
#include "tiledat.h" #include "tiledat.h"
#include "Map Screen Interface.h" #include "Map Screen Interface.h"
#include "Text.h" #include "Text.h"
#include "Squads.h" #include "Squads.h"
#include "Player Command.h" #include "Player Command.h"
#include "Sound Control.h" #include "Sound Control.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "meanwhile.h" #include "meanwhile.h"
#include "Map Screen Interface Border.h" #include "Map Screen Interface Border.h"
#include "Strategic Event Handler.h" #include "Strategic Event Handler.h"
#include "Overhead.h" #include "Overhead.h"
#include "Soldier Create.h" #include "Soldier Create.h"
#include "renderworld.h" #include "renderworld.h"
#include "soundman.h" #include "soundman.h"
#include "Isometric Utils.h" #include "Isometric Utils.h"
#include "Scheduling.h" #include "Scheduling.h"
#endif #endif
@@ -204,7 +204,7 @@ void InitializeHelicopter( void )
fPlotForHelicopter = FALSE; fPlotForHelicopter = FALSE;
pTempHelicopterPath = NULL; pTempHelicopterPath = NULL;
// iTotalHeliDistanceSinceRefuel = 0; // iTotalHeliDistanceSinceRefuel = 0;
iTotalAccumulatedCostByPlayer = 0; iTotalAccumulatedCostByPlayer = 0;
fHelicopterDestroyed = FALSE; fHelicopterDestroyed = FALSE;
@@ -344,7 +344,7 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
} }
// accumulate distance travelled // accumulate distance travelled
// AddSectorToHelicopterDistanceTravelled( ); // AddSectorToHelicopterDistanceTravelled( );
// check if heli has any real path left // check if heli has any real path left
@@ -387,30 +387,30 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
/* /*
INT32 GetTotalDistanceHelicopterCanTravel( void ) INT32 GetTotalDistanceHelicopterCanTravel( void )
{ {
return( MAX_HELICOPTER_DISTANCE ); return( MAX_HELICOPTER_DISTANCE );
} }
INT32 HowFarHelicopterhasTravelledSinceRefueling( void ) INT32 HowFarHelicopterhasTravelledSinceRefueling( void )
{ {
// return total distance // return total distance
return( iTotalHeliDistanceSinceRefuel ); return( iTotalHeliDistanceSinceRefuel );
} }
INT32 HowFurtherCanHelicopterTravel( void ) INT32 HowFurtherCanHelicopterTravel( void )
{ {
// how many sectors further can we go on remaining fuel? // how many sectors further can we go on remaining fuel?
return( MAX_HELICOPTER_DISTANCE - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) ); return( MAX_HELICOPTER_DISTANCE - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) );
} }
void AddSectorToHelicopterDistanceTravelled( void ) void AddSectorToHelicopterDistanceTravelled( void )
{ {
// up the distance // up the distance
iTotalHeliDistanceSinceRefuel++; iTotalHeliDistanceSinceRefuel++;
//reset hover time //reset hover time
uiStartHoverTime = 0; uiStartHoverTime = 0;
return; return;
} }
*/ */
@@ -486,14 +486,14 @@ INT32 DistanceToNearestRefuelPoint( INT16 sX, INT16 sY )
/* /*
BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY ) BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY )
{ {
// check distance to nearest refuel point // check distance to nearest refuel point
if( DistanceToNearestRefuelPoint( sX, sY ) > HowFurtherCanHelicopterTravel( ) ) if( DistanceToNearestRefuelPoint( sX, sY ) > HowFurtherCanHelicopterTravel( ) )
{ {
return( TRUE ); return( TRUE );
} }
return( FALSE ); return( FALSE );
} }
*/ */
@@ -505,12 +505,12 @@ void ReFuelHelicopter( void )
LandHelicopter( ); LandHelicopter( );
/* /*
AddStrategicEvent( EVENT_HELICOPTER_DONE_REFUELING, GetWorldTotalMin() + REFUEL_HELICOPTER_DELAY, 0 ); AddStrategicEvent( EVENT_HELICOPTER_DONE_REFUELING, GetWorldTotalMin() + REFUEL_HELICOPTER_DELAY, 0 );
// reset distance traveled // reset distance traveled
iTotalHeliDistanceSinceRefuel = 0; iTotalHeliDistanceSinceRefuel = 0;
*/ */
return; return;
} }
@@ -557,7 +557,7 @@ void SkyriderDestroyed( void )
// zero out balance due // zero out balance due
gMercProfiles[ SKYRIDER ].iBalance = 0; gMercProfiles[ SKYRIDER ].iBalance = 0;
// iTotalHeliDistanceSinceRefuel = 0; // iTotalHeliDistanceSinceRefuel = 0;
iTotalAccumulatedCostByPlayer = 0; iTotalAccumulatedCostByPlayer = 0;
// remove vehicle and reset // remove vehicle and reset
@@ -583,13 +583,13 @@ BOOLEAN CanHelicopterFly( void )
return( FALSE ); return( FALSE );
} }
/* /*
// travelled too far? // travelled too far?
if( iTotalHeliDistanceSinceRefuel > MAX_HELICOPTER_DISTANCE ) if( iTotalHeliDistanceSinceRefuel > MAX_HELICOPTER_DISTANCE )
{ {
return( FALSE ); return( FALSE );
} }
*/ */
// is the pilot alive, well, and willing to help us? // is the pilot alive, well, and willing to help us?
if( IsHelicopterPilotAvailable( ) == FALSE ) if( IsHelicopterPilotAvailable( ) == FALSE )
@@ -971,9 +971,9 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( void )
INT8 bNewSquad; INT8 bNewSquad;
BOOLEAN fAnyoneAboard = FALSE; BOOLEAN fAnyoneAboard = FALSE;
BOOLEAN fSuccess; BOOLEAN fSuccess;
UINT8 ubInsertionCode; UINT8 ubInsertionCode = 0;
BOOLEAN fInsertionCodeSet = FALSE; BOOLEAN fInsertionCodeSet = FALSE;
UINT16 usInsertionData; UINT16 usInsertionData = 0;
// put these guys on their own squad (we need to return their group ID, and can only return one, so they need a unique one // put these guys on their own squad (we need to return their group ID, and can only return one, so they need a unique one
@@ -1375,166 +1375,166 @@ INT16 LastSectorInHelicoptersPath( void )
/* /*
INT32 GetTotalCostOfHelicopterTrip( void ) INT32 GetTotalCostOfHelicopterTrip( void )
{ {
// get cost of helicopter trip // get cost of helicopter trip
PathStPtr pNode = NULL, pTempNode = NULL; PathStPtr pNode = NULL, pTempNode = NULL;
UINT32 uiCost = 0; UINT32 uiCost = 0;
UINT32 uiLastTempPathSectorId = 0; UINT32 uiLastTempPathSectorId = 0;
UINT32 iClosestRefuelPoint = 0; UINT32 iClosestRefuelPoint = 0;
UINT32 uiStartSectorNum = 0; UINT32 uiStartSectorNum = 0;
UINT32 uiLength = 0; UINT32 uiLength = 0;
// if the heli is on the move, what is the distance it will move..the length of the merc path, less the first node // if the heli is on the move, what is the distance it will move..the length of the merc path, less the first node
if( CanHelicopterFly( ) == FALSE ) if( CanHelicopterFly( ) == FALSE )
{ {
// big number, no go // big number, no go
return( 0 ); return( 0 );
} }
pNode = pVehicleList[ iHelicopterVehicleId ].pMercPath; pNode = pVehicleList[ iHelicopterVehicleId ].pMercPath;
// any path yet? // any path yet?
uiLastTempPathSectorId = pVehicleList[ iHelicopterVehicleId ].sSectorX + pVehicleList[ iHelicopterVehicleId ].sSectorY * MAP_WORLD_X; uiLastTempPathSectorId = pVehicleList[ iHelicopterVehicleId ].sSectorX + pVehicleList[ iHelicopterVehicleId ].sSectorY * MAP_WORLD_X;
uiStartSectorNum = uiLastTempPathSectorId; uiStartSectorNum = uiLastTempPathSectorId;
if( pNode ) if( pNode )
{ {
pNode = pNode->pNext; pNode = pNode->pNext;
} }
if( pNode != NULL ) if( pNode != NULL )
{ {
while( pNode) while( pNode)
{ {
if( uiLength == 0 ) if( uiLength == 0 )
{ {
if( pNode->pNext ) if( pNode->pNext )
{ {
if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) if( uiLastTempPathSectorId == pNode->pNext->uiSectorId )
{ {
// do nothing // do nothing
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
uiLength++; uiLength++;
uiLastTempPathSectorId = pNode ->uiSectorId; uiLastTempPathSectorId = pNode ->uiSectorId;
pNode = pNode ->pNext; pNode = pNode ->pNext;
} }
} }
pNode = NULL; pNode = NULL;
if( pTempHelicopterPath ) if( pTempHelicopterPath )
{ {
pNode = MoveToBeginningOfPathList( pTempHelicopterPath ); pNode = MoveToBeginningOfPathList( pTempHelicopterPath );
} }
if( pNode ) if( pNode )
{ {
pNode = pNode->pNext; pNode = pNode->pNext;
} }
// any path yet? // any path yet?
if( pNode != NULL ) if( pNode != NULL )
{ {
while( pNode ) while( pNode )
{ {
if( uiLength == 0 ) if( uiLength == 0 )
{ {
if( pNode->pNext ) if( pNode->pNext )
{ {
if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) if( uiLastTempPathSectorId == pNode->pNext->uiSectorId )
{ {
// do nothing // do nothing
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
} }
uiLength++; uiLength++;
//uiCost += GetCostOfPassageForHelicopter( ( UINT16 ) ( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); //uiCost += GetCostOfPassageForHelicopter( ( UINT16 ) ( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) );
uiLastTempPathSectorId = pNode ->uiSectorId; uiLastTempPathSectorId = pNode ->uiSectorId;
pNode = pNode ->pNext; pNode = pNode ->pNext;
} }
} }
iClosestRefuelPoint = ( INT16 )( CALCULATE_STRATEGIC_INDEX( ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 0 ], ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 1 ] ) ); iClosestRefuelPoint = ( INT16 )( CALCULATE_STRATEGIC_INDEX( ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 0 ], ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 1 ] ) );
pNode = NULL; pNode = NULL;
if( uiLastTempPathSectorId != iClosestRefuelPoint ) if( uiLastTempPathSectorId != iClosestRefuelPoint )
{ {
pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE ); pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE );
// pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE, TRUE ); // pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE, TRUE );
pNode = MoveToBeginningOfPathList( pNode ); pNode = MoveToBeginningOfPathList( pNode );
} }
pTempNode = pNode; pTempNode = pNode;
uiLength = 0; uiLength = 0;
if( pTempNode ) if( pTempNode )
{ {
pTempNode = pTempNode->pNext; pTempNode = pTempNode->pNext;
} }
while( pTempNode ) while( pTempNode )
{ {
if( uiLength == 0 ) if( uiLength == 0 )
{ {
if( pTempNode->pNext ) if( pTempNode->pNext )
{ {
if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) if( uiLastTempPathSectorId == pNode->pNext->uiSectorId )
{ {
// do nothing // do nothing
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) );
} }
} }
else else
{ {
uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) );
} }
uiLength++; uiLength++;
pTempNode = pTempNode->pNext; pTempNode = pTempNode->pNext;
} }
return( ( INT32 )uiCost ); return( ( INT32 )uiCost );
} }
*/ */
+3
View File
@@ -6387,6 +6387,9 @@ void HandleLowerLevelMapBlit( void )
case( 3 ): case( 3 ):
GetVideoObject( &hHandle, guiSubLevel3 ); GetVideoObject( &hHandle, guiSubLevel3 );
break; break;
default:
AssertMsg( 0, "Invalid underground sector level");
return;
} }
// handle the blt of the sublevel // handle the blt of the sublevel
+1
View File
@@ -761,6 +761,7 @@ void ProcessImplicationsOfMeanwhile( void )
else else
{ {
Assert( 0 ); Assert( 0 );
return;
} }
gMercProfiles[ MADLAB ].sSectorX = sSectorX; gMercProfiles[ MADLAB ].sSectorX = sSectorX;
gMercProfiles[ MADLAB ].sSectorY = sSectorY; gMercProfiles[ MADLAB ].sSectorY = sSectorY;
+1 -1
View File
@@ -1745,7 +1745,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
PLAYERGROUP *pPlayer, *pNextPlayer; PLAYERGROUP *pPlayer, *pNextPlayer;
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
INT8 bUniqueVehicleSquad = -1; INT8 bUniqueVehicleSquad = -1;
BOOLEAN fSuccess; BOOLEAN fSuccess = FALSE;
if ( pGroup->fVehicle ) if ( pGroup->fVehicle )
+6
View File
@@ -1341,8 +1341,10 @@ void AddPossiblePendingEnemiesToBattle()
else if( pGroup->ubSectorY > pGroup->ubPrevY ) else if( pGroup->ubSectorY > pGroup->ubPrevY )
ubInsertionCode = INSERTION_CODE_NORTH; ubInsertionCode = INSERTION_CODE_NORTH;
else else
{
Assert(0); Assert(0);
} }
}
else if( pGroup->ubNextX && pGroup->ubNextY ) else if( pGroup->ubNextX && pGroup->ubNextY )
{ {
if( pGroup->ubSectorX < pGroup->ubNextX ) if( pGroup->ubSectorX < pGroup->ubNextX )
@@ -1354,11 +1356,15 @@ void AddPossiblePendingEnemiesToBattle()
else if( pGroup->ubSectorY > pGroup->ubNextY ) else if( pGroup->ubSectorY > pGroup->ubNextY )
ubInsertionCode = INSERTION_CODE_NORTH; ubInsertionCode = INSERTION_CODE_NORTH;
else else
{
Assert(0); Assert(0);
} }
}
else else
{
// The group has no movement orders. Where did it come from? // The group has no movement orders. Where did it come from?
Assert(0); Assert(0);
}
if( pGroup->pEnemyGroup->ubElitesInBattle < pGroup->pEnemyGroup->ubNumElites ) if( pGroup->pEnemyGroup->ubElitesInBattle < pGroup->pEnemyGroup->ubNumElites )
{ //Add an elite troop { //Add an elite troop
+42 -87
View File
@@ -1,28 +1,29 @@
#ifdef PRECOMPILEDHEADERS #ifdef PRECOMPILEDHEADERS
#include "Strategic All.h" #include "Strategic All.h"
#else #else
#include "Town Militia.h" #include "Town Militia.h"
#include "Militia Control.h" #include "Militia Control.h"
#include "Campaign Types.h" #include "Campaign Types.h"
#include "strategic.h" #include "strategic.h"
#include "strategicmap.h" #include "strategicmap.h"
#include "Overhead.h" #include "Overhead.h"
#include "Strategic Town Loyalty.h" #include "Strategic Town Loyalty.h"
#include "Utilities.h" #include "Utilities.h"
#include "random.h" #include "random.h"
#include "text.h" #include "text.h"
#include "Map Screen Interface.h" #include "Map Screen Interface.h"
#include "Interface.h" #include "Interface.h"
#include "Laptopsave.h" #include "Laptopsave.h"
#include "finances.h" #include "finances.h"
#include "Game Clock.h" #include "Game Clock.h"
#include "Assignments.h" #include "Assignments.h"
#include "squads.h" #include "squads.h"
#include "Soldier Create.h" #include "Soldier Create.h"
#include "Dialogue Control.h" #include "Dialogue Control.h"
#include "Queen Command.h" #include "Queen Command.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Soldier Init List.h" #include "Soldier Init List.h"
#include "Inventory Choosing.h"
#endif #endif
#include "Reinforcement.h" #include "Reinforcement.h"
@@ -260,78 +261,24 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir, GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES ); ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
#if 0
// Combine this with the next part so that reinforcements from enemy groups can also come in from random sides
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ ) for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
if( 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 ] ) ); while ((pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) ) != NULL)
{
pGroup->ubPrevX = pGroup->ubSectorX; pGroup->ubPrevX = pGroup->ubSectorX;
pGroup->ubPrevY = pGroup->ubSectorY; pGroup->ubPrevY = pGroup->ubSectorY;
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX; pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX;
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY; pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY;
return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; gfPendingEnemies = TRUE;
ResetMortarsOnTeamCount();
}
} }
#endif
if( NumEnemiesInFiveSectors( sMapX, sMapY ) - NumEnemiesInSector( sMapX, sMapY ) == 0 ) while( ubDirNumber > 0)
{
return 255;
}else
for(;;)
{ {
ubIndex = Random(ubDirNumber); ubIndex = Random(ubDirNumber);
#if 0
// This should be handled in AddPossiblePendingEnemiesToBattle
if( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
{
UINT8 numElite;
UINT8 numTroop;
UINT8 numAdmin;
pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
pEnemyGroup = pGroup->pEnemyGroup;
numElite = pEnemyGroup->ubNumElites - pEnemyGroup->ubElitesInBattle;
numTroop = pEnemyGroup->ubNumTroops - pEnemyGroup->ubTroopsInBattle;
numAdmin = pEnemyGroup->ubNumAdmins - pEnemyGroup->ubAdminsInBattle;
if (numElite + numTroop + numAdmin <= 1)
{
// The entire group has finally moved into the sector.
pGroup->ubPrevX = pGroup->ubSectorX;
pGroup->ubPrevY = pGroup->ubSectorY;
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX;
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY;
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
}
if (numAdmin + numTroop + numElite)
{
// Otherwise we move a soldier into the sector from the group
if( numElite )
{
(pThisSector->ubNumElites)++;
(pEnemyGroup->ubElitesInBattle)++;
}else if( numTroop )
{
(pThisSector->ubNumTroops)++;
(pEnemyGroup->ubTroopsInBattle)++;
}else if( numAdmin )
{
(pThisSector->ubNumAdmins)++;
(pEnemyGroup->ubAdminsInBattle)++;
}
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
}
}
#endif
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize ) if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
{ {
@@ -363,7 +310,15 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
} }
else
{
// If there are no reinforcements from this direction, remove this as a direction
memcpy( &(pusMoveDir[ubIndex][0]), &(pusMoveDir[ --ubDirNumber][0]), sizeof(pusMoveDir[0]));
} }
}
// No reinforcements from other sectors are available
return 255;
} }
@@ -391,7 +346,7 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
if( !gGameExternalOptions.gfAllowReinforcements ) if( !gGameExternalOptions.gfAllowReinforcements )
return 255; return 255;
// pThisSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ]; // pThisSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ];
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir, GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES ); ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
@@ -441,14 +396,14 @@ void AddPossiblePendingMilitiaToBattle()
static UINT8 ubPredefinedInsertionCode = 255; static UINT8 ubPredefinedInsertionCode = 255;
static UINT8 ubPredefinedRank = 255; static UINT8 ubPredefinedRank = 255;
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) // if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return; // || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 )
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS) || !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY )
) )
return; return;
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ); //gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
ubSlots = NumFreeMilitiaSlots(); ubSlots = NumFreeMilitiaSlots();
if( !ubSlots ) if( !ubSlots )
{ //no available slots to add militia to. Try again later... { //no available slots to add militia to. Try again later...
+3
View File
@@ -78,6 +78,9 @@ void HandleStrategicTurn( )
} }
else else
{ {
// If none of these conditions are true, then don't do an end of turn
uiCheckTime = 0xffffffff;
if ( giTimeCompressMode == TIME_COMPRESS_X1 || giTimeCompressMode == 0 ) if ( giTimeCompressMode == TIME_COMPRESS_X1 || giTimeCompressMode == 0 )
{ {
uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN; uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -3075,7 +3075,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16
SOLDIERTYPE *pValidSoldier = NULL; SOLDIERTYPE *pValidSoldier = NULL;
GROUP *pGroup; GROUP *pGroup;
UINT32 uiTraverseTime=0; UINT32 uiTraverseTime=0;
UINT8 ubDirection; UINT8 ubDirection = 0xff;
EXITGRID ExitGrid; EXITGRID ExitGrid;
INT8 bPrevAssignment; INT8 bPrevAssignment;
UINT8 ubPrevGroupID; UINT8 ubPrevGroupID;
+1 -1
View File
@@ -532,7 +532,7 @@ void HandleDialogue( )
} }
} }
// OK, check if we are still taking // OK, check if we are still talking
if ( gpCurrentTalkingFace != NULL ) if ( gpCurrentTalkingFace != NULL )
{ {
if ( gpCurrentTalkingFace->fTalking ) if ( gpCurrentTalkingFace->fTalking )
+1 -1
View File
@@ -35,7 +35,7 @@
#include "Scheduling.h" #include "Scheduling.h"
#endif #endif
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode ); BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode, GROUP *pGroup = NULL );
BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 *pubNumElites, UINT8 *pubNumRegulars, UINT8 *pubNumAdmins, UINT8 *pubNumCreatures ); BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 *pubNumElites, UINT8 *pubNumRegulars, UINT8 *pubNumAdmins, UINT8 *pubNumCreatures );
+1 -1
View File
@@ -294,7 +294,7 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U
{ {
STRUCTURE * pBaseStructure; STRUCTURE * pBaseStructure;
BOOLEAN fDoMenu = FALSE; BOOLEAN fDoMenu = FALSE;
DOOR * pDoor; DOOR * pDoor = NULL;
DOOR_STATUS * pDoorStatus; DOOR_STATUS * pDoorStatus;
BOOLEAN fTrapsFound = FALSE; BOOLEAN fTrapsFound = FALSE;
+104 -103
View File
@@ -1,65 +1,65 @@
#ifdef PRECOMPILEDHEADERS #ifdef PRECOMPILEDHEADERS
#include "Tactical All.h" #include "Tactical All.h"
#else #else
#include "items.h" #include "items.h"
#include "Action Items.h" #include "Action Items.h"
#include "handle Items.h" #include "handle Items.h"
#include "overhead.h" #include "overhead.h"
#include "weapons.h" #include "weapons.h"
#include "points.h" #include "points.h"
#include "tiledef.h" #include "tiledef.h"
#include "worlddef.h" #include "worlddef.h"
#include "worldman.h" #include "worldman.h"
#include "interface.h" #include "interface.h"
#include "renderworld.h" #include "renderworld.h"
#include "Animation Control.h" #include "Animation Control.h"
#include "font control.h" #include "font control.h"
#include "render dirty.h" #include "render dirty.h"
#include "World items.h" #include "World items.h"
#include "text.h" #include "text.h"
#include "Timer Control.h" #include "Timer Control.h"
#include "wcheck.h" #include "wcheck.h"
#include "interface items.h" #include "interface items.h"
#include "physics.h" #include "physics.h"
#include "soldier profile.h" #include "soldier profile.h"
#include "interface dialogue.h" #include "interface dialogue.h"
#include "quests.h" #include "quests.h"
#include "message.h" #include "message.h"
#include "isometric utils.h" #include "isometric utils.h"
#include "los.h" #include "los.h"
#include "dialogue control.h" #include "dialogue control.h"
#include "ai.h" #include "ai.h"
#include "soldier macros.h" #include "soldier macros.h"
#include "interface panels.h" #include "interface panels.h"
#include "Strategic Town Loyalty.h" #include "Strategic Town Loyalty.h"
#include "soldier functions.h" #include "soldier functions.h"
#include "Map Screen Helicopter.h" #include "Map Screen Helicopter.h"
#include "pathai.h" #include "pathai.h"
#include "fov.h" #include "fov.h"
#include "MessageBoxScreen.h" #include "MessageBoxScreen.h"
#include "explosion control.h" #include "explosion control.h"
#include "SkillCheck.h" #include "SkillCheck.h"
#include "Campaign.h" #include "Campaign.h"
#include "Random.h" #include "Random.h"
#include "structure wrap.h" #include "structure wrap.h"
#include "interactive tiles.h" #include "interactive tiles.h"
#include "SaveLoadMap.h" #include "SaveLoadMap.h"
#include "ShopKeeper Interface.h" #include "ShopKeeper Interface.h"
#include "Arms Dealer Init.h" #include "Arms Dealer Init.h"
#include "soldier add.h" #include "soldier add.h"
#include "sound control.h" #include "sound control.h"
#include "squads.h" #include "squads.h"
#include "rotting corpses.h" #include "rotting corpses.h"
#include "soldier ani.h" #include "soldier ani.h"
#include "Opplist.h" #include "Opplist.h"
#include "qarray.h" #include "qarray.h"
#include "render fun.h" #include "render fun.h"
#include "environment.h" #include "environment.h"
#include "Map Information.h" #include "Map Information.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "end game.h" #include "end game.h"
#include "interface control.h" #include "interface control.h"
#include "Map Screen Interface Map Inventory.h" #include "Map Screen Interface Map Inventory.h"
#endif #endif
#define NUM_ITEMS_LISTED 8 #define NUM_ITEMS_LISTED 8
@@ -182,7 +182,7 @@ BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE
INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI ) INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI )
{ {
SOLDIERTYPE *pTargetSoldier = NULL; SOLDIERTYPE *pTargetSoldier = NULL;
UINT16 usSoldierIndex; UINT16 usSoldierIndex;
@@ -196,7 +196,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
BOOLEAN fAddingRaiseGunCost = FALSE; BOOLEAN fAddingRaiseGunCost = FALSE;
LEVELNODE *pIntNode; LEVELNODE *pIntNode;
STRUCTURE *pStructure; STRUCTURE *pStructure;
INT16 sGridNo;
// Remove any previous actions // Remove any previous actions
@@ -207,8 +206,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
pSoldier->usAttackingWeapon = usHandItem; pSoldier->usAttackingWeapon = usHandItem;
// Find soldier flags depend on if it's our own merc firing or a NPC // Find soldier flags depend on if it's our own merc firing or a NPC
//if ( FindSoldier( usGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) //if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
if ( ( usSoldierIndex = WhoIsThere2( usGridNo, bLevel ) ) != NO_SOLDIER ) if ( ( usSoldierIndex = WhoIsThere2( sGridNo, bLevel ) ) != NO_SOLDIER )
{ {
pTargetSoldier = MercPtrs[ usSoldierIndex ]; pTargetSoldier = MercPtrs[ usSoldierIndex ];
@@ -232,10 +231,10 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
gTacticalStatus.ubAttackBusyCount = 0; gTacticalStatus.ubAttackBusyCount = 0;
} }
// if ( pTargetSoldier ) // if ( pTargetSoldier )
// { // {
// pTargetSoldier->bBeingAttackedCount = 0; // pTargetSoldier->bBeingAttackedCount = 0;
// } // }
// Check our soldier's life for unconscious! // Check our soldier's life for unconscious!
@@ -376,7 +375,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
else else
{ {
sTargetGridNo = usGridNo; sTargetGridNo = sGridNo;
} }
// If it's a player guy, check ChanceToGetThrough to play quote // If it's a player guy, check ChanceToGetThrough to play quote
@@ -626,6 +625,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
UINT8 ubGuyThere; UINT8 ubGuyThere;
INT16 sGotLocation = NOWHERE; INT16 sGotLocation = NOWHERE;
BOOLEAN fGotAdjacent = FALSE; BOOLEAN fGotAdjacent = FALSE;
sAdjustedGridNo = NOWHERE;
ubDirection = 0xff;
for ( sCnt = 0; sCnt < NUM_WORLD_DIRECTIONS; sCnt++ ) for ( sCnt = 0; sCnt < NUM_WORLD_DIRECTIONS; sCnt++ )
{ {
@@ -654,7 +655,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( sGotLocation == NOWHERE ) if ( sGotLocation == NOWHERE )
{ {
// See if we can get there to punch // See if we can get there to punch
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
// OK, we've got somebody... // OK, we've got somebody...
@@ -667,9 +668,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// Did we get a loaction? // Did we get a loaction?
if ( sGotLocation != NOWHERE ) if ( sGotLocation != NOWHERE )
{ {
pSoldier->sTargetGridNo = usGridNo; pSoldier->sTargetGridNo = sGridNo;
pSoldier->usActionData = usGridNo; pSoldier->usActionData = sGridNo;
// CHECK IF WE ARE AT THIS GRIDNO NOW // CHECK IF WE ARE AT THIS GRIDNO NOW
if ( pSoldier->sGridNo != sGotLocation && fGotAdjacent ) if ( pSoldier->sGridNo != sGotLocation && fGotAdjacent )
{ {
@@ -710,7 +711,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if (gTacticalStatus.fAutoBandageMode) if (gTacticalStatus.fAutoBandageMode)
{ {
usMapPos = usGridNo; usMapPos = sGridNo;
} }
else else
{ {
@@ -718,7 +719,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
// See if we can get there to stab // See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo == -1 ) if ( sActionGridNo == -1 )
{ {
// Try another location... // Try another location...
@@ -762,7 +763,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
else else
{ {
pSoldier->sPendingActionData2 = usGridNo; pSoldier->sPendingActionData2 = sGridNo;
} }
} }
pSoldier->bPendingActionData3 = ubDirection; pSoldier->bPendingActionData3 = ubDirection;
@@ -792,7 +793,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL ) // Madd: quick fix to allow wirecutter/knives if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL ) // Madd: quick fix to allow wirecutter/knives
{ {
// See if we can get there to stab // See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
// Calculate AP costs... // Calculate AP costs...
@@ -847,7 +848,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
INT16 sVehicleGridNo=-1; INT16 sVehicleGridNo=-1;
// For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle! // For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle!
if ( IsRepairableStructAtGridNo( usGridNo, &ubMercID ) == 2 ) if ( IsRepairableStructAtGridNo( sGridNo, &ubMercID ) == 2 )
{ {
INT16 sNewGridNo; INT16 sNewGridNo;
UINT8 ubDirection; UINT8 ubDirection;
@@ -856,7 +857,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( sNewGridNo != NOWHERE ) if ( sNewGridNo != NOWHERE )
{ {
usGridNo = sNewGridNo; sGridNo = sNewGridNo;
sVehicleGridNo = MercPtrs[ ubMercID ]->sGridNo; sVehicleGridNo = MercPtrs[ ubMercID ]->sGridNo;
@@ -865,7 +866,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
// See if we can get there to stab // See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
@@ -925,7 +926,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
INT16 sVehicleGridNo=-1; INT16 sVehicleGridNo=-1;
// For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle! // For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle!
if ( IsRefuelableStructAtGridNo( usGridNo, &ubMercID ) ) if ( IsRefuelableStructAtGridNo( sGridNo, &ubMercID ) )
{ {
INT16 sNewGridNo; INT16 sNewGridNo;
UINT8 ubDirection; UINT8 ubDirection;
@@ -934,7 +935,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( sNewGridNo != NOWHERE ) if ( sNewGridNo != NOWHERE )
{ {
usGridNo = sNewGridNo; sGridNo = sNewGridNo;
sVehicleGridNo = MercPtrs[ ubMercID ]->sGridNo; sVehicleGridNo = MercPtrs[ ubMercID ]->sGridNo;
@@ -942,7 +943,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
// See if we can get there to stab // See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
@@ -995,7 +996,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( Item[usHandItem].jar ) if ( Item[usHandItem].jar )
{ {
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
@@ -1049,12 +1050,12 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
LEVELNODE *pIntTile; LEVELNODE *pIntTile;
// Get structure info for in tile! // Get structure info for in tile!
pIntTile = GetCurInteractiveTileGridNoAndStructure( (INT16 *)&usGridNo, &pStructure ); pIntTile = GetCurInteractiveTileGridNoAndStructure( (INT16 *)&sGridNo, &pStructure );
// We should not have null here if we are given this flag... // We should not have null here if we are given this flag...
if ( pIntTile != NULL ) if ( pIntTile != NULL )
{ {
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE );
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
{ {
@@ -1069,7 +1070,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
{ {
// SEND PENDING ACTION // SEND PENDING ACTION
pSoldier->ubPendingAction = MERC_ATTACH_CAN; pSoldier->ubPendingAction = MERC_ATTACH_CAN;
pSoldier->sPendingActionData2 = usGridNo; pSoldier->sPendingActionData2 = sGridNo;
pSoldier->bPendingActionData3 = ubDirection; pSoldier->bPendingActionData3 = ubDirection;
pSoldier->ubPendingActionAnimCount = 0; pSoldier->ubPendingActionAnimCount = 0;
@@ -1078,7 +1079,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
else else
{ {
EVENT_SoldierBeginTakeBlood( pSoldier, usGridNo, ubDirection ); EVENT_SoldierBeginTakeBlood( pSoldier, sGridNo, ubDirection );
} }
// OK, set UI // OK, set UI
@@ -1125,7 +1126,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
else // detonator else // detonator
{ {
// Save gridno.... // Save gridno....
pSoldier->sPendingActionData2 = usGridNo; pSoldier->sPendingActionData2 = sGridNo;
EVENT_SoldierBeginUseDetonator( pSoldier ); EVENT_SoldierBeginUseDetonator( pSoldier );
@@ -1164,16 +1165,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( fDropBomb ) if ( fDropBomb )
{ {
// Save gridno.... // Save gridno....
pSoldier->sPendingActionData2 = usGridNo; pSoldier->sPendingActionData2 = sGridNo;
if ( pSoldier->sGridNo != usGridNo ) if ( pSoldier->sGridNo != sGridNo )
{ {
// SEND PENDING ACTION // SEND PENDING ACTION
pSoldier->ubPendingAction = MERC_DROPBOMB; pSoldier->ubPendingAction = MERC_DROPBOMB;
pSoldier->ubPendingActionAnimCount = 0; pSoldier->ubPendingActionAnimCount = 0;
// WALK UP TO DEST FIRST // WALK UP TO DEST FIRST
EVENT_InternalGetNewSoldierPath( pSoldier, usGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); EVENT_InternalGetNewSoldierPath( pSoldier, sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE );
} }
else else
{ {
@@ -1197,19 +1198,19 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// See if we can get there to stab // See if we can get there to stab
if ( pSoldier->ubBodyType == BLOODCAT ) if ( pSoldier->ubBodyType == BLOODCAT )
{ {
sActionGridNo = FindNextToAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
} }
else if ( CREATURE_OR_BLOODCAT( pSoldier ) && PythSpacesAway( pSoldier->sGridNo, usGridNo ) > 1 ) else if ( CREATURE_OR_BLOODCAT( pSoldier ) && PythSpacesAway( pSoldier->sGridNo, sGridNo ) > 1 )
{ {
sActionGridNo = FindNextToAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if (sActionGridNo == -1) if (sActionGridNo == -1)
{ {
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
} }
} }
else else
{ {
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
} }
if ( sActionGridNo != -1 ) if ( sActionGridNo != -1 )
@@ -1260,7 +1261,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
//pSoldier->sLastTarget = sTargetGridNo; //pSoldier->sLastTarget = sTargetGridNo;
//pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel ); //pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel );
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting swipe attack, incrementing a.b.c in HandleItems to %d", gTacticalStatus.ubAttackBusyCount) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting swipe attack, incrementing a.b.c in HandleItems to %d", gTacticalStatus.ubAttackBusyCount) );
DebugAttackBusy( "Swipe attack\n"); DebugAttackBusy( "Swipe attack\n");
@@ -1290,7 +1291,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
} }
else else
{ {
sTargetGridNo = usGridNo; sTargetGridNo = sGridNo;
} }
sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE ); sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE );
@@ -1347,7 +1348,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel ); pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel );
// Increment attack counter... // Increment attack counter...
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
DebugAttackBusy( "Weapon fire\n"); DebugAttackBusy( "Weapon fire\n");
@@ -1384,7 +1385,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// Found detonator... // Found detonator...
if ( IsDetonatorAttached ( &(pSoldier->inv[ usHandItem ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ usHandItem ] ) ) ) if ( IsDetonatorAttached ( &(pSoldier->inv[ usHandItem ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ usHandItem ] ) ) )
{ {
StartBombMessageBox( pSoldier, usGridNo ); StartBombMessageBox( pSoldier, sGridNo );
if ( fFromUI ) if ( fFromUI )
{ {
@@ -1555,7 +1556,7 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo )
pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED; pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED;
} }
break; break;
//</SB> //</SB>
} }
} }
@@ -5351,7 +5352,7 @@ BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay )
UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet) UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet)
{ {
UINT8 ubCount=0; UINT8 ubCount=0;
ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool; ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool = NULL;
OBJECTTYPE *pObject; OBJECTTYPE *pObject;
UINT8 i; UINT8 i;
BOOLEAN fStealItem = FALSE; BOOLEAN fStealItem = FALSE;
@@ -5480,7 +5481,7 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,
{ {
// WDS - Clean up inventory handling // WDS - Clean up inventory handling
// Make copy of item // Make copy of item
// memcpy( &Object, pOpponent->inv+pTempItemPool->iItemIndex, sizeof( OBJECTTYPE ) ); // memcpy( &Object, pOpponent->inv+pTempItemPool->iItemIndex, sizeof( OBJECTTYPE ) );
Object = pOpponent->inv[pTempItemPool->iItemIndex]; Object = pOpponent->inv[pTempItemPool->iItemIndex];
if ( ItemIsCool( &Object ) ) if ( ItemIsCool( &Object ) )
{ {
+1 -1
View File
@@ -82,7 +82,7 @@ typedef struct
// WDS - Clean up inventory handling // WDS - Clean up inventory handling
class SOLDIERTYPE; class SOLDIERTYPE;
INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI ); INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI );
void SoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel ); void SoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel );
void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel ); void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel );
void HandleFlashingItems( ); void HandleFlashingItems( );
+1 -1
View File
@@ -3597,7 +3597,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
case NPC_ACTION_START_DOCTORING: case NPC_ACTION_START_DOCTORING:
{ {
// reset fact he is expecting money fromt he player // reset fact he is expecting money fromt the player
SetFactFalse( FACT_VINCE_EXPECTING_MONEY ); SetFactFalse( FACT_VINCE_EXPECTING_MONEY );
// check fact // check fact
+6 -3
View File
@@ -2266,6 +2266,10 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
sFontY = sY + 1; sFontY = sY + 1;
gprintfinvalidate( sFontX, sFontY, pStr ); gprintfinvalidate( sFontX, sFontY, pStr );
// Squelch the compiler warnings
sFontX2 = sX;
sFontY2 = sY;
if ( fLineSplit ) if ( fLineSplit )
{ {
VarFindFontCenterCoordinates( sX, sY, sWidth, sHeight , ITEM_FONT, &sFontX2, &sFontY2, pStr2 ); VarFindFontCenterCoordinates( sX, sY, sWidth, sHeight , ITEM_FONT, &sFontX2, &sFontY2, pStr2 );
@@ -2273,8 +2277,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
gprintfinvalidate( sFontX2, sFontY2, pStr2 ); gprintfinvalidate( sFontX2, sFontY2, pStr2 );
} }
}
if ( *pubHighlightCounter == 2 ) if ( *pubHighlightCounter == 2 )
{ {
mprintf( sFontX, sFontY, pStr ); mprintf( sFontX, sFontY, pStr );
@@ -2295,6 +2297,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
} }
} }
}
} }
@@ -4117,7 +4120,7 @@ void DeleteItemDescriptionBox( )
{ {
INT32 cnt, cnt2; INT32 cnt, cnt2;
BOOLEAN fFound, fAllFound; BOOLEAN fFound, fAllFound;
UINT8 ubAPCost; UINT8 ubAPCost = 0;
if( gfInItemDescBox == FALSE ) if( gfInItemDescBox == FALSE )
{ {
+1 -1
View File
@@ -1827,7 +1827,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
INT16 sFontX, sFontY; INT16 sFontX, sFontY;
INT16 usX, usY; INT16 usX, usY;
CHAR16 sString[9]; CHAR16 sString[9];
UINT32 cnt; UINT32 cnt = 0xff000000; // Give a value that ought to crash it if this is really undefined for the robot
static CHAR16 pStr[ 200 ], pMoraleStr[ 20 ]; static CHAR16 pStr[ 200 ], pMoraleStr[ 20 ];
if ( gubSelectSMPanelToMerc != NOBODY ) if ( gubSelectSMPanelToMerc != NOBODY )
+23 -15
View File
@@ -2993,6 +2993,11 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
{ {
FilenameForBPP("INTERFACE\\rect_1024x768.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\rect_1024x768.sti", VObjectDesc.ImageFile);
} }
else
{
AssertMsg( 0, "Invalid resolution");
return;
}
if( !AddVideoObject( &VObjectDesc, &uiBAR ) ) if( !AddVideoObject( &VObjectDesc, &uiBAR ) )
AssertMsg(0, "Missing INTERFACE\\rect.sti" ); AssertMsg(0, "Missing INTERFACE\\rect.sti" );
@@ -3003,40 +3008,44 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution == 0) if (iResolution == 0)
{ {
FilenameForBPP("INTERFACE\\timebargreen.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebargreen.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebargreen.sti" );
} }
else if (iResolution == 1) else if (iResolution == 1)
{ {
FilenameForBPP("INTERFACE\\timebargreen_800x600.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebargreen_800x600.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebargreen_800x600.sti" );
} }
else if (iResolution == 2) else if (iResolution == 2)
{ {
FilenameForBPP("INTERFACE\\timebargreen_1024x768.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebargreen_1024x768.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebargreen_1024x768.sti" );
} }
else
{
AssertMsg( 0, "Invalid resolution");
return;
}
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, String( "Missing %s", VObjectDesc.ImageFile) );
if (iResolution == 0) if (iResolution == 0)
{ {
FilenameForBPP("INTERFACE\\timebaryellow.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebaryellow.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebaryellow.sti" );
} }
else if (iResolution == 1) else if (iResolution == 1)
{ {
FilenameForBPP("INTERFACE\\timebaryellow_800x600.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebaryellow_800x600.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebaryellow_800x600.sti" );
} }
else if (iResolution == 2) else if (iResolution == 2)
{ {
FilenameForBPP("INTERFACE\\timebaryellow_1024x768.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\timebaryellow_1024x768.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebaryellow_1024x768.sti" );
} }
else
{
AssertMsg( 0, "Invalid resolution");
return;
}
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, String( "Missing %s", VObjectDesc.ImageFile) );
// Change dest buffer // Change dest buffer
SetFontDestBuffer( uiSurface , 0, 0, SCREEN_WIDTH , 20, FALSE ); SetFontDestBuffer( uiSurface , 0, 0, SCREEN_WIDTH , 20, FALSE );
@@ -3837,13 +3846,12 @@ void RenderAimCubeUI( )
if ( gfInAimCubeUI ) if ( gfInAimCubeUI )
{ {
// Determine screen location....
GetGridNoScreenPos( gCubeUIData.sGridNo, gCubeUIData.ubLevel, &sScreenX, &sScreenY );
// OK, given height // OK, given height
if ( gCubeUIData.fShowHeight ) if ( gCubeUIData.fShowHeight )
{ {
// Determine screen location....
GetGridNoScreenPos( gCubeUIData.sGridNo, gCubeUIData.ubLevel, &sScreenX, &sScreenY );
// Save background // Save background
iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sScreenX, (INT16)(sScreenY - 70 ), (INT16)(sScreenX + 40 ), (INT16)(sScreenY + 50 ) ); iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sScreenX, (INT16)(sScreenY - 70 ), (INT16)(sScreenX + 40 ), (INT16)(sScreenY + 50 ) );
if ( iBack != -1 ) if ( iBack != -1 )
+2
View File
@@ -3576,6 +3576,8 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
ddOrigHorizAngle = atan2( dDeltaY, dDeltaX ); ddOrigHorizAngle = atan2( dDeltaY, dDeltaX );
ddOrigVerticAngle = atan2( dDeltaZ, (d2DDistance * 2.56f) ); ddOrigVerticAngle = atan2( dDeltaZ, (d2DDistance * 2.56f) );
ddAdjustedHorizAngle = ddOrigHorizAngle;
ddAdjustedVerticAngle = ddOrigVerticAngle;
ubShots = 1; ubShots = 1;
fTracer = FALSE; fTracer = FALSE;
+1 -1
View File
@@ -1059,7 +1059,7 @@ void HandleShadingOfLinesForMilitiaControlMenu( void )
BOOLEAN CheckIfRadioIsEquipped( void ) BOOLEAN CheckIfRadioIsEquipped( void )
{ {
SOLDIERTYPE *pSoldier = NULL; SOLDIERTYPE *pSoldier = NULL;
INT8 bSlot; INT8 bSlot = NO_SLOT;
// do we have a radio ? // do we have a radio ?
//pSoldier = GetSelectedAssignSoldier( FALSE ); //do not use //pSoldier = GetSelectedAssignSoldier( FALSE ); //do not use
+4 -1
View File
@@ -3111,7 +3111,7 @@ void RebuildAllSoldierShadeTables( )
void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier )
{ {
INT32 cnt; INT32 cnt;
INT32 iNewSelectedSoldier; INT32 iNewSelectedSoldier = -1;
SOLDIERTYPE *pTeamSoldier; SOLDIERTYPE *pTeamSoldier;
BOOLEAN fMissionFailed = TRUE; BOOLEAN fMissionFailed = TRUE;
INT8 bBuddyIndex; INT8 bBuddyIndex;
@@ -8340,6 +8340,9 @@ void DoCreatureTensionQuote( SOLDIERTYPE *pSoldier )
fCanDoQuote = FALSE; fCanDoQuote = FALSE;
} }
break; break;
default:
AssertMsg(0, "Invalid quote");
return;
} }
if ( fCanDoQuote ) if ( fCanDoQuote )
+168 -168
View File
@@ -1,46 +1,46 @@
/* /*
Filename : pathai.c Filename : pathai.c
Author : Ray E. Bornert II Author : Ray E. Bornert II
Date : 1992-MAR-15 Date : 1992-MAR-15
Skip list additions Skip list additions
Author : Chris Camfield Author : Chris Camfield
Date : 1997-NOV Date : 1997-NOV
*/ */
#ifdef PRECOMPILEDHEADERS #ifdef PRECOMPILEDHEADERS
#include "Tactical All.h" #include "Tactical All.h"
#else #else
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "wcheck.h" #include "wcheck.h"
#include "stdlib.h" #include "stdlib.h"
#include "debug.h" #include "debug.h"
#include "MemMan.h" #include "MemMan.h"
#include "Overhead Types.h" #include "Overhead Types.h"
#include "Soldier Control.h" #include "Soldier Control.h"
#include "Animation Cache.h" #include "Animation Cache.h"
#include "Animation Data.h" #include "Animation Data.h"
#include "Animation Control.h" #include "Animation Control.h"
#include "container.h" #include "container.h"
#include "interface.h" #include "interface.h"
#include <math.h> #include <math.h>
#include "input.h" #include "input.h"
#include "english.h" #include "english.h"
#include "worlddef.h" #include "worlddef.h"
#include "worldman.h" #include "worldman.h"
#include "renderworld.h" #include "renderworld.h"
#include "pathai.h" #include "pathai.h"
#include "PathAIDebug.h" #include "PathAIDebug.h"
#include "Points.h" #include "Points.h"
#include "ai.h" #include "ai.h"
#include "Random.h" #include "Random.h"
#include "message.h" #include "message.h"
#include "structure wrap.h" #include "structure wrap.h"
#include "keys.h" #include "keys.h"
#include "gamesettings.h" #include "gamesettings.h"
#include "Buildings.h" #include "Buildings.h"
#endif #endif
#include "PathAIDebug.h" #include "PathAIDebug.h"
@@ -71,14 +71,14 @@ UINT8 gubBuildingInfoToSet;
// ABSOLUTE maximums // ABSOLUTE maximums
//#ifdef JA2EDITOR //#ifdef JA2EDITOR
#define ABSMAX_SKIPLIST_LEVEL 5 #define ABSMAX_SKIPLIST_LEVEL 5
#define ABSMAX_TRAIL_TREE (16384) #define ABSMAX_TRAIL_TREE (16384)
#define ABSMAX_PATHQ (512) #define ABSMAX_PATHQ (512)
/* /*
#else #else
#define ABSMAX_SKIPLIST_LEVEL 5 #define ABSMAX_SKIPLIST_LEVEL 5
#define ABSMAX_TRAIL_TREE (4096) #define ABSMAX_TRAIL_TREE (4096)
#define ABSMAX_PATHQ (512) #define ABSMAX_PATHQ (512)
#endif #endif
*/ */
@@ -163,7 +163,7 @@ static INT32 iSkipListLevelLimit[8] = {0, 4, 16, 64, 256, 1024, 4192, 16384 };
#define SETLOC( str, loc ) \ #define SETLOC( str, loc ) \
{\ {\
(str).iLocation = loc;\ (str).iLocation = loc;\
} }
static TRAILCELLTYPE * trailCost; static TRAILCELLTYPE * trailCost;
@@ -194,37 +194,37 @@ static path_t * pClosedHead;
/* /*
#define ClosedListAdd( pNew ) \ #define ClosedListAdd( pNew ) \
{\ {\
pNew->pNext[0] = pClosedHead;\ pNew->pNext[0] = pClosedHead;\
pNew->pNext[1] = pClosedHead->pNext[1];\ pNew->pNext[1] = pClosedHead->pNext[1];\
pClosedHead->pNext[1]->pNext[0] = pNew;\ pClosedHead->pNext[1]->pNext[0] = pNew;\
pClosedHead->pNext[1] = pNew;\ pClosedHead->pNext[1] = pNew;\
pNew->iLocation = -1;\ pNew->iLocation = -1;\
iClosedListSize++;\ iClosedListSize++;\
} }
#define ClosedListGet( pNew )\ #define ClosedListGet( pNew )\
{\ {\
if (queRequests<QPOOLNDX)\ if (queRequests<QPOOLNDX)\
{\ {\
pNew = pathQ + (queRequests);\ pNew = pathQ + (queRequests);\
queRequests++;\ queRequests++;\
memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else if (iClosedListSize > 0)\ else if (iClosedListSize > 0)\
{\ {\
pNew = pClosedHead->pNext[0];\ pNew = pClosedHead->pNext[0];\
pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ pNew->pNext[1]->pNext[0] = pNew->pNext[0];\
pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ pNew->pNext[0]->pNext[1] = pNew->pNext[1];\
iClosedListSize--;\ iClosedListSize--;\
queRequests++;\ queRequests++;\
memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else\ else\
{\ {\
pNew = NULL;\ pNew = NULL;\
}\ }\
} }
*/ */
@@ -240,60 +240,60 @@ static path_t * pClosedHead;
#define ClosedListGet( pNew )\ #define ClosedListGet( pNew )\
{\ {\
if (queRequests<QPOOLNDX)\ if (queRequests<QPOOLNDX)\
{\ {\
pNew = pathQ + (queRequests);\ pNew = pathQ + (queRequests);\
queRequests++;\ queRequests++;\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else if (iClosedListSize > 0)\ else if (iClosedListSize > 0)\
{\ {\
pNew = pClosedHead->pNext[0];\ pNew = pClosedHead->pNext[0];\
pClosedHead->pNext[0] = pNew->pNext[0];\ pClosedHead->pNext[0] = pNew->pNext[0];\
iClosedListSize--;\ iClosedListSize--;\
queRequests++;\ queRequests++;\
memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else\ else\
{\ {\
pNew = NULL;\ pNew = NULL;\
}\ }\
} }
/* /*
#define ClosedListAdd( pNew ) \ #define ClosedListAdd( pNew ) \
{\ {\
pNew->pNext[0] = pClosedHead;\ pNew->pNext[0] = pClosedHead;\
pNew->pNext[1] = pClosedHead->pNext[1];\ pNew->pNext[1] = pClosedHead->pNext[1];\
pClosedHead->pNext[1]->pNext[0] = pNew;\ pClosedHead->pNext[1]->pNext[0] = pNew;\
pClosedHead->pNext[1] = pNew;\ pClosedHead->pNext[1] = pNew;\
pNew->iLocation = -1;\ pNew->iLocation = -1;\
iClosedListSize++;\ iClosedListSize++;\
} }
#define ClosedListGet( pNew )\ #define ClosedListGet( pNew )\
{\ {\
if (queRequests<QPOOLNDX)\ if (queRequests<QPOOLNDX)\
{\ {\
pNew = pathQ + (queRequests);\ pNew = pathQ + (queRequests);\
queRequests++;\ queRequests++;\
memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else if (iClosedListSize > 0)\ else if (iClosedListSize > 0)\
{\ {\
pNew = pClosedHead->pNext[0];\ pNew = pClosedHead->pNext[0];\
pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ pNew->pNext[1]->pNext[0] = pNew->pNext[0];\
pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ pNew->pNext[0]->pNext[1] = pNew->pNext[1];\
iClosedListSize--;\ iClosedListSize--;\
queRequests++;\ queRequests++;\
memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\
pNew->bLevel = RandomSkipListLevel();\ pNew->bLevel = RandomSkipListLevel();\
}\ }\
else\ else\
{\ {\
pNew = NULL;\ pNew = NULL;\
}\ }\
} }
*/ */
@@ -301,9 +301,9 @@ static path_t * pClosedHead;
{\ {\
pDel = pQueueHead->pNext[0];\ pDel = pQueueHead->pNext[0];\
for (iLoop = 0; iLoop < __min( bSkipListLevel, pDel->bLevel ); iLoop++)\ for (iLoop = 0; iLoop < __min( bSkipListLevel, pDel->bLevel ); iLoop++)\
{\ {\
pQueueHead->pNext[iLoop] = pDel->pNext[iLoop];\ pQueueHead->pNext[iLoop] = pDel->pNext[iLoop];\
}\ }\
iSkipListSize--;\ iSkipListSize--;\
ClosedListAdd( pDel );\ ClosedListAdd( pDel );\
} }
@@ -314,49 +314,49 @@ static path_t * pClosedHead;
uiCost = TOTALCOST( pNew );\ uiCost = TOTALCOST( pNew );\
memset( pUpdate, 0, MAX_SKIPLIST_LEVEL * sizeof( path_t *) );\ memset( pUpdate, 0, MAX_SKIPLIST_LEVEL * sizeof( path_t *) );\
for (iCurrLevel = bSkipListLevel - 1; iCurrLevel >= 0; iCurrLevel--)\ for (iCurrLevel = bSkipListLevel - 1; iCurrLevel >= 0; iCurrLevel--)\
{\ {\
pNext = pCurr->pNext[iCurrLevel];\ pNext = pCurr->pNext[iCurrLevel];\
while (pNext)\ while (pNext)\
{\ {\
if ( uiCost > TOTALCOST( pNext ) || (uiCost == TOTALCOST( pNext ) && FARTHER( pNew, pNext ) ) )\ if ( uiCost > TOTALCOST( pNext ) || (uiCost == TOTALCOST( pNext ) && FARTHER( pNew, pNext ) ) )\
{\ {\
pCurr = pNext;\ pCurr = pNext;\
pNext = pCurr->pNext[iCurrLevel];\ pNext = pCurr->pNext[iCurrLevel];\
}\ }\
else\ else\
{\ {\
break;\ break;\
}\ }\
}\ }\
pUpdate[iCurrLevel] = pCurr;\ pUpdate[iCurrLevel] = pCurr;\
}\ }\
pCurr = pCurr->pNext[0];\ pCurr = pCurr->pNext[0];\
for (iCurrLevel = 0; iCurrLevel < pNew->bLevel; iCurrLevel++)\ for (iCurrLevel = 0; iCurrLevel < pNew->bLevel; iCurrLevel++)\
{\ {\
if (!(pUpdate[iCurrLevel]))\ if (!(pUpdate[iCurrLevel]))\
{\ {\
break;\ break;\
}\ }\
pNew->pNext[iCurrLevel] = pUpdate[iCurrLevel]->pNext[iCurrLevel];\ pNew->pNext[iCurrLevel] = pUpdate[iCurrLevel]->pNext[iCurrLevel];\
pUpdate[iCurrLevel]->pNext[iCurrLevel] = pNew;\ pUpdate[iCurrLevel]->pNext[iCurrLevel] = pNew;\
}\ }\
iSkipListSize++;\ iSkipListSize++;\
if (iSkipListSize > iSkipListLevelLimit[bSkipListLevel])\ if (iSkipListSize > iSkipListLevelLimit[bSkipListLevel])\
{\ {\
pCurr = pQueueHead;\ pCurr = pQueueHead;\
pNext = pQueueHead->pNext[bSkipListLevel - 1];\ pNext = pQueueHead->pNext[bSkipListLevel - 1];\
while( pNext )\ while( pNext )\
{\ {\
if (pNext->bLevel > bSkipListLevel)\ if (pNext->bLevel > bSkipListLevel)\
{\ {\
pCurr->pNext[bSkipListLevel] = pNext;\ pCurr->pNext[bSkipListLevel] = pNext;\
pCurr = pNext;\ pCurr = pNext;\
}\ }\
pNext = pNext->pNext[bSkipListLevel - 1];\ pNext = pNext->pNext[bSkipListLevel - 1];\
}\ }\
pCurr->pNext[bSkipListLevel] = pNext;\ pCurr->pNext[bSkipListLevel] = pNext;\
bSkipListLevel++;\ bSkipListLevel++;\
}\ }\
} }
#define REMQUEHEADNODE() SkipListRemoveHead(); #define REMQUEHEADNODE() SkipListRemoveHead();
@@ -364,19 +364,19 @@ static path_t * pClosedHead;
#define DELQUENODE(ndx) SkipListRemoveHead() #define DELQUENODE(ndx) SkipListRemoveHead()
#define REMAININGCOST(ptr) \ #define REMAININGCOST(ptr) \
( \ ( \
(dy = abs(iDestY-iLocY)), \ (dy = abs(iDestY-iLocY)), \
(dx = abs(iDestX-iLocX)), \ (dx = abs(iDestX-iLocX)), \
ESTIMATE \ ESTIMATE \
) )
/* /*
#define REMAININGCOST(ptr) \ #define REMAININGCOST(ptr) \
( \ ( \
(locY = (ptr)->iLocation/MAPWIDTH), \ (locY = (ptr)->iLocation/MAPWIDTH), \
(locX = (ptr)->iLocation%MAPWIDTH), \ (locX = (ptr)->iLocation%MAPWIDTH), \
(dy = abs(iDestY-locY)), \ (dy = abs(iDestY-locY)), \
(dx = abs(iDestX-locX)), \ (dx = abs(iDestX-locX)), \
ESTIMATE \ ESTIMATE \
) )
*/ */
@@ -515,7 +515,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
INT32 iWaterToWater; INT32 iWaterToWater;
UINT8 ubCurAPCost,ubAPCost; UINT8 ubCurAPCost,ubAPCost;
UINT8 ubNewAPCost=0; UINT8 ubNewAPCost=0;
#ifdef VEHICLE #ifdef VEHICLE
//BOOLEAN fTurnSlow = FALSE; //BOOLEAN fTurnSlow = FALSE;
//BOOLEAN fReverse = FALSE; // stuff for vehicles turning //BOOLEAN fReverse = FALSE; // stuff for vehicles turning
BOOLEAN fMultiTile, fVehicle; BOOLEAN fMultiTile, fVehicle;
@@ -525,7 +525,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
STRUCTURE_FILE_REF * pStructureFileRef=NULL; STRUCTURE_FILE_REF * pStructureFileRef=NULL;
UINT16 usAnimSurface; UINT16 usAnimSurface;
//INT32 iCnt2, iCnt3; //INT32 iCnt2, iCnt3;
#endif #endif
INT32 iLastDir = 0; INT32 iLastDir = 0;
@@ -563,7 +563,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
BOOLEAN fContinuousTurnNeeded; BOOLEAN fContinuousTurnNeeded;
BOOLEAN fCloseGoodEnough; BOOLEAN fCloseGoodEnough;
UINT16 usMovementModeToUseForAPs; UINT16 usMovementModeToUseForAPs;
INT16 sClosePathLimit; INT16 sClosePathLimit = 0;
#ifdef PATHAI_SKIPLIST_DEBUG #ifdef PATHAI_SKIPLIST_DEBUG
CHAR8 zTempString[1000], zTS[50]; CHAR8 zTempString[1000], zTS[50];
@@ -579,16 +579,16 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
if (iOrigination < 0 || iOrigination > WORLD_MAX) if (iOrigination < 0 || iOrigination > WORLD_MAX)
{ {
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from off-world gridno %d to %d", iOrigination, sDestination ); ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from off-world gridno %d to %d", iOrigination, sDestination );
#endif #endif
return( 0 ); return( 0 );
} }
else if (!GridNoOnVisibleWorldTile( (INT16) iOrigination ) ) else if (!GridNoOnVisibleWorldTile( (INT16) iOrigination ) )
{ {
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination ); ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination );
#endif #endif
return( 0 ); return( 0 );
} }
else if (s->bLevel != ubLevel) else if (s->bLevel != ubLevel)
@@ -1394,8 +1394,8 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
case TRAVELCOST_SHORE : case TRAVELCOST_SHORE :
case TRAVELCOST_KNEEDEEP: case TRAVELCOST_KNEEDEEP:
case TRAVELCOST_DEEPWATER: case TRAVELCOST_DEEPWATER:
// case TRAVELCOST_VEINEND : // case TRAVELCOST_VEINEND :
// case TRAVELCOST_VEINMID : // case TRAVELCOST_VEINMID :
//case TRAVELCOST_DOOR : //case TRAVELCOST_DOOR :
case TRAVELCOST_FENCE : nextCost = TRAVELCOST_OBSTACLE; case TRAVELCOST_FENCE : nextCost = TRAVELCOST_OBSTACLE;
break; break;
@@ -1441,7 +1441,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
case TRAVELCOST_FENCE : ubAPCost = AP_JUMPFENCE; case TRAVELCOST_FENCE : ubAPCost = AP_JUMPFENCE;
/* /*
if ( sSwitchValue == TRAVELCOST_FENCE ) if ( sSwitchValue == TRAVELCOST_FENCE )
{ {
sPoints += sTileCost; sPoints += sTileCost;
@@ -1475,7 +1475,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
} }
} }
*/ */
break; break;
@@ -1577,7 +1577,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
//ATE: Uncommented out for doors, if we are at a door but not dest, continue! //ATE: Uncommented out for doors, if we are at a door but not dest, continue!
// if ( nextCost == TRAVELCOST_DOOR ) //&& newLoc != iDestination) // if ( nextCost == TRAVELCOST_DOOR ) //&& newLoc != iDestination)
// goto NEXTDIR; // goto NEXTDIR;
/* /*
// FOLLOWING SECTION COMMENTED OUT ON MARCH 7/97 BY IC // FOLLOWING SECTION COMMENTED OUT ON MARCH 7/97 BY IC
if (nextCost == SECRETCOST && !s->human) if (nextCost == SECRETCOST && !s->human)
@@ -1636,7 +1636,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
nextCost = EASYWATERCOST; nextCost = EASYWATERCOST;
} }
// NOTE: on September 24, 1997, Chris went back to a diagonal bias system // NOTE: on September 24, 1997, Chris went back to a diagonal bias system
if (iCnt & 1) if (iCnt & 1)
{ {
// moving on a diagonal // moving on a diagonal
@@ -1653,31 +1653,31 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
newTotCost = curCost + nextCost; newTotCost = curCost + nextCost;
/* /*
// no diagonal bias - straightforward costing regardless of direction // no diagonal bias - straightforward costing regardless of direction
newTotCost = curCost + nextCost; newTotCost = curCost + nextCost;
// NOTE: ON JAN 6TH, 1995, IAN COMMENTED OUT THE DIAGONAL BIAS AND // NOTE: ON JAN 6TH, 1995, IAN COMMENTED OUT THE DIAGONAL BIAS AND
// UNCOMMENTED THE "NO DIAGONAL BIAS" // UNCOMMENTED THE "NO DIAGONAL BIAS"
//diagonal bias - this makes diagonal moves cost more //diagonal bias - this makes diagonal moves cost more
if (iCnt & 1) if (iCnt & 1)
// diagonal move costs 70 percent // diagonal move costs 70 percent
//newTotCost += (nextCost/PATHFACTOR); //newTotCost += (nextCost/PATHFACTOR);
newTotCost += 1; newTotCost += 1;
// newTotCost = curCost + ((prevCost+nextCost)*7)/10; // newTotCost = curCost + ((prevCost+nextCost)*7)/10;
// else // non-diagonal costs only 50% // else // non-diagonal costs only 50%
// newTotCost = curCost + (prevCost+nextCost)/2; // newTotCost = curCost + (prevCost+nextCost)/2;
*/ */
// have we found a path to the current location that // have we found a path to the current location that
// costs less than the best so far to the same location? // costs less than the best so far to the same location?
if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc]) if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc])
{ {
#if defined( PATHAI_VISIBLE_DEBUG ) #if defined( PATHAI_VISIBLE_DEBUG )
if (gfDisplayCoverValues && gfDrawPathPoints) if (gfDisplayCoverValues && gfDrawPathPoints)
{ {
@@ -1696,7 +1696,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
} }
*/ */
} }
#endif #endif
//NEWQUENODE; //NEWQUENODE;
{ {
@@ -1724,9 +1724,9 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
if (pNewPtr == NULL) if (pNewPtr == NULL)
{ {
#ifdef COUNT_PATHS #ifdef COUNT_PATHS
guiFailedPathChecks++; guiFailedPathChecks++;
#endif #endif
gubNPCAPBudget = 0; gubNPCAPBudget = 0;
gubNPCDistLimit = 0; gubNPCDistLimit = 0;
return(0); return(0);
@@ -1749,9 +1749,9 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
if (trailTreeNdx >= iMaxTrailTree) if (trailTreeNdx >= iMaxTrailTree)
{ {
#ifdef COUNT_PATHS #ifdef COUNT_PATHS
guiFailedPathChecks++; guiFailedPathChecks++;
#endif #endif
gubNPCAPBudget = 0; gubNPCAPBudget = 0;
gubNPCDistLimit = 0; gubNPCDistLimit = 0;
return(0); return(0);
@@ -1938,7 +1938,7 @@ ENDOFLOOP:
while (pathQNotEmpty && pathNotYetFound); while (pathQNotEmpty && pathNotYetFound);
#if defined( PATHAI_VISIBLE_DEBUG ) #if defined( PATHAI_VISIBLE_DEBUG )
if (gfDisplayCoverValues && gfDrawPathPoints) if (gfDisplayCoverValues && gfDrawPathPoints)
{ {
SetRenderFlags( RENDER_FLAG_FULL ); SetRenderFlags( RENDER_FLAG_FULL );
@@ -1951,7 +1951,7 @@ ENDOFLOOP:
RefreshScreen( NULL ); RefreshScreen( NULL );
} }
} }
#endif #endif
// work finished. Did we find a path? // work finished. Did we find a path?
@@ -2004,7 +2004,7 @@ ENDOFLOOP:
} }
#if defined( PATHAI_VISIBLE_DEBUG ) #if defined( PATHAI_VISIBLE_DEBUG )
if (gfDisplayCoverValues && gfDrawPathPoints) if (gfDisplayCoverValues && gfDrawPathPoints)
{ {
SetRenderFlags( RENDER_FLAG_FULL ); SetRenderFlags( RENDER_FLAG_FULL );
@@ -2014,13 +2014,13 @@ ENDOFLOOP:
EndFrameBufferRender(); EndFrameBufferRender();
RefreshScreen( NULL ); RefreshScreen( NULL );
} }
#endif #endif
// return path length : serves as a "successful" flag and a path length counter // return path length : serves as a "successful" flag and a path length counter
#ifdef COUNT_PATHS #ifdef COUNT_PATHS
guiSuccessfulPathChecks++; guiSuccessfulPathChecks++;
#endif #endif
gubNPCAPBudget = 0; gubNPCAPBudget = 0;
gubNPCDistLimit = 0; gubNPCDistLimit = 0;
@@ -2035,7 +2035,7 @@ ENDOFLOOP:
return(iCnt); return(iCnt);
} }
#ifdef COUNT_PATHS #ifdef COUNT_PATHS
if (fCopyReachable) if (fCopyReachable)
{ {
// actually this is a success // actually this is a success
@@ -2045,7 +2045,7 @@ ENDOFLOOP:
{ {
guiUnsuccessfulPathChecks++; guiUnsuccessfulPathChecks++;
} }
#endif #endif
// failed miserably, report... // failed miserably, report...
gubNPCAPBudget = 0; gubNPCAPBudget = 0;
@@ -2306,7 +2306,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl
} }
// FIRST, add up "startup" additional costs - such as intermediate animations, etc. // FIRST, add up "startup" additional costs - such as intermediate animations, etc.
/* removing warning C4060 (jonathanl) /* removing warning C4060 (jonathanl)
switch(pSold->usAnimState) switch(pSold->usAnimState)
{ {
//case START_AID : //case START_AID :
@@ -2323,7 +2323,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl
// sAnimCost = AP_CROUCH; // sAnimCost = AP_CROUCH;
// break; // break;
} }
*/ */
sPoints += sAnimCost; sPoints += sAnimCost;
gusAPtsToMove += sAnimCost; gusAPtsToMove += sAnimCost;
+51 -49
View File
@@ -1,37 +1,37 @@
#ifdef PRECOMPILEDHEADERS #ifdef PRECOMPILEDHEADERS
#include "Tactical All.h" #include "Tactical All.h"
#else #else
#include "sgp.h" #include "sgp.h"
#include "worlddef.h" #include "worlddef.h"
#include "points.h" #include "points.h"
#include "overhead.h" #include "overhead.h"
#include "Font control.h" #include "Font control.h"
#include "interface.h" #include "interface.h"
#include "Isometric utils.h" #include "Isometric utils.h"
#include "pathai.h" #include "pathai.h"
#include "interface.h" #include "interface.h"
#include "message.h" #include "message.h"
#include "Animation Control.h" #include "Animation Control.h"
#include "Weapons.h" #include "Weapons.h"
#include "structure wrap.h" #include "structure wrap.h"
#include "dialogue control.h" #include "dialogue control.h"
#include "items.h" #include "items.h"
#include "rt time defines.h" #include "rt time defines.h"
#include "ai.h" #include "ai.h"
#include "handle ui.h" #include "handle ui.h"
#include "text.h" #include "text.h"
#include "SkillCheck.h" #include "SkillCheck.h"
#include "wcheck.h" #include "wcheck.h"
#include "Soldier Profile.h" #include "Soldier Profile.h"
#include "Soldier macros.h" #include "Soldier macros.h"
#include "Random.h" #include "Random.h"
#include "Campaign.h" #include "Campaign.h"
#include "drugs and alcohol.h" #include "drugs and alcohol.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "worldman.h" #include "worldman.h"
#include "math.h" #include "math.h"
#include "Interface Items.h" #include "Interface Items.h"
#endif #endif
//rain //rain
@@ -109,11 +109,11 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8
case TRAVELCOST_DEEPWATER: sAPCost += AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading case TRAVELCOST_DEEPWATER: sAPCost += AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading
break; break;
/* /*
case TRAVELCOST_VEINEND : case TRAVELCOST_VEINEND :
case TRAVELCOST_VEINMID : sAPCost += AP_MOVEMENT_FLAT; case TRAVELCOST_VEINMID : sAPCost += AP_MOVEMENT_FLAT;
break; break;
*/ */
case TRAVELCOST_DOOR : sAPCost += AP_MOVEMENT_FLAT; case TRAVELCOST_DOOR : sAPCost += AP_MOVEMENT_FLAT;
break; break;
@@ -195,20 +195,20 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT1
case TRAVELCOST_SHORE : iPoints = BP_MOVEMENT_SHORE; break; // wading shallow water case TRAVELCOST_SHORE : iPoints = BP_MOVEMENT_SHORE; break; // wading shallow water
case TRAVELCOST_KNEEDEEP : iPoints = BP_MOVEMENT_LAKE; break; // wading waist/chest deep - very slow case TRAVELCOST_KNEEDEEP : iPoints = BP_MOVEMENT_LAKE; break; // wading waist/chest deep - very slow
case TRAVELCOST_DEEPWATER : iPoints = BP_MOVEMENT_OCEAN; break; // can swim, so it's faster than wading case TRAVELCOST_DEEPWATER : iPoints = BP_MOVEMENT_OCEAN; break; // can swim, so it's faster than wading
// case TRAVELCOST_VEINEND : // case TRAVELCOST_VEINEND :
// case TRAVELCOST_VEINMID : iPoints = BP_MOVEMENT_FLAT; break; // case TRAVELCOST_VEINMID : iPoints = BP_MOVEMENT_FLAT; break;
default: default:
if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) if ( IS_TRAVELCOST_DOOR( ubMovementCost ) )
{ {
iPoints = BP_MOVEMENT_FLAT; iPoints = BP_MOVEMENT_FLAT;
break; break;
} }
/* /*
#ifdef TESTVERSION #ifdef TESTVERSION
NumMessage("ERROR: TerrainBreathPoints: Unrecognized grid cost = ", NumMessage("ERROR: TerrainBreathPoints: Unrecognized grid cost = ",
GridCost[gridno]); GridCost[gridno]);
#endif #endif
*/ */
return(0); return(0);
} }
@@ -456,12 +456,12 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE
sAPCost = 0; sAPCost = 0;
} }
#ifdef NETWORKED #ifdef NETWORKED
if( !IsTheSolderUnderMyControl( pSoldier->ubID) ) if( !IsTheSolderUnderMyControl( pSoldier->ubID) )
{ {
return( TRUE ); return( TRUE );
} }
#endif #endif
// Get New points // Get New points
sNewAP = pSoldier->bActionPoints - sAPCost; sNewAP = pSoldier->bActionPoints - sAPCost;
@@ -620,7 +620,7 @@ INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost)
sBreathFactor -= (pSold->bStrength - 80) / 2; sBreathFactor -= (pSold->bStrength - 80) / 2;
} }
/* THIS IS OLD JAGGED ALLIANCE STUFF (left for possible future reference) /* THIS IS OLD JAGGED ALLIANCE STUFF (left for possible future reference)
// apply penalty due to high temperature, heat, and hot Metaviran sun // apply penalty due to high temperature, heat, and hot Metaviran sun
// if INDOORS, in DEEP WATER, or possessing HEAT TOLERANCE trait // if INDOORS, in DEEP WATER, or possessing HEAT TOLERANCE trait
@@ -629,7 +629,7 @@ INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost)
breathFactor += (Status.heatFactor / 5); // 20% of normal heat penalty breathFactor += (Status.heatFactor / 5); // 20% of normal heat penalty
else else
breathFactor += Status.heatFactor; // not used to this! breathFactor += Status.heatFactor; // not used to this!
*/ */
// if a non-swimmer type is thrashing around in deep water // if a non-swimmer type is thrashing around in deep water
@@ -932,7 +932,7 @@ UINT8 CalcAPsToBurst( INT8 bBaseActionPoints, OBJECTTYPE * pObj )
UINT8 CalcAPsToAutofire( INT8 bBaseActionPoints, OBJECTTYPE * pObj, UINT8 bDoAutofire ) UINT8 CalcAPsToAutofire( INT8 bBaseActionPoints, OBJECTTYPE * pObj, UINT8 bDoAutofire )
{ {
// INT8 bAttachPos; // INT8 bAttachPos;
INT32 aps=AP_MAXIMUM + 1; INT32 aps=AP_MAXIMUM + 1;
if ( GetAutofireShotsPerFiveAPs (pObj) ) if ( GetAutofireShotsPerFiveAPs (pObj) )
{ {
@@ -1022,6 +1022,8 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
// IF we are at this gridno, calc min APs but if not, calc cost to goto this lication // IF we are at this gridno, calc min APs but if not, calc cost to goto this lication
if ( pSoldier->sGridNo != sGridNo ) if ( pSoldier->sGridNo != sGridNo )
{ {
sAdjustedGridNo = NOWHERE;
// OK, in order to avoid path calculations here all the time... save and check if it's changed! // OK, in order to avoid path calculations here all the time... save and check if it's changed!
if ( pSoldier->sWalkToAttackGridNo == sGridNo ) if ( pSoldier->sWalkToAttackGridNo == sGridNo )
{ {
@@ -1186,7 +1188,7 @@ INT8 CalcAimSkill( SOLDIERTYPE * pSoldier, UINT16 usWeapon )
UINT8 BaseAPsToShootOrStab( INT8 bAPs, INT8 bAimSkill, OBJECTTYPE * pObj ) UINT8 BaseAPsToShootOrStab( INT8 bAPs, INT8 bAimSkill, OBJECTTYPE * pObj )
{ {
INT32 Top, Bottom, rof; INT32 Top, Bottom, rof;
// INT8 bAttachPos; // INT8 bAttachPos;
// Calculate default top & bottom of the magic "aiming" formula! // Calculate default top & bottom of the magic "aiming" formula!
@@ -1800,14 +1802,14 @@ INT8 GetAPsToReloadGunWithAmmo( OBJECTTYPE * pGun, OBJECTTYPE * pAmmo )
if ( GetMagSize(pGun) == Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize ) if ( GetMagSize(pGun) == Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize )
{ {
// normal situation // normal situation
// return( AP_RELOAD_GUN ); // return( AP_RELOAD_GUN );
return GetAPsToReload(pGun) ; return GetAPsToReload(pGun) ;
} }
else else
{ {
// trying to reload with wrong size of magazine // trying to reload with wrong size of magazine
return (GetAPsToReload(pGun) * 2); return (GetAPsToReload(pGun) * 2);
// return( AP_RELOAD_GUN + AP_RELOAD_GUN ); // return( AP_RELOAD_GUN + AP_RELOAD_GUN );
} }
} }
@@ -1820,12 +1822,12 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
CHECKF( pSoldier ); CHECKF( pSoldier );
pObj = &(pSoldier->inv[HANDPOS]); pObj = &(pSoldier->inv[HANDPOS]);
//<SB> manual recharge //<SB> manual recharge
if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
{ {
return Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually; return Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually;
} }
//</SB> //</SB>
if (Item[pObj->usItem].usItemClass == IC_GUN || Item[pObj->usItem].usItemClass == IC_LAUNCHER) if (Item[pObj->usItem].usItemClass == IC_GUN || Item[pObj->usItem].usItemClass == IC_LAUNCHER)
{ {
+7 -1
View File
@@ -524,7 +524,7 @@ void SortSoldierInitList()
} }
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr ) BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
{ {
UINT8 ubProfile; UINT8 ubProfile;
SOLDIERCREATE_STRUCT tempDetailedPlacement; SOLDIERCREATE_STRUCT tempDetailedPlacement;
@@ -723,6 +723,12 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr )
{ {
curr->pSoldier = pSoldier; curr->pSoldier = pSoldier;
curr->ubSoldierID = ubID; curr->ubSoldierID = ubID;
if (pGroup)
{
pSoldier->ubGroupID = pGroup->ubGroupID;
pSoldier->pGroup = pGroup;
}
AddSoldierToSectorNoCalculateDirection( ubID ); AddSoldierToSectorNoCalculateDirection( ubID );
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bTeam == ENEMY_TEAM && !pSoldier->inv[ HANDPOS ].usItem ) if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bTeam == ENEMY_TEAM && !pSoldier->inv[ HANDPOS ].usItem )
+1 -1
View File
@@ -73,7 +73,7 @@ void OutputDebugInfoForTurnBasedNextTileWaiting( SOLDIERTYPE * pSoldier )
if ( (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->usPathDataSize > 0) ) if ( (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->usPathDataSize > 0) )
{ {
UINT32 uiLoop; UINT32 uiLoop;
UINT16 usTemp; UINT16 usTemp = NOWHERE;
UINT16 usNewGridNo; UINT16 usNewGridNo;
usNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); usNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) );
+1 -1
View File
@@ -121,7 +121,7 @@ void AccumulateBurstLocation( INT16 sGridNo )
void PickBurstLocations( SOLDIERTYPE *pSoldier ) void PickBurstLocations( SOLDIERTYPE *pSoldier )
{ {
UINT8 ubShotsPerBurst; UINT8 ubShotsPerBurst = 0;
FLOAT dAccululator = 0; FLOAT dAccululator = 0;
FLOAT dStep = 0; FLOAT dStep = 0;
INT32 cnt; INT32 cnt;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -3005,7 +3005,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
UINT32 uiMissVolume = MIDVOLUME; UINT32 uiMissVolume = MIDVOLUME;
BOOLEAN fHitSameStructureAsBefore; BOOLEAN fHitSameStructureAsBefore;
BULLET * pBullet; BULLET * pBullet;
SOLDIERTYPE * pAttacker; SOLDIERTYPE * pAttacker = NULL;
pBullet = GetBulletPtr( iBullet ); pBullet = GetBulletPtr( iBullet );
+2
View File
@@ -453,6 +453,7 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q
ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos ); ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos );
LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE)); LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
#if 0
if ( pBullet->pFirer->bLevel > 0 ) // if firer on roof then if ( pBullet->pFirer->bLevel > 0 ) // if firer on roof then
{ {
if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area
@@ -460,6 +461,7 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q
LightSpritePower( pBullet->pAniTile->lightSprite, FALSE); LightSpritePower( pBullet->pAniTile->lightSprite, FALSE);
} }
} }
#endif
return; return;
} }
+1 -1
View File
@@ -5066,7 +5066,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy
INT8 bCheckTerrain = FALSE; INT8 bCheckTerrain = FALSE;
UINT8 ubSourceTerrType, ubSource; UINT8 ubSourceTerrType, ubSource;
INT8 bTellPlayer = FALSE, bHeard, bSeen; INT8 bTellPlayer = FALSE, bHeard, bSeen;
UINT8 ubHeardLoudestBy, ubNoiseDir, ubLoudestNoiseDir; UINT8 ubHeardLoudestBy = NOBODY, ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff;
#ifdef RECORDOPPLIST #ifdef RECORDOPPLIST
+1 -1
View File
@@ -869,7 +869,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK,
INT16 *psLastLoc, *pusNoiseGridNo; INT16 *psLastLoc, *pusNoiseGridNo;
INT8 *pbLastLevel; INT8 *pbLastLevel;
INT16 sGridNo=-1; INT16 sGridNo=-1;
INT8 bLevel, bClosestLevel; INT8 bLevel, bClosestLevel = -1;
BOOLEAN fClimbingNecessary, fClosestClimbingNecessary = FALSE; BOOLEAN fClimbingNecessary, fClosestClimbingNecessary = FALSE;
INT32 iPathCost; INT32 iPathCost;
INT16 sClosestDisturbance = NOWHERE; INT16 sClosestDisturbance = NOWHERE;
+2 -2
View File
@@ -1181,7 +1181,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
INT32 iAttackValue; INT32 iAttackValue;
INT32 iThreatValue,iHitRate,iBestHitRate,iPercentBetter, iEstDamage; INT32 iThreatValue,iHitRate,iBestHitRate,iPercentBetter, iEstDamage;
BOOLEAN fSurpriseStab; BOOLEAN fSurpriseStab;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime; UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0; UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
SOLDIERTYPE *pOpponent; SOLDIERTYPE *pOpponent;
UINT16 usTrueMovementMode; UINT16 usTrueMovementMode;
@@ -1394,7 +1394,7 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
INT32 iAttackValue; INT32 iAttackValue;
INT32 iThreatValue,iHitRate,iBestHitRate, iEstDamage; INT32 iThreatValue,iHitRate,iBestHitRate, iEstDamage;
BOOLEAN fSurpriseStab; BOOLEAN fSurpriseStab;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime; UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0; UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
SOLDIERTYPE *pOpponent; SOLDIERTYPE *pOpponent;
+1 -1
View File
@@ -910,7 +910,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
INT8 bCanAttack; INT8 bCanAttack;
INT8 bSpitIn, bWeaponIn; INT8 bSpitIn, bWeaponIn;
UINT32 uiChance; UINT32 uiChance;
ATTACKTYPE BestShot, BestStab, BestAttack, CurrStab; ATTACKTYPE BestShot = {}, BestStab = {}, BestAttack = {}, CurrStab = {};
BOOLEAN fRunAway = FALSE; BOOLEAN fRunAway = FALSE;
BOOLEAN fChangeLevel; BOOLEAN fChangeLevel;
+21 -8
View File
@@ -1233,14 +1233,18 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
INT16 sNoiseGridNo = MostImportantNoiseHeard(pSoldier,&iNoiseValue, &fClimb, &fReachable); INT16 sNoiseGridNo = MostImportantNoiseHeard(pSoldier,&iNoiseValue, &fClimb, &fReachable);
UINT8 ubNoiseDir; UINT8 ubNoiseDir;
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 )
if ( sNoiseGridNo != NOWHERE && pSoldier->bDirection != ubNoiseDir ) {
pSoldier->usActionData = ubNoiseDir;
else
pSoldier->usActionData = (UINT16)PreRandom(8); pSoldier->usActionData = (UINT16)PreRandom(8);
} }
else
{
pSoldier->usActionData = ubNoiseDir;
}
}
} while (pSoldier->usActionData == pSoldier->bDirection); } while (pSoldier->usActionData == pSoldier->bDirection);
@@ -1997,7 +2001,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
} }
} }
if ( fCivilian && !( pSoldier->ubBodyType == COW || pSoldier->ubBodyType == CRIPPLECIV ) ) if ( fCivilian && !( pSoldier->ubBodyType == COW || pSoldier->ubBodyType == CRIPPLECIV ) &&
gTacticalStatus.bBoxingState == NOT_BOXING)
{ {
if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == ITEM_NOT_FOUND ) if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == ITEM_NOT_FOUND )
{ {
@@ -3425,9 +3430,9 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
#endif #endif
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionBlack: soldier = %d, orders = %d, attitude = %d",pSoldier->ubID,pSoldier->bOrders,pSoldier->bAttitude)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionBlack: soldier = %d, orders = %d, attitude = %d",pSoldier->ubID,pSoldier->bOrders,pSoldier->bAttitude));
ATTACKTYPE BestShot,BestThrow,BestStab,BestAttack; ATTACKTYPE BestShot = {},BestThrow = {},BestStab = {},BestAttack = {};
BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || pSoldier->bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) ); BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || pSoldier->bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) );
UINT8 ubBestStance, ubStanceCost; UINT8 ubBestStance = 1, ubStanceCost;
BOOLEAN fChangeStanceFirst; // before firing BOOLEAN fChangeStanceFirst; // before firing
BOOLEAN fClimb; BOOLEAN fClimb;
UINT8 ubBurstAPs; UINT8 ubBurstAPs;
@@ -4128,6 +4133,8 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
// if soldier has enough APs left to move at least 1 square's worth, // if soldier has enough APs left to move at least 1 square's worth,
// and either he can't attack any more, or his attack did wound someone // and either he can't attack any more, or his attack did wound someone
iCoverPercentBetter = 0;
if ( (ubCanMove && !SkipCoverCheck && !gfHiddenInterrupt && if ( (ubCanMove && !SkipCoverCheck && !gfHiddenInterrupt &&
((ubBestAttackAction == AI_ACTION_NONE) || pSoldier->bLastAttackHit) && ((ubBestAttackAction == AI_ACTION_NONE) || pSoldier->bLastAttackHit) &&
(pSoldier->bTeam != gbPlayerNum || pSoldier->fAIFlags & AI_RTP_OPTION_CAN_SEEK_COVER) && (pSoldier->bTeam != gbPlayerNum || pSoldier->fAIFlags & AI_RTP_OPTION_CAN_SEEK_COVER) &&
@@ -5254,6 +5261,12 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
} }
} }
} }
else if (gTacticalStatus.bBoxingState == DISQUALIFIED ||
gTacticalStatus.bBoxingState == WON_ROUND ||
gTacticalStatus.bBoxingState == LOST_ROUND)
{
pSoldier->bAlertStatus = STATUS_GREEN;
}
} }
+1 -1
View File
@@ -535,7 +535,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
// all 32-bit integers for max. speed // all 32-bit integers for max. speed
UINT32 uiLoop; UINT32 uiLoop;
INT32 iCurrentCoverValue, iCoverValue, iBestCoverValue; INT32 iCurrentCoverValue, iCoverValue, iBestCoverValue;
INT32 iCurrentScale, iCoverScale, iBestCoverScale; INT32 iCurrentScale = -1, iCoverScale = -1, iBestCoverScale = -1;
INT32 iDistFromOrigin, iDistCoverFromOrigin, iThreatCertainty; INT32 iDistFromOrigin, iDistCoverFromOrigin, iThreatCertainty;
INT16 sGridNo, sBestCover = NOWHERE; INT16 sGridNo, sBestCover = NOWHERE;
INT32 iPathCost; INT32 iPathCost;
+2 -2
View File
@@ -225,8 +225,8 @@ BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier )
INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb )
{ {
UINT8 cnt, cnt2; UINT8 cnt, cnt2;
INT16 bBestPriority = 0, sBestAdjGridNo; INT16 bBestPriority = 0, sBestAdjGridNo = NOWHERE;
INT16 sPatientGridNo, sBestPatientGridNo; INT16 sPatientGridNo = NOWHERE, sBestPatientGridNo = NOWHERE;
INT16 sShortestPath = 1000, sPathCost, sOtherMedicPathCost; INT16 sShortestPath = 1000, sPathCost, sOtherMedicPathCost;
SOLDIERTYPE * pPatient; SOLDIERTYPE * pPatient;
SOLDIERTYPE * pBestPatient = NULL; SOLDIERTYPE * pBestPatient = NULL;
+4 -3
View File
@@ -2168,7 +2168,7 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc )
UINT8 ubNPC, ubMerc, ubDesiredMerc = NOBODY; UINT8 ubNPC, ubMerc, ubDesiredMerc = NOBODY;
UINT8 ubTalkDesire, ubHighestTalkDesire = 0; UINT8 ubTalkDesire, ubHighestTalkDesire = 0;
SOLDIERTYPE * pMerc; SOLDIERTYPE * pMerc;
SOLDIERTYPE * pDesiredMerc; SOLDIERTYPE * pDesiredMerc = NULL;
NPCQuoteInfo * pNPCQuoteInfoArray; NPCQuoteInfo * pNPCQuoteInfoArray;
CHECKF( pubDesiredMerc ); CHECKF( pubDesiredMerc );
@@ -2215,16 +2215,17 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc )
{ {
ubHighestTalkDesire = ubTalkDesire; ubHighestTalkDesire = ubTalkDesire;
ubDesiredMerc = ubMerc; ubDesiredMerc = ubMerc;
pDesiredMerc = MercPtrs[ubMerc]; pDesiredMerc = MercSlots[ubMerc];
sDesiredMercDist = PythSpacesAway( sMyGridNo, pDesiredMerc->sGridNo ); sDesiredMercDist = PythSpacesAway( sMyGridNo, pDesiredMerc->sGridNo );
} }
else if (ubTalkDesire == ubHighestTalkDesire) else if (ubTalkDesire == ubHighestTalkDesire)
{ {
sDist = PythSpacesAway( sMyGridNo, MercPtrs[ubMerc]->sGridNo ); sDist = PythSpacesAway( sMyGridNo, MercSlots[ubMerc]->sGridNo );
if (sDist < sDesiredMercDist) if (sDist < sDesiredMercDist)
{ {
// we can say the same thing to this merc, and they're closer! // we can say the same thing to this merc, and they're closer!
ubDesiredMerc = ubMerc; ubDesiredMerc = ubMerc;
pDesiredMerc = MercSlots[ubMerc];
sDesiredMercDist = sDist; sDesiredMercDist = sDist;
} }
} }
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+3 -3
View File
@@ -1215,12 +1215,12 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
STRUCTURE * pCurrent, *pNextCurrent, *pStructure; STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
STRUCTURE * pBaseStructure; STRUCTURE * pBaseStructure;
INT16 sDesiredLevel; INT16 sDesiredLevel;
DB_STRUCTURE_TILE **ppTile; DB_STRUCTURE_TILE **ppTile = NULL;
UINT8 ubLoop, ubLoop2; UINT8 ubLoop, ubLoop2;
INT16 sNewGridNo, sNewGridNo2, sBaseGridNo; INT16 sNewGridNo, sNewGridNo2, sBaseGridNo = NOWHERE;
BOOLEAN fToBreak = FALSE; BOOLEAN fToBreak = FALSE;
BOOLEAN fMultiStructure = FALSE; BOOLEAN fMultiStructure = FALSE;
UINT8 ubNumberOfTiles; UINT8 ubNumberOfTiles = 0xff;
BOOLEAN fMultiStructSpecialFlag = FALSE; BOOLEAN fMultiStructSpecialFlag = FALSE;
BOOLEAN fExplodeDamageReturn = FALSE; BOOLEAN fExplodeDamageReturn = FALSE;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+4 -4
View File
@@ -727,9 +727,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
INT32 iCollisionCode = COLLISION_NONE; INT32 iCollisionCode = COLLISION_NONE;
BOOLEAN fDoCollision = FALSE; BOOLEAN fDoCollision = FALSE;
FLOAT dElasity = 1; FLOAT dElasity = 1;
UINT16 usStructureID; UINT16 usStructureID = -1;
FLOAT dNormalX, dNormalY, dNormalZ; FLOAT dNormalX = 0.0, dNormalY = 0.0, dNormalZ = 1.0;
INT16 sGridNo; INT16 sGridNo = NOWHERE;
// Checkf for collisions // Checkf for collisions
dX = pObject->Position.x; dX = pObject->Position.x;
@@ -2652,7 +2652,7 @@ BOOLEAN LoadPhysicsTableFromSavedGameFile( HWFILE hFile )
UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius ) UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius )
{ {
INT16 sX, sY; INT16 sX, sY;
INT16 sGridNo; INT16 sGridNo = NOWHERE;
INT32 leftmost; INT32 leftmost;
BOOLEAN fFound = FALSE; BOOLEAN fFound = FALSE;
UINT32 cnt = 0; UINT32 cnt = 0;
+3 -3
View File
@@ -777,10 +777,10 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
LEVELNODE *pNode; //, *pLand, *pStruct; //*pObject, *pTopmost, *pMerc; LEVELNODE *pNode; //, *pLand, *pStruct; //*pObject, *pTopmost, *pMerc;
SOLDIERTYPE *pSoldier, *pSelSoldier; SOLDIERTYPE *pSoldier, *pSelSoldier;
HVOBJECT hVObject; HVOBJECT hVObject = NULL;
ETRLEObject *pTrav; ETRLEObject *pTrav;
TILE_ELEMENT *TileElem=NULL; TILE_ELEMENT *TileElem=NULL;
UINT32 uiDestPitchBYTES; UINT32 uiDestPitchBYTES = 0;
UINT8 *pDestBuf=NULL; UINT8 *pDestBuf=NULL;
UINT16 usAnimSurface; UINT16 usAnimSurface;
INT8 bXOddFlag = 0; INT8 bXOddFlag = 0;
@@ -1234,7 +1234,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
usImageIndex = pNode->pAniTile->sCurrentFrame; usImageIndex = pNode->pAniTile->sCurrentFrame;
uiAniTileFlags = pNode->pAniTile->uiFlags; uiAniTileFlags = pNode->pAniTile->uiFlags;
// Position corpse based on it's float position // Position corpse based on its float position
if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) ) if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) )
{ {
pCorpse = &( gRottingCorpse[ pNode->pAniTile->uiUserData ] ); pCorpse = &( gRottingCorpse[ pNode->pAniTile->uiUserData ] );
+1 -1
View File
@@ -2163,7 +2163,7 @@ BOOLEAN FiniStructureDB( void )
INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock ) INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock )
{ {
STRUCTURE * pCurrent, *pStructure; STRUCTURE * pCurrent, *pStructure = NULL;
INT16 sDesiredLevel; INT16 sDesiredLevel;
BOOLEAN fOKStructOnLevel = FALSE; BOOLEAN fOKStructOnLevel = FALSE;
BOOLEAN fMinimumBlockingFound = FALSE; BOOLEAN fMinimumBlockingFound = FALSE;
+1 -1
View File
@@ -115,7 +115,7 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
SGPPaletteEntry * pSGPPaletteEntry; SGPPaletteEntry * pSGPPaletteEntry;
STCIPaletteElement STCIPaletteEntry; STCIPaletteElement STCIPaletteEntry;
STCISubImage * pSubImageBuffer; STCISubImage * pSubImageBuffer = NULL;
UINT16 usNumberOfSubImages; UINT16 usNumberOfSubImages;
UINT32 uiSubImageBufferSize=0; UINT32 uiSubImageBufferSize=0;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -446,7 +446,7 @@ UINT16 DeleteWrappedString(WRAPPED_STRING *pWrappedString)
BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidth, UINT32 ulFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 ulFlags) BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidth, UINT32 ulFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 ulFlags)
{ {
UINT16 usPosX, usPosY; UINT16 usPosX = 0, usPosY = 0;
UINT16 usFontHeight=0; UINT16 usFontHeight=0;
UINT16 usStringWidth=0; UINT16 usStringWidth=0;
+2 -1
View File
@@ -49,8 +49,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+2
View File
@@ -51,6 +51,8 @@ static LuaAttrib* LuaCommonGetSet( lua_State *L )
else else
{ {
luaL_argcheck( L, 0, 2, "Invalid index to the table" ); luaL_argcheck( L, 0, 2, "Invalid index to the table" );
// The last function doesn't return, but gotta keep the compiler happy
return NULL;
} }
for ( ; Attributes->name; Attributes++ ) for ( ; Attributes->name; Attributes++ )
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1" RuntimeLibrary="1"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
DebugInformationFormat="4" DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
+2 -3
View File
@@ -83,7 +83,7 @@ static int LuaWStringChar( lua_State *L )
len--; len--;
for( idx=0; idx<len; idx++) for( idx=0; idx<len; idx++)
{ {
str[ idx ] = luaL_checkint( L, idx + 1 ); str[ idx ] = (CHAR16) luaL_checkint( L, idx + 1 );
} }
str[ idx ] = 0; str[ idx ] = 0;
@@ -213,7 +213,6 @@ static int LuaWStringUpper( lua_State *L )
static int LuaWStringToString( lua_State *L ) static int LuaWStringToString( lua_State *L )
{ {
TWString *tw = (TWString*) luaL_checkudata( L, 1, "wstring" ); TWString *tw = (TWString*) luaL_checkudata( L, 1, "wstring" );
int len = tw->len;
int newlen; int newlen;
STR8 newstr = NULL; STR8 newstr = NULL;
@@ -227,7 +226,7 @@ static int LuaWStringToString( lua_State *L )
static int LuaWStringIndex( lua_State *L ) static int LuaWStringIndex( lua_State *L )
{ {
TWString *tw = (TWString*) luaL_checkudata( L, 1, "wstring" ); luaL_checkudata( L, 1, "wstring" );
const CHAR8 *idx = luaL_checkstring( L, 2 ); const CHAR8 *idx = luaL_checkstring( L, 2 );
// Disqualify metafunctions // Disqualify metafunctions