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;
}
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;
SMALL_RECT sr;
sr.Top = nCurrentPos;
sr.Bottom = nDelta;
sr.Top = (short) nCurrentPos;
// sr.Bottom = nDelta;
sr.Left = sr.Right = 0;
m_csbiConsole.srWindow = sr;
// ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr);
@@ -825,6 +825,7 @@ void Console::OnMButtonDown(UINT uiFlags, POINTS points) {
void Console::OnMouseMove(UINT uiFlags, POINTS points) {
#if 0
RECT windowRect;
int deltaX, deltaY;
POINT point;
@@ -905,6 +906,7 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) {
}
}
}
#endif
}
/////////////////////////////////////////////////////////////////////////////
@@ -2697,11 +2699,12 @@ void Console::SetWindowSizeAndPosition() {
break;
}
HWND hwndZ;
HWND hwndZ = 0;
switch (m_dwCurrentZOrder) {
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
default : return;
}
::SetWindowPos(
@@ -2769,7 +2772,7 @@ BOOL Console::SetTrayIcon(DWORD dwMessage) {
if (strToolTip.length() > 63) {
strToolTip.resize(59);
strToolTip += _T(" ...");
DWORD dw = strToolTip.length();
// DWORD dw = strToolTip.length();
}
_tcscpy(tnd.szTip, strToolTip.c_str());
@@ -2804,7 +2807,7 @@ void Console::EditConfigFile() {
// no params, just use the config file
strParams = m_strConfigFile;
} else {
int nPos = strParams.find(_T("%f"));
tstring::size_type nPos = strParams.find(_T("%f"));
if (nPos == tstring::npos) {
// no '%f' in editor params, concatenate config file name
@@ -3190,8 +3193,8 @@ void Console::InitConsoleWndSize(DWORD dwColumns) {
SMALL_RECT srConsoleRect;
srConsoleRect.Top = srConsoleRect.Left =0;
srConsoleRect.Right = dwColumns - 1;
srConsoleRect.Bottom= m_dwRows - 1;
// srConsoleRect.Right = dwColumns - 1;
// srConsoleRect.Bottom= m_dwRows - 1;
#if 0
CONSOLE_SCREEN_BUFFER_INFO csbi;
@@ -3230,8 +3233,8 @@ void Console::ResizeConsoleWindow() {
SMALL_RECT srConsoleRect;
srConsoleRect.Top = srConsoleRect.Left =0;
srConsoleRect.Right = m_dwColumns - 1;
srConsoleRect.Bottom= m_dwRows - 1;
// srConsoleRect.Right = m_dwColumns - 1;
// srConsoleRect.Bottom= m_dwRows - 1;
#if 0
// 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 crTxtColor = RGB(0, 0, 0);
int nNewBkMode = TRANSPARENT;
COLORREF crNewBkColor = RGB(0, 0, 0);
COLORREF crNewTxtColor = RGB(0, 0, 0);
// int nNewBkMode = TRANSPARENT;
// COLORREF crNewBkColor = RGB(0, 0, 0);
// COLORREF crNewTxtColor = RGB(0, 0, 0);
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]);
::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.top = rectLine.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight;
@@ -3676,7 +3679,7 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) {
GetCursorRect(rectCursor);
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;
}
@@ -3810,11 +3813,12 @@ void Console::ToggleWindowOnTop() {
m_dwCurrentZOrder = m_dwOriginalZOrder;
}
HWND hwndZ;
HWND hwndZ = 0;
switch (m_dwCurrentZOrder) {
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
default : return;
}
::SetWindowPos(
@@ -4098,7 +4102,7 @@ void Console::ShowReadmeFile() {
// no params, just use the readme file
strParams = m_strReadmeFile;
} else {
int nPos = strParams.find(_T("%f"));
tstring::size_type nPos = strParams.find(_T("%f"));
if (nPos == tstring::npos) {
// no '%f' in editor params, concatenate readme file name
@@ -4148,7 +4152,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
RECT rectInval;
int cursorX;
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;
cursorY = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder;
@@ -4183,7 +4187,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
OnVScroll( SB_LINEUP);
}
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;
idx--;
}
@@ -4196,17 +4200,17 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
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;
cursorX = m_nInsideBorder;
if (*pszText != '\r') {
m_csbiCursor.dwCursorPosition.Y++;
if (m_csbiCursor.dwCursorPosition.Y >= m_dwBufferRows) {
if (m_csbiCursor.dwCursorPosition.Y >= (SHORT)m_dwBufferRows) {
m_csbiCursor.dwCursorPosition.Y--;
idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns;
::CopyMemory( m_pScreenBufferNew, m_pScreenBufferNew + m_dwColumns, idx * 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);
} else {
cursorY += m_nCharHeight;
@@ -4429,7 +4433,7 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
#endif
case WM_CHAR:
myself->OnChar( wParam);
myself->OnChar( (WORD) wParam);
break;
case WM_KEYDOWN:
@@ -4511,12 +4515,12 @@ DWORD WINAPI Console::MonitorThreadStatic(LPVOID lpParam) {
DWORD Console::MonitorThread() {
// 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);
#if 0
if (dwWait == WAIT_OBJECT_0) {
::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
break;
@@ -4532,7 +4536,7 @@ DWORD Console::MonitorThread() {
// }
}
return 0;
// return 0;
}
/////////////////////////////////////////////////////////////////////////////
+2 -1
View File
@@ -61,9 +61,10 @@
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -68,7 +68,7 @@ HRESULT CreateFileStream(
hTemplateFile);
if (hFile == INVALID_HANDLE_VALUE) {
DWORD a = ::GetLastError();
// DWORD a = ::GetLastError();
ppStream = NULL;
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_CENTER_POINT: sGridNo = gMapInformation.sCenterGridNo; break;
case MAPINFO_ISOLATED_POINT: sGridNo = gMapInformation.sIsolatedGridNo; break;
default: AssertMsg( 0, "Invalid mapinfo point"); sGridNo = -1; break;
}
if( sGridNo != -1 )
{
+1 -1
View File
@@ -227,7 +227,7 @@ void CopyBuilding( INT32 iMapIndex )
//This will prevent overlapping problems.
void SortBuildingLayout( INT32 iMapIndex )
{
BUILDINGLAYOUTNODE *head, *curr, *prev, *prevBest, *best;
BUILDINGLAYOUTNODE *head, *curr, *prev, *prevBest = NULL, *best = NULL;
INT32 iBestIndex;
head = NULL;
if( iMapIndex < gsBuildingLayoutAnchorGridNo )
+1 -1
View File
@@ -80,7 +80,7 @@ ITEM_POOL *gpItemPool = NULL;
void BuildItemPoolList()
{
ITEM_POOL *temp;
IPListNode *tail;
IPListNode *tail = NULL;
UINT16 i;
KillItemPoolList();
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 )
{
UINT8 ubPaletteRep;
if( !pSoldier )
ubPaletteRep = 0xff;
UINT8 ubPaletteRep = 0xff;
if( pSoldier )
{
@@ -2020,7 +2018,13 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only
pbArray = bCivArray;
iMax = MAX_CIVTYPES;
break;
default:
AssertMsg( 0, "Unknown team");
return;
}
iIndex = -1;
//find the matching bodytype index within the array.
for( x = 0; x < iMax; x++ )
{
@@ -3423,7 +3427,7 @@ void UpdateScheduleAction( UINT8 ubNewAction )
// 0:1A, 1:1B, 2:2A, 3:2B, ...
void FindScheduleGridNo( UINT8 ubScheduleData )
{
INT32 iMapIndex;
INT32 iMapIndex = 0xffff;
switch( ubScheduleData )
{
case 0: //1a
@@ -3452,6 +3456,7 @@ void FindScheduleGridNo( UINT8 ubScheduleData )
break;
default:
AssertMsg( 0, "FindScheduleGridNo passed incorrect dataID." );
return;
}
if( iMapIndex != 0xffff )
{
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+4 -2
View File
@@ -1256,7 +1256,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
INT32 i;
UINT16 usAttachment;
UINT16 usAttachment = 0;
OBJECTTYPE temp;
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
{ //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 4: usAttachment = DUCKBILL; break;
case 5: usAttachment = UNDER_GLAUNCHER; break;
default: Assert(0); continue;
}
if( guiAttachmentButton[ i ] != -1 && btn == ButtonList[ guiAttachmentButton[ i ] ] )
{ //Found it, now check the state of the button.
@@ -1515,7 +1516,7 @@ void UpdateActionItem( INT8 bActionItemIndex )
void ReEvaluateAttachmentStatii()
{
INT32 i;
UINT16 usAttachment;
UINT16 usAttachment = 0;
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
{
if( guiAttachmentButton[ i ] != -1 && !( ButtonList[ guiAttachmentButton[ i ] ]->uiFlags & BUTTON_CLICKED_ON ) )
@@ -1528,6 +1529,7 @@ void ReEvaluateAttachmentStatii()
case 3: usAttachment = BIPOD; break;
case 4: usAttachment = DUCKBILL; break;
case 5: usAttachment = UNDER_GLAUNCHER; break;
default: Assert(0); continue;
}
if( ValidItemAttachment( gpItem, usAttachment, TRUE ) )
EnableButton( guiAttachmentButton[ i ] );
+7 -25
View File
@@ -1067,31 +1067,13 @@ BOOLEAN ExtractFilenameFromFields()
BOOLEAN ValidCoordinate()
{
if( gzFilename[0] >= 'A' && gzFilename[0] <= 'P' ||
gzFilename[0] >= 'a' && gzFilename[0] <='p' )
{
UINT16 usTotal;
if( gzFilename[1] == '1' && gzFilename[2] >= '0' && gzFilename[2] <= '6' )
{
usTotal = ( gzFilename[1] - 0x30 ) * 10 + ( gzFilename[2] - 0x30 );
}
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;
CHAR16 sectorY = 0;
UINT16 sectorX = 0;
swscanf( gzFilename, L"%c%2hd", &sectorY, &sectorX);
sectorY = towupper( sectorY);
return ( sectorY >= 'A' && sectorY <= 'P' &&
sectorX >= 1 && sectorX <= 16);
}
BOOLEAN ValidFilename()
+2 -2
View File
@@ -541,7 +541,7 @@ void PasteStructure2( UINT32 iMapIndex )
//
void PasteStructureCommon( UINT32 iMapIndex )
{
BOOLEAN fDoPaste = FALSE;
// BOOLEAN fDoPaste = FALSE;
UINT32 fHeadType;
UINT16 usUseIndex;
UINT16 usUseObjIndex;
@@ -1181,13 +1181,13 @@ void RaiseWorldLand( )
if (pTileElement->fType==FIRSTCLIFF)
{
fSomethingRaised = TRUE;
usIndex=pStruct->usIndex;
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt));
if( pTileElement->ubNumberOfTiles > 1 )
{
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles));
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
// tile database when reading into the mapsystem
// 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;
BOOLEAN fSoldierLight;
BOOLEAN fRemovedLight;
INT32 iMapIndex;
UINT32 uiLastLightType;
UINT8 *pLastLightName;
INT32 iMapIndex = 0;
UINT32 uiLastLightType = 0;
UINT8 *pLastLightName = NULL;
fRemovedLight = FALSE;
+13 -4
View File
@@ -217,6 +217,9 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
case 0xff:
usIndex = 60 + (UINT16)Random( 6 );
break;
default:
AssertMsg(0, "Invalid total given");
return 0xffff;
}
GetTileIndexFromTypeSubIndex( usType, usIndex, &usTileIndex );
return usTileIndex;
@@ -447,6 +450,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
switch( ubWallPiece )
{
case EXTERIOR_TOP:
ubWallClass = EXTERIOR_L;
iMapIndex -= WORLD_COLS;
//exterior bottom left corner generated
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 );
ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex );
}
ubWallClass = EXTERIOR_L;
if( !gfBasement )
{
//All exterior_l walls have shadows.
@@ -483,8 +486,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
}
break;
case EXTERIOR_LEFT:
iMapIndex--;
ubWallClass = EXTERIOR_R;
iMapIndex--;
if( GetHorizontalWall( iMapIndex ) )
{ //Special case where placing the new wall will generate a corner. This piece
//becomes an exterior bottomend, but nothing else is effected.
@@ -510,8 +513,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
}
break;
case INTERIOR_TOP:
iMapIndex -= WORLD_COLS;
ubWallClass = INTERIOR_L;
iMapIndex -= WORLD_COLS;
//check for a lower left corner.
if( pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) )
{ //Replace the piece with an extended piece.
@@ -554,8 +557,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
}
break;
case INTERIOR_LEFT:
iMapIndex--;
ubWallClass = INTERIOR_R;
iMapIndex--;
if( GetHorizontalWall( iMapIndex ) )
{
ubWallClass = INTERIOR_BOTTOMEND;
@@ -595,6 +598,10 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
AddExclusiveShadow( iMapIndex, usTileIndex );
}
break;
default:
AssertMsg( 0, "Invalid wall piece");
return;
}
sIndex = PickAWallPiece( ubWallClass );
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.
usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL );
usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR );
usRoofType = 0xffff;
if( usWallType == 0xffff && usFloorType != 0xffff )
{ //allow user to place floors
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;
usY = button->Area.RegionBottomRightY;
break;
default:
AssertMsg(0, "Invalid direction given");
return;
}
//Decipher the popupMenuID
+15 -14
View File
@@ -346,6 +346,10 @@ void CreateJA2SelectionWindow( INT16 sWhat )
pSelList = SelRoom;
pNumSelList = &iNumRoomsSelected;
break;
default:
// If none of these, don't create anything!
AssertMsg( 0, "Unknown window creation type");
return;
}
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint,
@@ -1086,21 +1090,19 @@ void DisplaySelectionWindowGraphicalInformation()
//
void AddToSelectionList( DisplayList *pNode )
{
INT32 iIndex, iUseIndex;
BOOLEAN fDone;
INT32 iIndex, iUseIndex = -1;
fDone = FALSE;
for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ )
for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
fDone = TRUE;
iUseIndex = iIndex;
break;
}
}
if ( fDone )
if ( iUseIndex >= 0 )
{
// Was already in the list, so bump up the count
pSelList[ iUseIndex ].sCount++;
@@ -1158,26 +1160,25 @@ BOOLEAN ClearSelectionList( void )
//
BOOLEAN RemoveFromSelectionList( DisplayList *pNode )
{
INT32 iIndex, iUseIndex;
BOOLEAN fDone, fRemoved;
INT32 iIndex, iUseIndex = -1;
BOOLEAN fRemoved;
// Abort if no entries in list (pretend we removed a node)
if ( (*pNumSelList) <= 0 )
return( TRUE );
fRemoved = FALSE;
fDone = FALSE;
for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ )
for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
fDone = TRUE;
iUseIndex = iIndex;
break;
}
}
if ( fDone )
if ( iUseIndex >= 0 )
{
// Was already in the list, so bump up the count
pSelList[ iUseIndex ].sCount--;
@@ -1613,7 +1614,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
fReturnVal = FALSE;
if (DisplayWindowFunc(pNode->pNext, iTopCutOff, iBottomCutOff, pUpperLeft, fFlags))
{
iCurrY = pUpperLeft->iY + pNode->iY - iTopCutOff;
iCurrY = (INT16) pUpperLeft->iY + pNode->iY - iTopCutOff;
if ( iCurrY > iBottomCutOff )
return(TRUE);
+5
View File
@@ -1079,6 +1079,11 @@ INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId)
iStart = GetFirstMaleSlot();
iEnd = GetLastMaleSlot();
}
else
{
AssertMsg( 0, "Merc neither male nor female");
return -1;
}
// Find a free imp slot
for (i = iStart; i <= iEnd; ++i)
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+2 -2
View File
@@ -2064,7 +2064,7 @@ INT32 GetPreviousDaysBalance( void )
UINT8 ubSecondCode;
UINT32 uiDate;
INT32 iAmount;
INT32 iBalanceToDate;
INT32 iBalanceToDate = 0;
BOOLEAN fGoneTooFar= FALSE;
INT32 iFileSize = 0;
@@ -2157,7 +2157,7 @@ INT32 GetTodaysBalance( void )
UINT8 ubSecondCode;
UINT32 uiDate;
INT32 iAmount;
INT32 iBalanceToDate;
INT32 iBalanceToDate = 0;
BOOLEAN fGoneTooFar= FALSE;
+1 -1
View File
@@ -3280,7 +3280,7 @@ void DrawIconOnButton(GUI_BUTTON *b)
INT32 IconW,IconH;
SGPRect NewClip,OldClip;
ETRLEObject *pTrav;
HVOBJECT hvObject;
HVOBJECT hvObject = NULL;
// If there's an actual icon on this button, try to show it.
if(b->iIconID >= 0)
+1 -1
View File
@@ -469,7 +469,7 @@ void DbClose( HDBINDEX hFile )
HDBFILE DbFileOpen( STR strFilename )
{
HDBFILE hFile;
HFILEINDEX hFileIndex;
HFILEINDEX hFileIndex = 0xffff;
HDBINDEX hDBIndex;
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 )
{
DDSURFACEDESC SurfaceDescription;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES = 0;
UINT8 *pDestBuf, *pSrcBuf = NULL;
HRESULT ReturnCode;
DDCOLORKEY ColorKey;
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 ptrNew;
UINT32 uiOldSize;
UINT32 uiOldSize = 0;
if ( !fMemManagerInit )
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
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
// attend to the gaming mechanics themselves
Message.wParam = 0;
while (gfProgramIsRunning)
{
// 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;
CHAR16 str[20];
INT32 iSector = 0;
UINT8 ubIconColor;
UINT8 ubIconColor = 0;
UINT8 ubGroupSize = 0;
+2 -2
View File
@@ -3950,7 +3950,7 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAtG
INT8 bSkill = 0;
INT16 sBestTrainingPts, sTrainingPtsDueToInstructor;
UINT16 usMaxTrainerPts, usBestMaxTrainerPts;
UINT16 usMaxTrainerPts, usBestMaxTrainerPts = 0;
UINT32 uiCnt;
SOLDIERTYPE * pTrainer;
@@ -8106,7 +8106,7 @@ void HandleShadingOfLinesForSquadMenu( void )
UINT32 uiCounter;
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiMaxSquad;
INT8 bResult;
INT8 bResult = 0;
if ( ( fShowSquadMenu == FALSE ) || ( ghSquadBox == -1 ) )
+1 -1
View File
@@ -622,7 +622,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
{
INT32 iRandom;
SOLDIERTYPE *pSoldier;
MAPEDGEPOINTINFO MapEdgepointInfo;
MAPEDGEPOINTINFO MapEdgepointInfo = { };
UINT8 bDesiredDirection=0;
UINT8 ubCurrSlot = 0;
+1 -1
View File
@@ -180,7 +180,7 @@ UINT16 LarryItems[ NUM_LARRY_ITEMS ][ 3 ] =
void HourlyLarryUpdate( void )
{
SOLDIERTYPE * pSoldier;
INT8 bSlot, bBoozeSlot;
INT8 bSlot = NO_SLOT, bBoozeSlot;
INT8 bLarryItemLoop;
UINT16 usTemptation = 0;
UINT16 usCashAmount;
File diff suppressed because it is too large Load Diff
+3
View File
@@ -6387,6 +6387,9 @@ void HandleLowerLevelMapBlit( void )
case( 3 ):
GetVideoObject( &hHandle, guiSubLevel3 );
break;
default:
AssertMsg( 0, "Invalid underground sector level");
return;
}
// handle the blt of the sublevel
+1
View File
@@ -761,6 +761,7 @@ void ProcessImplicationsOfMeanwhile( void )
else
{
Assert( 0 );
return;
}
gMercProfiles[ MADLAB ].sSectorX = sSectorX;
gMercProfiles[ MADLAB ].sSectorY = sSectorY;
+1 -1
View File
@@ -1745,7 +1745,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
PLAYERGROUP *pPlayer, *pNextPlayer;
SOLDIERTYPE *pSoldier;
INT8 bUniqueVehicleSquad = -1;
BOOLEAN fSuccess;
BOOLEAN fSuccess = FALSE;
if ( pGroup->fVehicle )
+6
View File
@@ -1341,7 +1341,9 @@ void AddPossiblePendingEnemiesToBattle()
else if( pGroup->ubSectorY > pGroup->ubPrevY )
ubInsertionCode = INSERTION_CODE_NORTH;
else
{
Assert(0);
}
}
else if( pGroup->ubNextX && pGroup->ubNextY )
{
@@ -1354,11 +1356,15 @@ void AddPossiblePendingEnemiesToBattle()
else if( pGroup->ubSectorY > pGroup->ubNextY )
ubInsertionCode = INSERTION_CODE_NORTH;
else
{
Assert(0);
}
}
else
{
// The group has no movement orders. Where did it come from?
Assert(0);
}
if( pGroup->pEnemyGroup->ubElitesInBattle < pGroup->pEnemyGroup->ubNumElites )
{ //Add an elite troop
+92 -137
View File
@@ -1,28 +1,29 @@
#ifdef PRECOMPILEDHEADERS
#include "Strategic All.h"
#include "Strategic All.h"
#else
#include "Town Militia.h"
#include "Militia Control.h"
#include "Campaign Types.h"
#include "strategic.h"
#include "strategicmap.h"
#include "Overhead.h"
#include "Strategic Town Loyalty.h"
#include "Utilities.h"
#include "random.h"
#include "text.h"
#include "Map Screen Interface.h"
#include "Interface.h"
#include "Laptopsave.h"
#include "finances.h"
#include "Game Clock.h"
#include "Assignments.h"
#include "squads.h"
#include "Soldier Create.h"
#include "Dialogue Control.h"
#include "Queen Command.h"
#include "GameSettings.h"
#include "Soldier Init List.h"
#include "Town Militia.h"
#include "Militia Control.h"
#include "Campaign Types.h"
#include "strategic.h"
#include "strategicmap.h"
#include "Overhead.h"
#include "Strategic Town Loyalty.h"
#include "Utilities.h"
#include "random.h"
#include "text.h"
#include "Map Screen Interface.h"
#include "Interface.h"
#include "Laptopsave.h"
#include "finances.h"
#include "Game Clock.h"
#include "Assignments.h"
#include "squads.h"
#include "Soldier Create.h"
#include "Dialogue Control.h"
#include "Queen Command.h"
#include "GameSettings.h"
#include "Soldier Init List.h"
#include "Inventory Choosing.h"
#endif
#include "Reinforcement.h"
@@ -35,7 +36,7 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites );
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites );
@@ -73,7 +74,7 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
ubNumAdmins--;
}
}
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites );
@@ -88,7 +89,7 @@ UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY )
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites );
return ubNumAdmins + ubNumTroops + ubNumElites;
}
@@ -133,7 +134,7 @@ UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY)
UINT8 ubResult = 0;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
ubResult = CountAllMilitiaInSector( sMapX, sMapY );
if( !gGameExternalOptions.gfAllowReinforcements )
@@ -154,7 +155,7 @@ UINT8 MilitiaInFiveSectorsOfRank( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
UINT8 ubResult = 0;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
ubResult = MilitiaInSectorOfRank( sMapX, sMapY, ubRank );
if( !gGameExternalOptions.gfAllowReinforcements )
@@ -166,7 +167,7 @@ UINT8 MilitiaInFiveSectorsOfRank( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
ubResult += MilitiaInSectorOfRank( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), ubRank );
return ubResult;
}
@@ -176,13 +177,13 @@ BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY)
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber;
UINT8 ubRandom;
if( !gGameExternalOptions.gfAllowReinforcements )
return FALSE;
if( CountAllMilitiaInSector( sMapX, sMapY ) >= gGameExternalOptions.guiMaxMilitiaSquadSize ||
CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 )
return FALSE;
return FALSE;
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
@@ -191,7 +192,7 @@ BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY)
while( !MoveOneBestMilitiaMan( SECTORX( pusMoveDir[ ubRandom ][ 0 ] ), SECTORY( pusMoveDir[ ubRandom ][ 0 ] ), sMapX, sMapY ) )
ubRandom = Random( ubDirNumber );
return TRUE;
}
@@ -199,7 +200,7 @@ BOOLEAN ARRemoveMilitiaMan( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
{
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubRandom;
if( MilitiaInSectorOfRank( sMapX, sMapY, ubRank ) )
{
StrategicRemoveMilitiaFromSector( sMapX, sMapY, ubRank, 1 );
@@ -260,78 +261,24 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
( 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++ )
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->ubPrevY = pGroup->ubSectorY;
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX;
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY;
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
gfPendingEnemies = TRUE;
ResetMortarsOnTeamCount();
}
#endif
}
if( NumEnemiesInFiveSectors( sMapX, sMapY ) - NumEnemiesInSector( sMapX, sMapY ) == 0 )
{
return 255;
}else
for(;;)
while( ubDirNumber > 0)
{
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 )
{
@@ -363,7 +310,15 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
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 )
return 255;
// pThisSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ];
// pThisSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ];
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
@@ -402,33 +357,33 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
return 255;
}else
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 ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,ELITE_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),ELITE_MILITIA, 1 );
*pubRank = ELITE_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,REGULAR_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),REGULAR_MILITIA, 1 );
*pubRank = REGULAR_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,GREEN_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),GREEN_MILITIA, 1 );
*pubRank = GREEN_MILITIA;
if( pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,ELITE_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),ELITE_MILITIA, 1 );
*pubRank = ELITE_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,REGULAR_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),REGULAR_MILITIA, 1 );
*pubRank = REGULAR_MILITIA;
}else if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] )
{
StrategicAddMilitiaToSector( sMapX, sMapY,GREEN_MILITIA, 1 );
StrategicRemoveMilitiaFromSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ),GREEN_MILITIA, 1 );
*pubRank = GREEN_MILITIA;
}
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
}
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
}
}
}
@@ -441,42 +396,42 @@ void AddPossiblePendingMilitiaToBattle()
static UINT8 ubPredefinedInsertionCode = 255;
static UINT8 ubPredefinedRank = 255;
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 )
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY )
)
return;
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
ubSlots = NumFreeMilitiaSlots();
if( !ubSlots )
{ //no available slots to add militia to. Try again later...
return;
}
if( ubPredefinedInsertionCode != 255 && ubPredefinedRank != 255 &&
CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
{
ubNumElites = ubNumRegulars = ubNumGreens = 0;
// while( ubSlots )
// while( ubSlots )
switch( ubPredefinedRank )
{
case ELITE_MILITIA:
ubSlots--;
ubNumElites++;
break;
case REGULAR_MILITIA:
ubSlots--;
ubNumRegulars++;
break;
case GREEN_MILITIA:
ubSlots--;
ubNumGreens++;
break;
default:
ubSlots--;
case ELITE_MILITIA:
ubSlots--;
ubNumElites++;
break;
case REGULAR_MILITIA:
ubSlots--;
ubNumRegulars++;
break;
case GREEN_MILITIA:
ubSlots--;
ubNumGreens++;
break;
default:
ubSlots--;
}
if( ubNumGreens || ubNumRegulars || ubNumElites )
@@ -488,7 +443,7 @@ void AddPossiblePendingMilitiaToBattle()
if( ubSlots )
{ //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 );
if( ubPredefinedInsertionCode != 255 )
+3
View File
@@ -78,6 +78,9 @@ void HandleStrategicTurn( )
}
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 )
{
uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -3075,7 +3075,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16
SOLDIERTYPE *pValidSoldier = NULL;
GROUP *pGroup;
UINT32 uiTraverseTime=0;
UINT8 ubDirection;
UINT8 ubDirection = 0xff;
EXITGRID ExitGrid;
INT8 bPrevAssignment;
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->fTalking )
+1 -1
View File
@@ -35,7 +35,7 @@
#include "Scheduling.h"
#endif
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode );
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode, GROUP *pGroup = NULL );
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;
BOOLEAN fDoMenu = FALSE;
DOOR * pDoor;
DOOR * pDoor = NULL;
DOOR_STATUS * pDoorStatus;
BOOLEAN fTrapsFound = FALSE;
+134 -133
View File
@@ -1,65 +1,65 @@
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#include "Tactical All.h"
#else
#include "items.h"
#include "Action Items.h"
#include "handle Items.h"
#include "overhead.h"
#include "weapons.h"
#include "points.h"
#include "tiledef.h"
#include "worlddef.h"
#include "worldman.h"
#include "interface.h"
#include "renderworld.h"
#include "Animation Control.h"
#include "font control.h"
#include "render dirty.h"
#include "World items.h"
#include "text.h"
#include "Timer Control.h"
#include "wcheck.h"
#include "interface items.h"
#include "physics.h"
#include "soldier profile.h"
#include "interface dialogue.h"
#include "quests.h"
#include "message.h"
#include "isometric utils.h"
#include "los.h"
#include "dialogue control.h"
#include "ai.h"
#include "soldier macros.h"
#include "interface panels.h"
#include "Strategic Town Loyalty.h"
#include "soldier functions.h"
#include "Map Screen Helicopter.h"
#include "pathai.h"
#include "fov.h"
#include "MessageBoxScreen.h"
#include "explosion control.h"
#include "SkillCheck.h"
#include "Campaign.h"
#include "Random.h"
#include "structure wrap.h"
#include "interactive tiles.h"
#include "SaveLoadMap.h"
#include "ShopKeeper Interface.h"
#include "Arms Dealer Init.h"
#include "soldier add.h"
#include "sound control.h"
#include "squads.h"
#include "rotting corpses.h"
#include "soldier ani.h"
#include "Opplist.h"
#include "qarray.h"
#include "render fun.h"
#include "environment.h"
#include "Map Information.h"
#include "GameSettings.h"
#include "end game.h"
#include "interface control.h"
#include "Map Screen Interface Map Inventory.h"
#include "items.h"
#include "Action Items.h"
#include "handle Items.h"
#include "overhead.h"
#include "weapons.h"
#include "points.h"
#include "tiledef.h"
#include "worlddef.h"
#include "worldman.h"
#include "interface.h"
#include "renderworld.h"
#include "Animation Control.h"
#include "font control.h"
#include "render dirty.h"
#include "World items.h"
#include "text.h"
#include "Timer Control.h"
#include "wcheck.h"
#include "interface items.h"
#include "physics.h"
#include "soldier profile.h"
#include "interface dialogue.h"
#include "quests.h"
#include "message.h"
#include "isometric utils.h"
#include "los.h"
#include "dialogue control.h"
#include "ai.h"
#include "soldier macros.h"
#include "interface panels.h"
#include "Strategic Town Loyalty.h"
#include "soldier functions.h"
#include "Map Screen Helicopter.h"
#include "pathai.h"
#include "fov.h"
#include "MessageBoxScreen.h"
#include "explosion control.h"
#include "SkillCheck.h"
#include "Campaign.h"
#include "Random.h"
#include "structure wrap.h"
#include "interactive tiles.h"
#include "SaveLoadMap.h"
#include "ShopKeeper Interface.h"
#include "Arms Dealer Init.h"
#include "soldier add.h"
#include "sound control.h"
#include "squads.h"
#include "rotting corpses.h"
#include "soldier ani.h"
#include "Opplist.h"
#include "qarray.h"
#include "render fun.h"
#include "environment.h"
#include "Map Information.h"
#include "GameSettings.h"
#include "end game.h"
#include "interface control.h"
#include "Map Screen Interface Map Inventory.h"
#endif
#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;
UINT16 usSoldierIndex;
@@ -196,7 +196,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
BOOLEAN fAddingRaiseGunCost = FALSE;
LEVELNODE *pIntNode;
STRUCTURE *pStructure;
INT16 sGridNo;
// Remove any previous actions
@@ -207,8 +206,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
pSoldier->usAttackingWeapon = usHandItem;
// Find soldier flags depend on if it's our own merc firing or a NPC
//if ( FindSoldier( usGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
if ( ( usSoldierIndex = WhoIsThere2( usGridNo, bLevel ) ) != NO_SOLDIER )
//if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
if ( ( usSoldierIndex = WhoIsThere2( sGridNo, bLevel ) ) != NO_SOLDIER )
{
pTargetSoldier = MercPtrs[ usSoldierIndex ];
@@ -232,10 +231,10 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
gTacticalStatus.ubAttackBusyCount = 0;
}
// if ( pTargetSoldier )
// {
// pTargetSoldier->bBeingAttackedCount = 0;
// }
// if ( pTargetSoldier )
// {
// pTargetSoldier->bBeingAttackedCount = 0;
// }
// Check our soldier's life for unconscious!
@@ -376,7 +375,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
}
else
{
sTargetGridNo = usGridNo;
sTargetGridNo = sGridNo;
}
// 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;
INT16 sGotLocation = NOWHERE;
BOOLEAN fGotAdjacent = FALSE;
sAdjustedGridNo = NOWHERE;
ubDirection = 0xff;
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 )
{
// 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 )
{
// OK, we've got somebody...
@@ -667,9 +668,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// Did we get a loaction?
if ( sGotLocation != NOWHERE )
{
pSoldier->sTargetGridNo = usGridNo;
pSoldier->sTargetGridNo = sGridNo;
pSoldier->usActionData = usGridNo;
pSoldier->usActionData = sGridNo;
// CHECK IF WE ARE AT THIS GRIDNO NOW
if ( pSoldier->sGridNo != sGotLocation && fGotAdjacent )
{
@@ -710,7 +711,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if (gTacticalStatus.fAutoBandageMode)
{
usMapPos = usGridNo;
usMapPos = sGridNo;
}
else
{
@@ -718,7 +719,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
}
// 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 )
{
// Try another location...
@@ -762,7 +763,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
}
else
{
pSoldier->sPendingActionData2 = usGridNo;
pSoldier->sPendingActionData2 = sGridNo;
}
}
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
{
// 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 )
{
// Calculate AP costs...
@@ -847,7 +848,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
INT16 sVehicleGridNo=-1;
// 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;
UINT8 ubDirection;
@@ -856,7 +857,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( sNewGridNo != NOWHERE )
{
usGridNo = sNewGridNo;
sGridNo = sNewGridNo;
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
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 )
{
@@ -925,7 +926,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
INT16 sVehicleGridNo=-1;
// 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;
UINT8 ubDirection;
@@ -934,7 +935,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( sNewGridNo != NOWHERE )
{
usGridNo = sNewGridNo;
sGridNo = sNewGridNo;
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
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 )
{
@@ -995,7 +996,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( Item[usHandItem].jar )
{
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo != -1 )
{
@@ -1049,12 +1050,12 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
LEVELNODE *pIntTile;
// 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...
if ( pIntTile != NULL )
{
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE );
if ( sActionGridNo != -1 )
{
@@ -1069,7 +1070,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
{
// SEND PENDING ACTION
pSoldier->ubPendingAction = MERC_ATTACH_CAN;
pSoldier->sPendingActionData2 = usGridNo;
pSoldier->sPendingActionData2 = sGridNo;
pSoldier->bPendingActionData3 = ubDirection;
pSoldier->ubPendingActionAnimCount = 0;
@@ -1078,7 +1079,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
}
else
{
EVENT_SoldierBeginTakeBlood( pSoldier, usGridNo, ubDirection );
EVENT_SoldierBeginTakeBlood( pSoldier, sGridNo, ubDirection );
}
// OK, set UI
@@ -1125,7 +1126,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
else // detonator
{
// Save gridno....
pSoldier->sPendingActionData2 = usGridNo;
pSoldier->sPendingActionData2 = sGridNo;
EVENT_SoldierBeginUseDetonator( pSoldier );
@@ -1164,16 +1165,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
if ( fDropBomb )
{
// Save gridno....
pSoldier->sPendingActionData2 = usGridNo;
pSoldier->sPendingActionData2 = sGridNo;
if ( pSoldier->sGridNo != usGridNo )
if ( pSoldier->sGridNo != sGridNo )
{
// SEND PENDING ACTION
pSoldier->ubPendingAction = MERC_DROPBOMB;
pSoldier->ubPendingActionAnimCount = 0;
// WALK UP TO DEST FIRST
EVENT_InternalGetNewSoldierPath( pSoldier, usGridNo, pSoldier->usUIMovementMode, FALSE, TRUE );
EVENT_InternalGetNewSoldierPath( pSoldier, sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE );
}
else
{
@@ -1197,19 +1198,19 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// See if we can get there to stab
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)
{
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
}
}
else
{
sActionGridNo = FindAdjacentGridEx( pSoldier, usGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
}
if ( sActionGridNo != -1 )
@@ -1260,7 +1261,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
//pSoldier->sLastTarget = sTargetGridNo;
//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) );
DebugAttackBusy( "Swipe attack\n");
@@ -1290,7 +1291,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
}
else
{
sTargetGridNo = usGridNo;
sTargetGridNo = sGridNo;
}
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 );
// Increment attack counter...
// gTacticalStatus.ubAttackBusyCount++;
// gTacticalStatus.ubAttackBusyCount++;
DebugAttackBusy( "Weapon fire\n");
@@ -1384,7 +1385,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, UINT16 usGridNo, INT8 bLevel, UINT16 us
// Found detonator...
if ( IsDetonatorAttached ( &(pSoldier->inv[ usHandItem ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ usHandItem ] ) ) )
{
StartBombMessageBox( pSoldier, usGridNo );
StartBombMessageBox( pSoldier, sGridNo );
if ( fFromUI )
{
@@ -1513,22 +1514,22 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo )
//<SB> crouch throwing
case ANIM_PRONE:
if ( sGridNo == pSoldier->sGridNo )
if ( sGridNo == pSoldier->sGridNo )
{
// OK, JUST DROP ITEM!
if ( pSoldier->pTempObject != NULL )
{
// OK, JUST DROP ITEM!
if ( pSoldier->pTempObject != NULL )
{
AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 );
NotifySoldiersToLookforItems( );
AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 );
NotifySoldiersToLookforItems( );
MemFree( pSoldier->pTempObject );
pSoldier->pTempObject = NULL;
}
break;
MemFree( pSoldier->pTempObject );
pSoldier->pTempObject = NULL;
}
ChangeSoldierStance( pSoldier, ANIM_CROUCH );
break;
}
ChangeSoldierStance( pSoldier, ANIM_CROUCH );
case ANIM_CROUCH:
case ANIM_CROUCH:
// CHECK IF WE ARE NOT ON THE SAME GRIDNO
if ( sGridNo == pSoldier->sGridNo )
{
@@ -1544,18 +1545,18 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo )
}
else
{
// CHANGE DIRECTION AT LEAST
// CHANGE DIRECTION AT LEAST
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
SoldierGotoStationaryStance( pSoldier );
SoldierGotoStationaryStance( pSoldier );
EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection );
pSoldier->fTurningUntilDone = TRUE;
pSoldier->fTurningUntilDone = TRUE;
pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED;
pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED;
}
break;
//</SB>
break;
//</SB>
}
}
@@ -3474,17 +3475,17 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I
// Set string
if ( cnt == gbCurrentItemSel )
{
SetFontForeground( FONT_MCOLOR_LTGRAY );
}
else
{
SetFontForeground( FONT_MCOLOR_DKGRAY );
}
SetFontForeground( FONT_MCOLOR_LTGRAY );
}
else
{
SetFontForeground( FONT_MCOLOR_DKGRAY );
}
swprintf( pStr, TacticalStr[ ITEMPOOL_POPUP_MORE_STR ] );
gprintfdirty( sFontX, sY, pStr );
mprintf( sFontX, sY, pStr );
}
}
gprintfdirty( sFontX, sY, pStr );
mprintf( sFontX, sY, pStr );
}
}
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
//reachable.
// WDS - Clean up inventory handling
// WDS - Clean up inventory handling
//memset( &soldier, 0, SIZEOF_SOLDIERTYPE );
soldier.initialize();
soldier.bTeam = 1;
@@ -5351,7 +5352,7 @@ BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay )
UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet)
{
UINT8 ubCount=0;
ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool;
ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool = NULL;
OBJECTTYPE *pObject;
UINT8 i;
BOOLEAN fStealItem = FALSE;
@@ -5362,7 +5363,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
{
fStealItem = FALSE;
// WDS - Clean up inventory handling
// WDS - Clean up inventory handling
pObject=&pOpponent->inv[i];
if (pObject->usItem!=0)
{
@@ -5478,9 +5479,9 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,
cnt++;
if ( fPickup )
{
// WDS - Clean up inventory handling
// WDS - Clean up inventory handling
// 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];
if ( ItemIsCool( &Object ) )
{
+1 -1
View File
@@ -82,7 +82,7 @@ typedef struct
// WDS - Clean up inventory handling
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 HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel );
void HandleFlashingItems( );
+1 -1
View File
@@ -3597,7 +3597,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
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 );
// check fact
+24 -21
View File
@@ -2009,7 +2009,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
{
UINT16 uiStringLength;
INVTYPE *pItem;
ETRLEObject *pTrav;
ETRLEObject *pTrav;
UINT32 usHeight, usWidth;
INT16 sCenX, sCenY, sNewY, sNewX;
HVOBJECT hVObject;
@@ -2050,7 +2050,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
// Shadow area
if(gGameSettings.fOptions[ TOPTION_SHOW_ITEM_SHADOW ]) BltVideoObjectOutlineShadowFromIndex( uiBuffer, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX - 2, sCenY + 2 );
BltVideoObjectOutlineFromIndex( uiBuffer, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX, sCenY, sOutlineColor, fOutline );
@@ -2106,7 +2106,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
// SetFontForeground( FONT_MCOLOR_DKGRAY );
// break;
//}
swprintf( pStr, L"%d", pObject->ubGunShotsLeft );
if ( uiBuffer == guiSAVEBUFFER )
@@ -2234,7 +2234,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
}
mprintf( sNewX, sNewY, pStr );
gprintfinvalidate( sNewX, sNewY, pStr );
}
@@ -2266,6 +2266,10 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
sFontY = sY + 1;
gprintfinvalidate( sFontX, sFontY, pStr );
// Squelch the compiler warnings
sFontX2 = sX;
sFontY2 = sY;
if ( fLineSplit )
{
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 );
}
}
if ( *pubHighlightCounter == 2 )
{
mprintf( sFontX, sFontY, pStr );
if ( fLineSplit )
if ( *pubHighlightCounter == 2 )
{
mprintf( sFontX2, sFontY2, pStr2 );
mprintf( sFontX, sFontY, pStr );
if ( fLineSplit )
{
mprintf( sFontX2, sFontY2, pStr2 );
}
}
}
else if ( *pubHighlightCounter == 1 )
{
*pubHighlightCounter = 0;
gprintfRestore( sFontX, sFontY, pStr );
if ( fLineSplit )
else if ( *pubHighlightCounter == 1 )
{
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;
BOOLEAN fFound, fAllFound;
UINT8 ubAPCost;
UINT8 ubAPCost = 0;
if( gfInItemDescBox == FALSE )
{
+1 -1
View File
@@ -1827,7 +1827,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
INT16 sFontX, sFontY;
INT16 usX, usY;
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 ];
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 )
{
UINT32 uiBAR, uiPLAYERBAR, uiINTBAR;
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
INT16 sX, sY;
INT32 cnt2;
INT16 sBarX = 0;
@@ -2983,7 +2983,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution == 0)
{
FilenameForBPP("INTERFACE\\rect.sti", VObjectDesc.ImageFile);
FilenameForBPP("INTERFACE\\rect.sti", VObjectDesc.ImageFile);
}
else if (iResolution == 1)
{
@@ -2993,6 +2993,11 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
{
FilenameForBPP("INTERFACE\\rect_1024x768.sti", VObjectDesc.ImageFile);
}
else
{
AssertMsg( 0, "Invalid resolution");
return;
}
if( !AddVideoObject( &VObjectDesc, &uiBAR ) )
AssertMsg(0, "Missing INTERFACE\\rect.sti" );
@@ -3003,40 +3008,44 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution == 0)
{
FilenameForBPP("INTERFACE\\timebargreen.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebargreen.sti" );
}
else if (iResolution == 1)
{
FilenameForBPP("INTERFACE\\timebargreen_800x600.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiPLAYERBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebargreen_800x600.sti" );
}
else if (iResolution == 2)
{
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)
{
FilenameForBPP("INTERFACE\\timebaryellow.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebaryellow.sti" );
FilenameForBPP("INTERFACE\\timebaryellow.sti", VObjectDesc.ImageFile);
}
else if (iResolution == 1)
{
FilenameForBPP("INTERFACE\\timebaryellow_800x600.sti", VObjectDesc.ImageFile);
if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) )
AssertMsg(0, "Missing INTERFACE\\timebaryellow_800x600.sti" );
}
else if (iResolution == 2)
{
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
SetFontDestBuffer( uiSurface , 0, 0, SCREEN_WIDTH , 20, FALSE );
@@ -3837,13 +3846,12 @@ void RenderAimCubeUI( )
if ( gfInAimCubeUI )
{
// Determine screen location....
GetGridNoScreenPos( gCubeUIData.sGridNo, gCubeUIData.ubLevel, &sScreenX, &sScreenY );
// OK, given height
if ( gCubeUIData.fShowHeight )
{
// Determine screen location....
GetGridNoScreenPos( gCubeUIData.sGridNo, gCubeUIData.ubLevel, &sScreenX, &sScreenY );
// Save background
iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sScreenX, (INT16)(sScreenY - 70 ), (INT16)(sScreenX + 40 ), (INT16)(sScreenY + 50 ) );
if ( iBack != -1 )
+2
View File
@@ -3576,6 +3576,8 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
ddOrigHorizAngle = atan2( dDeltaY, dDeltaX );
ddOrigVerticAngle = atan2( dDeltaZ, (d2DDistance * 2.56f) );
ddAdjustedHorizAngle = ddOrigHorizAngle;
ddAdjustedVerticAngle = ddOrigVerticAngle;
ubShots = 1;
fTracer = FALSE;
+1 -1
View File
@@ -1059,7 +1059,7 @@ void HandleShadingOfLinesForMilitiaControlMenu( void )
BOOLEAN CheckIfRadioIsEquipped( void )
{
SOLDIERTYPE *pSoldier = NULL;
INT8 bSlot;
INT8 bSlot = NO_SLOT;
// do we have a radio ?
//pSoldier = GetSelectedAssignSoldier( FALSE ); //do not use
+4 -1
View File
@@ -3111,7 +3111,7 @@ void RebuildAllSoldierShadeTables( )
void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier )
{
INT32 cnt;
INT32 iNewSelectedSoldier;
INT32 iNewSelectedSoldier = -1;
SOLDIERTYPE *pTeamSoldier;
BOOLEAN fMissionFailed = TRUE;
INT8 bBuddyIndex;
@@ -8340,6 +8340,9 @@ void DoCreatureTensionQuote( SOLDIERTYPE *pSoldier )
fCanDoQuote = FALSE;
}
break;
default:
AssertMsg(0, "Invalid quote");
return;
}
if ( fCanDoQuote )
+859 -859
View File
File diff suppressed because it is too large Load Diff
+491 -489
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;
SOLDIERCREATE_STRUCT tempDetailedPlacement;
@@ -723,6 +723,12 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr )
{
curr->pSoldier = pSoldier;
curr->ubSoldierID = ubID;
if (pGroup)
{
pSoldier->ubGroupID = pGroup->ubGroupID;
pSoldier->pGroup = pGroup;
}
AddSoldierToSectorNoCalculateDirection( ubID );
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) )
{
UINT32 uiLoop;
UINT16 usTemp;
UINT16 usTemp = NOWHERE;
UINT16 usNewGridNo;
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 )
{
UINT8 ubShotsPerBurst;
UINT8 ubShotsPerBurst = 0;
FLOAT dAccululator = 0;
FLOAT dStep = 0;
INT32 cnt;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+1 -1
View File
@@ -3005,7 +3005,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
UINT32 uiMissVolume = MIDVOLUME;
BOOLEAN fHitSameStructureAsBefore;
BULLET * pBullet;
SOLDIERTYPE * pAttacker;
SOLDIERTYPE * pAttacker = NULL;
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 );
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 ( 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);
}
}
#endif
return;
}
+1 -1
View File
@@ -5066,7 +5066,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy
INT8 bCheckTerrain = FALSE;
UINT8 ubSourceTerrType, ubSource;
INT8 bTellPlayer = FALSE, bHeard, bSeen;
UINT8 ubHeardLoudestBy, ubNoiseDir, ubLoudestNoiseDir;
UINT8 ubHeardLoudestBy = NOBODY, ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff;
#ifdef RECORDOPPLIST
+1 -1
View File
@@ -869,7 +869,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK,
INT16 *psLastLoc, *pusNoiseGridNo;
INT8 *pbLastLevel;
INT16 sGridNo=-1;
INT8 bLevel, bClosestLevel;
INT8 bLevel, bClosestLevel = -1;
BOOLEAN fClimbingNecessary, fClosestClimbingNecessary = FALSE;
INT32 iPathCost;
INT16 sClosestDisturbance = NOWHERE;
+2 -2
View File
@@ -1181,7 +1181,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
INT32 iAttackValue;
INT32 iThreatValue,iHitRate,iBestHitRate,iPercentBetter, iEstDamage;
BOOLEAN fSurpriseStab;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
SOLDIERTYPE *pOpponent;
UINT16 usTrueMovementMode;
@@ -1394,7 +1394,7 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
INT32 iAttackValue;
INT32 iThreatValue,iHitRate,iBestHitRate, iEstDamage;
BOOLEAN fSurpriseStab;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime;
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
SOLDIERTYPE *pOpponent;
+1 -1
View File
@@ -910,7 +910,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
INT8 bCanAttack;
INT8 bSpitIn, bWeaponIn;
UINT32 uiChance;
ATTACKTYPE BestShot, BestStab, BestAttack, CurrStab;
ATTACKTYPE BestShot = {}, BestStab = {}, BestAttack = {}, CurrStab = {};
BOOLEAN fRunAway = FALSE;
BOOLEAN fChangeLevel;
+22 -9
View File
@@ -1233,13 +1233,17 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
INT16 sNoiseGridNo = MostImportantNoiseHeard(pSoldier,&iNoiseValue, &fClimb, &fReachable);
UINT8 ubNoiseDir;
if (sNoiseGridNo != NOWHERE)
ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sNoiseGridNo),CenterY(sNoiseGridNo));
if ( sNoiseGridNo != NOWHERE && pSoldier->bDirection != ubNoiseDir )
pSoldier->usActionData = ubNoiseDir;
else
if (sNoiseGridNo == NOWHERE ||
(ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sNoiseGridNo),CenterY(sNoiseGridNo))
) == pSoldier->bDirection )
{
pSoldier->usActionData = (UINT16)PreRandom(8);
}
else
{
pSoldier->usActionData = ubNoiseDir;
}
}
} 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 )
{
@@ -3425,9 +3430,9 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
#endif
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) ) );
UINT8 ubBestStance, ubStanceCost;
UINT8 ubBestStance = 1, ubStanceCost;
BOOLEAN fChangeStanceFirst; // before firing
BOOLEAN fClimb;
UINT8 ubBurstAPs;
@@ -4128,6 +4133,8 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
// 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
iCoverPercentBetter = 0;
if ( (ubCanMove && !SkipCoverCheck && !gfHiddenInterrupt &&
((ubBestAttackAction == AI_ACTION_NONE) || pSoldier->bLastAttackHit) &&
(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
UINT32 uiLoop;
INT32 iCurrentCoverValue, iCoverValue, iBestCoverValue;
INT32 iCurrentScale, iCoverScale, iBestCoverScale;
INT32 iCurrentScale = -1, iCoverScale = -1, iBestCoverScale = -1;
INT32 iDistFromOrigin, iDistCoverFromOrigin, iThreatCertainty;
INT16 sGridNo, sBestCover = NOWHERE;
INT32 iPathCost;
+2 -2
View File
@@ -225,8 +225,8 @@ BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier )
INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb )
{
UINT8 cnt, cnt2;
INT16 bBestPriority = 0, sBestAdjGridNo;
INT16 sPatientGridNo, sBestPatientGridNo;
INT16 bBestPriority = 0, sBestAdjGridNo = NOWHERE;
INT16 sPatientGridNo = NOWHERE, sBestPatientGridNo = NOWHERE;
INT16 sShortestPath = 1000, sPathCost, sOtherMedicPathCost;
SOLDIERTYPE * pPatient;
SOLDIERTYPE * pBestPatient = NULL;
+4 -3
View File
@@ -2168,7 +2168,7 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc )
UINT8 ubNPC, ubMerc, ubDesiredMerc = NOBODY;
UINT8 ubTalkDesire, ubHighestTalkDesire = 0;
SOLDIERTYPE * pMerc;
SOLDIERTYPE * pDesiredMerc;
SOLDIERTYPE * pDesiredMerc = NULL;
NPCQuoteInfo * pNPCQuoteInfoArray;
CHECKF( pubDesiredMerc );
@@ -2215,16 +2215,17 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc )
{
ubHighestTalkDesire = ubTalkDesire;
ubDesiredMerc = ubMerc;
pDesiredMerc = MercPtrs[ubMerc];
pDesiredMerc = MercSlots[ubMerc];
sDesiredMercDist = PythSpacesAway( sMyGridNo, pDesiredMerc->sGridNo );
}
else if (ubTalkDesire == ubHighestTalkDesire)
{
sDist = PythSpacesAway( sMyGridNo, MercPtrs[ubMerc]->sGridNo );
sDist = PythSpacesAway( sMyGridNo, MercSlots[ubMerc]->sGridNo );
if (sDist < sDesiredMercDist)
{
// we can say the same thing to this merc, and they're closer!
ubDesiredMerc = ubMerc;
pDesiredMerc = MercSlots[ubMerc];
sDesiredMercDist = sDist;
}
}
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+3 -3
View File
@@ -1215,12 +1215,12 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
STRUCTURE * pBaseStructure;
INT16 sDesiredLevel;
DB_STRUCTURE_TILE **ppTile;
DB_STRUCTURE_TILE **ppTile = NULL;
UINT8 ubLoop, ubLoop2;
INT16 sNewGridNo, sNewGridNo2, sBaseGridNo;
INT16 sNewGridNo, sNewGridNo2, sBaseGridNo = NOWHERE;
BOOLEAN fToBreak = FALSE;
BOOLEAN fMultiStructure = FALSE;
UINT8 ubNumberOfTiles;
UINT8 ubNumberOfTiles = 0xff;
BOOLEAN fMultiStructSpecialFlag = FALSE;
BOOLEAN fExplodeDamageReturn = FALSE;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+4 -4
View File
@@ -727,9 +727,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
INT32 iCollisionCode = COLLISION_NONE;
BOOLEAN fDoCollision = FALSE;
FLOAT dElasity = 1;
UINT16 usStructureID;
FLOAT dNormalX, dNormalY, dNormalZ;
INT16 sGridNo;
UINT16 usStructureID = -1;
FLOAT dNormalX = 0.0, dNormalY = 0.0, dNormalZ = 1.0;
INT16 sGridNo = NOWHERE;
// Checkf for collisions
dX = pObject->Position.x;
@@ -2652,7 +2652,7 @@ BOOLEAN LoadPhysicsTableFromSavedGameFile( HWFILE hFile )
UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius )
{
INT16 sX, sY;
INT16 sGridNo;
INT16 sGridNo = NOWHERE;
INT32 leftmost;
BOOLEAN fFound = FALSE;
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;
SOLDIERTYPE *pSoldier, *pSelSoldier;
HVOBJECT hVObject;
HVOBJECT hVObject = NULL;
ETRLEObject *pTrav;
TILE_ELEMENT *TileElem=NULL;
UINT32 uiDestPitchBYTES;
UINT32 uiDestPitchBYTES = 0;
UINT8 *pDestBuf=NULL;
UINT16 usAnimSurface;
INT8 bXOddFlag = 0;
@@ -1234,7 +1234,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
usImageIndex = pNode->pAniTile->sCurrentFrame;
uiAniTileFlags = pNode->pAniTile->uiFlags;
// Position corpse based on it's float position
// Position corpse based on its float position
if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) )
{
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 )
{
STRUCTURE * pCurrent, *pStructure;
STRUCTURE * pCurrent, *pStructure = NULL;
INT16 sDesiredLevel;
BOOLEAN fOKStructOnLevel = FALSE;
BOOLEAN fMinimumBlockingFound = FALSE;
+1 -1
View File
@@ -115,7 +115,7 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
SGPPaletteEntry * pSGPPaletteEntry;
STCIPaletteElement STCIPaletteEntry;
STCISubImage * pSubImageBuffer;
STCISubImage * pSubImageBuffer = NULL;
UINT16 usNumberOfSubImages;
UINT32 uiSubImageBufferSize=0;
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
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)
{
UINT16 usPosX, usPosY;
UINT16 usPosX = 0, usPosY = 0;
UINT16 usFontHeight=0;
UINT16 usStringWidth=0;
+2 -1
View File
@@ -49,8 +49,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+2
View File
@@ -51,6 +51,8 @@ static LuaAttrib* LuaCommonGetSet( lua_State *L )
else
{
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++ )
+2 -1
View File
@@ -46,8 +46,9 @@
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
+2 -3
View File
@@ -83,7 +83,7 @@ static int LuaWStringChar( lua_State *L )
len--;
for( idx=0; idx<len; idx++)
{
str[ idx ] = luaL_checkint( L, idx + 1 );
str[ idx ] = (CHAR16) luaL_checkint( L, idx + 1 );
}
str[ idx ] = 0;
@@ -213,7 +213,6 @@ static int LuaWStringUpper( lua_State *L )
static int LuaWStringToString( lua_State *L )
{
TWString *tw = (TWString*) luaL_checkudata( L, 1, "wstring" );
int len = tw->len;
int newlen;
STR8 newstr = NULL;
@@ -227,7 +226,7 @@ static int LuaWStringToString( 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 );
// Disqualify metafunctions