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))
File diff suppressed because it is too large Load Diff
+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;
File diff suppressed because it is too large Load Diff
+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,7 +1341,9 @@ 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 )
{ {
@@ -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
+81 -126
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"
@@ -182,7 +183,7 @@ BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY)
if( CountAllMilitiaInSector( sMapX, sMapY ) >= gGameExternalOptions.guiMaxMilitiaSquadSize || if( CountAllMilitiaInSector( sMapX, sMapY ) >= gGameExternalOptions.guiMaxMilitiaSquadSize ||
CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 ) CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 )
return FALSE; return FALSE;
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 );
@@ -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 ] ) ) ) {
while ((pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) ) != NULL)
{ {
pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
pGroup->ubPrevX = pGroup->ubSectorX; pGroup->ubPrevX = pGroup->ubSectorX;
pGroup->ubPrevY = pGroup->ubSectorY; pGroup->ubPrevY = pGroup->ubSectorY;
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)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 );
@@ -402,32 +357,32 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
return 255; return 255;
}else }else
for(;;) for(;;)
{
ubIndex = Random(ubDirNumber);
if( CountAllMilitiaInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
{ {
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ]; ubIndex = Random(ubDirNumber);
if( CountAllMilitiaInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
{
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
if( pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] ) if( pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] )
{ {
StrategicAddMilitiaToSector( sMapX, sMapY,ELITE_MILITIA, 1 ); StrategicAddMilitiaToSector( sMapX, sMapY,ELITE_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),ELITE_MILITIA, 1 ); StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),ELITE_MILITIA, 1 );
*pubRank = ELITE_MILITIA; *pubRank = ELITE_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] ) }else if( pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] )
{ {
StrategicAddMilitiaToSector( sMapX, sMapY,REGULAR_MILITIA, 1 ); StrategicAddMilitiaToSector( sMapX, sMapY,REGULAR_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),REGULAR_MILITIA, 1 ); StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),REGULAR_MILITIA, 1 );
*pubRank = REGULAR_MILITIA; *pubRank = REGULAR_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] ) }else if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] )
{ {
StrategicAddMilitiaToSector( sMapX, sMapY,GREEN_MILITIA, 1 ); StrategicAddMilitiaToSector( sMapX, sMapY,GREEN_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),GREEN_MILITIA, 1 ); StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),GREEN_MILITIA, 1 );
*pubRank = GREEN_MILITIA; *pubRank = GREEN_MILITIA;
}
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
} }
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
} }
}
} }
@@ -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...
@@ -460,23 +415,23 @@ void AddPossiblePendingMilitiaToBattle()
{ {
ubNumElites = ubNumRegulars = ubNumGreens = 0; ubNumElites = ubNumRegulars = ubNumGreens = 0;
// while( ubSlots ) // while( ubSlots )
switch( ubPredefinedRank ) switch( ubPredefinedRank )
{ {
case ELITE_MILITIA: case ELITE_MILITIA:
ubSlots--; ubSlots--;
ubNumElites++; ubNumElites++;
break; break;
case REGULAR_MILITIA: case REGULAR_MILITIA:
ubSlots--; ubSlots--;
ubNumRegulars++; ubNumRegulars++;
break; break;
case GREEN_MILITIA: case GREEN_MILITIA:
ubSlots--; ubSlots--;
ubNumGreens++; ubNumGreens++;
break; break;
default: default:
ubSlots--; ubSlots--;
} }
if( ubNumGreens || ubNumRegulars || ubNumElites ) if( ubNumGreens || ubNumRegulars || ubNumElites )
@@ -488,7 +443,7 @@ void AddPossiblePendingMilitiaToBattle()
if( ubSlots ) if( ubSlots )
{ //After going through the process, we have finished with some free slots and no more enemies to add. { //After going through the process, we have finished with some free slots and no more enemies to add.
//So, we can turn off the flag, as this check is no longer needed. //So, we can turn off the flag, as this check is no longer needed.
ubPredefinedInsertionCode = DoReinforcementAsPendingMilitia( gWorldSectorX, gWorldSectorY, &ubPredefinedRank ); ubPredefinedInsertionCode = DoReinforcementAsPendingMilitia( gWorldSectorX, gWorldSectorY, &ubPredefinedRank );
if( ubPredefinedInsertionCode != 255 ) if( ubPredefinedInsertionCode != 255 )
+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;
+134 -133
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 )
{ {
@@ -1513,22 +1514,22 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo )
//<SB> crouch throwing //<SB> crouch throwing
case ANIM_PRONE: case ANIM_PRONE:
if ( sGridNo == pSoldier->sGridNo ) if ( sGridNo == pSoldier->sGridNo )
{
// OK, JUST DROP ITEM!
if ( pSoldier->pTempObject != NULL )
{ {
// OK, JUST DROP ITEM! AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 );
if ( pSoldier->pTempObject != NULL ) NotifySoldiersToLookforItems( );
{
AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 );
NotifySoldiersToLookforItems( );
MemFree( pSoldier->pTempObject ); MemFree( pSoldier->pTempObject );
pSoldier->pTempObject = NULL; pSoldier->pTempObject = NULL;
}
break;
} }
ChangeSoldierStance( pSoldier, ANIM_CROUCH ); break;
}
ChangeSoldierStance( pSoldier, ANIM_CROUCH );
case ANIM_CROUCH: case ANIM_CROUCH:
// CHECK IF WE ARE NOT ON THE SAME GRIDNO // CHECK IF WE ARE NOT ON THE SAME GRIDNO
if ( sGridNo == pSoldier->sGridNo ) if ( sGridNo == pSoldier->sGridNo )
{ {
@@ -1544,18 +1545,18 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo )
} }
else else
{ {
// CHANGE DIRECTION AT LEAST // CHANGE DIRECTION AT LEAST
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
SoldierGotoStationaryStance( pSoldier ); SoldierGotoStationaryStance( pSoldier );
EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection );
pSoldier->fTurningUntilDone = TRUE; pSoldier->fTurningUntilDone = TRUE;
pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED; pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED;
} }
break; break;
//</SB> //</SB>
} }
} }
@@ -3474,17 +3475,17 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I
// Set string // Set string
if ( cnt == gbCurrentItemSel ) if ( cnt == gbCurrentItemSel )
{ {
SetFontForeground( FONT_MCOLOR_LTGRAY ); SetFontForeground( FONT_MCOLOR_LTGRAY );
} }
else else
{ {
SetFontForeground( FONT_MCOLOR_DKGRAY ); SetFontForeground( FONT_MCOLOR_DKGRAY );
} }
swprintf( pStr, TacticalStr[ ITEMPOOL_POPUP_MORE_STR ] ); swprintf( pStr, TacticalStr[ ITEMPOOL_POPUP_MORE_STR ] );
gprintfdirty( sFontX, sY, pStr ); gprintfdirty( sFontX, sY, pStr );
mprintf( sFontX, sY, pStr ); mprintf( sFontX, sY, pStr );
} }
} }
return( fSelectionDone ); return( fSelectionDone );
@@ -5244,7 +5245,7 @@ INT16 FindNearestAvailableGridNoForItem( INT16 sSweetGridNo, INT8 ubRadius )
//create dummy soldier, and use the pathing to determine which nearby slots are //create dummy soldier, and use the pathing to determine which nearby slots are
//reachable. //reachable.
// WDS - Clean up inventory handling // WDS - Clean up inventory handling
//memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); //memset( &soldier, 0, SIZEOF_SOLDIERTYPE );
soldier.initialize(); soldier.initialize();
soldier.bTeam = 1; soldier.bTeam = 1;
@@ -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;
@@ -5362,7 +5363,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
{ {
fStealItem = FALSE; fStealItem = FALSE;
// WDS - Clean up inventory handling // WDS - Clean up inventory handling
pObject=&pOpponent->inv[i]; pObject=&pOpponent->inv[i];
if (pObject->usItem!=0) if (pObject->usItem!=0)
{ {
@@ -5478,9 +5479,9 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,
cnt++; cnt++;
if ( fPickup ) if ( fPickup )
{ {
// 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
+21 -18
View File
@@ -2009,7 +2009,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
{ {
UINT16 uiStringLength; UINT16 uiStringLength;
INVTYPE *pItem; INVTYPE *pItem;
ETRLEObject *pTrav; ETRLEObject *pTrav;
UINT32 usHeight, usWidth; UINT32 usHeight, usWidth;
INT16 sCenX, sCenY, sNewY, sNewX; INT16 sCenX, sCenY, sNewY, sNewX;
HVOBJECT hVObject; HVOBJECT hVObject;
@@ -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,25 +2277,24 @@ 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 );
if ( fLineSplit )
{ {
mprintf( sFontX2, sFontY2, pStr2 ); mprintf( sFontX, sFontY, pStr );
if ( fLineSplit )
{
mprintf( sFontX2, sFontY2, pStr2 );
}
} }
} else if ( *pubHighlightCounter == 1 )
else if ( *pubHighlightCounter == 1 )
{
*pubHighlightCounter = 0;
gprintfRestore( sFontX, sFontY, pStr );
if ( fLineSplit )
{ {
gprintfRestore( sFontX2, sFontY2, pStr2 ); *pubHighlightCounter = 0;
gprintfRestore( sFontX, sFontY, pStr );
if ( fLineSplit )
{
gprintfRestore( sFontX2, sFontY2, pStr2 );
}
} }
} }
} }
@@ -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 )
+26 -18
View File
@@ -2968,7 +2968,7 @@ BOOLEAN AddTopMessage( UINT8 ubType, STR16 pzString )
void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
{ {
UINT32 uiBAR, uiPLAYERBAR, uiINTBAR; UINT32 uiBAR, uiPLAYERBAR, uiINTBAR;
VOBJECT_DESC VObjectDesc; VOBJECT_DESC VObjectDesc;
INT16 sX, sY; INT16 sX, sY;
INT32 cnt2; INT32 cnt2;
INT16 sBarX = 0; INT16 sBarX = 0;
@@ -2983,7 +2983,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution == 0) if (iResolution == 0)
{ {
FilenameForBPP("INTERFACE\\rect.sti", VObjectDesc.ImageFile); FilenameForBPP("INTERFACE\\rect.sti", VObjectDesc.ImageFile);
} }
else if (iResolution == 1) else if (iResolution == 1)
{ {
@@ -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 )
+819 -819
View File
File diff suppressed because it is too large Load Diff
+462 -460
View File
File diff suppressed because it is too large Load Diff
+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,13 +1233,17 @@ 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